diff --git a/VERSION b/VERSION index b7885a80b5a..44bbdda1cf5 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=3 MYSQL_VERSION_PATCH=3 +SERVER_MATURITY=beta diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 30d00706a9f..cca3fba5325 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2955,10 +2955,11 @@ int main(int argc, char** argv) if (!argc || opt_version) { - if (!argc) - usage(); if (!opt_version) + { + usage(); retval= ERROR_STOP; + } goto err; } diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index 3edcdc4c1c5..d7ab0f31991 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -42,7 +42,8 @@ MACRO(CHECK_DTRACE) # On FreeBSD, dtrace does not handle userland tracing yet IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND NOT BUGGY_GCC_NO_DTRACE_MODULES - AND NOT BUGGY_LINUX_DTRACE) + AND NOT BUGGY_LINUX_DTRACE + AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 02579c9534e..0694246af18 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -48,6 +48,7 @@ MACRO(GET_MYSQL_VERSION) MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION) MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION) MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION) + MYSQL_GET_CONFIG_VALUE("SERVER_MATURITY" SERVER_MATURITY) IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR @@ -69,6 +70,10 @@ ENDMACRO() # Get mysql version and other interesting variables GET_MYSQL_VERSION() +# Maturity level +string(TOUPPER ${SERVER_MATURITY} SERVER_MATURITY) +SET(SERVER_MATURITY_LEVEL MariaDB_PLUGIN_MATURITY_${SERVER_MATURITY}) + SET(MYSQL_TCP_PORT_DEFAULT 0) IF(NOT MYSQL_TCP_PORT) SET(MYSQL_TCP_PORT 3306) diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index e6d1379aea3..b5dc8b9f157 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -26,7 +26,7 @@ ENDIF() OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) # Set the patch version -SET(WSREP_PATCH_VERSION "20") +SET(WSREP_PATCH_VERSION "21") # Obtain wsrep API version FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION diff --git a/config.h.cmake b/config.h.cmake index 139471ef740..d6c17a7a371 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -191,7 +191,6 @@ #cmakedefine HAVE_PREAD 1 #cmakedefine HAVE_PAUSE_INSTRUCTION 1 #cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1 -#cmakedefine HAVE_HMT_PRIORITY_INSTRUCTION 1 #cmakedefine HAVE_RDTSCLL 1 #cmakedefine HAVE_READ_REAL_TIME 1 #cmakedefine HAVE_PTHREAD_ATTR_CREATE 1 diff --git a/configure.cmake b/configure.cmake index 40cde3fda45..7258077d68b 100644 --- a/configure.cmake +++ b/configure.cmake @@ -792,17 +792,6 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC) } " HAVE_FAKE_PAUSE_INSTRUCTION) ENDIF() - IF (NOT HAVE_PAUSE_INSTRUCTION) - CHECK_C_SOURCE_COMPILES(" - #include - int main() - { - __ppc_set_ppr_low(); - __ppc_set_ppr_med(); - return 0; - } - " HAVE_HMT_PRIORITY_INSTRUCTION) - ENDIF() ENDIF() CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 0b501970efa..5c18098355f 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -252,9 +252,8 @@ datadir_iter_next_database(datadir_iter_t *it) it->dbpath = static_cast( malloc(it->dbpath_len)); } - ut_snprintf(it->dbpath, it->dbpath_len, - "%s/%s", it->datadir_path, - it->dbinfo.name); + snprintf(it->dbpath, it->dbpath_len, "%s/%s", + it->datadir_path, it->dbinfo.name); os_normalize_path(it->dbpath); if (it->dbinfo.type == OS_FILE_TYPE_FILE) { @@ -1034,8 +1033,8 @@ move_file(ds_ctxt_t *datasink, char dst_dir_abs[FN_REFLEN]; size_t dirname_length; - ut_snprintf(dst_file_path_abs, sizeof(dst_file_path_abs), - "%s/%s", dst_dir, dst_file_path); + snprintf(dst_file_path_abs, sizeof(dst_file_path_abs), + "%s/%s", dst_dir, dst_file_path); dirname_part(dst_dir_abs, dst_file_path_abs, &dirname_length); @@ -1252,8 +1251,8 @@ backup_files(const char *from, bool prep_mode) } else if (!prep_mode) { /* backup fake file into empty directory */ char path[FN_REFLEN]; - ut_snprintf(path, sizeof(path), - "%s/db.opt", node.filepath); + snprintf(path, sizeof(path), + "%s/db.opt", node.filepath); if (!(ret = backup_file_printf( trim_dotslash(path), "%s", ""))) { msg("Failed to create file %s\n", path); diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 40701682139..e8881b9604e 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -589,7 +589,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) mysql_real_escape_string(mysql_connection, buf, opt_incremental_history_name, (unsigned long)strlen(opt_incremental_history_name)); - ut_snprintf(query, sizeof(query), + snprintf(query, sizeof(query), "SELECT innodb_to_lsn " "FROM PERCONA_SCHEMA.xtrabackup_history " "WHERE name = '%s' " @@ -602,7 +602,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) mysql_real_escape_string(mysql_connection, buf, opt_incremental_history_uuid, (unsigned long)strlen(opt_incremental_history_uuid)); - ut_snprintf(query, sizeof(query), + snprintf(query, sizeof(query), "SELECT innodb_to_lsn " "FROM PERCONA_SCHEMA.xtrabackup_history " "WHERE uuid = '%s' " @@ -766,7 +766,7 @@ kill_long_queries(MYSQL *connection, time_t timeout) is_select_query(info))) { msg_ts("Killing query %s (duration %d sec): %s\n", id, (int)duration, info); - ut_snprintf(kill_stmt, sizeof(kill_stmt), + snprintf(kill_stmt, sizeof(kill_stmt), "KILL %s", id); xb_mysql_query(connection, kill_stmt, false, false); } @@ -1288,8 +1288,8 @@ write_current_binlog_file(MYSQL *connection) goto cleanup; } - ut_snprintf(filepath, sizeof(filepath), "%s%c%s", - log_bin_dir, FN_LIBCHAR, log_bin_file); + snprintf(filepath, sizeof(filepath), "%s%c%s", + log_bin_dir, FN_LIBCHAR, log_bin_file); result = copy_file(ds_data, filepath, log_bin_file, 0); } @@ -1574,8 +1574,8 @@ char *make_argv(char *buf, size_t len, int argc, char **argv) if (strncmp(*argv, "--password", strlen("--password")) == 0) { arg = "--password=..."; } - left-= ut_snprintf(buf + len - left, left, - "%s%c", arg, argc > 1 ? ' ' : 0); + left-= snprintf(buf + len - left, left, + "%s%c", arg, argc > 1 ? ' ' : 0); ++argv; --argc; } diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc index a430a6cb0af..46bb3a7bcb5 100644 --- a/extra/mariabackup/changed_page_bitmap.cc +++ b/extra/mariabackup/changed_page_bitmap.cc @@ -441,7 +441,7 @@ log_online_open_bitmap_file_read_only( xb_ad(name[0] != '\0'); - ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name); + snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name); bitmap_file->file = os_file_create_simple_no_error_handling( 0, bitmap_file->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, true, &success); diff --git a/extra/mariabackup/common.h b/extra/mariabackup/common.h index 7b1dfd7a0db..4d73742af49 100644 --- a/extra/mariabackup/common.h +++ b/extra/mariabackup/common.h @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include #include +#include # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open) diff --git a/extra/mariabackup/crc/crc_glue.c b/extra/mariabackup/crc/crc_glue.c index c301cb01e2e..11d2c21886b 100644 --- a/extra/mariabackup/crc/crc_glue.c +++ b/extra/mariabackup/crc/crc_glue.c @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include -#if __GNUC__ >= 4 && defined(__x86_64__) +#if defined(__GNUC__) && defined(__x86_64__) static int pclmul_enabled = 0; #endif diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index b88c149673b..7f230256e7a 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -165,6 +165,7 @@ static void encryption_plugin_init(int argc, char **argv) { /* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */ mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0; + plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */ msg("Loading encryption plugin\n"); for (int i= 1; i < argc; i++) msg("\t Encryption plugin parameter : '%s'\n", argv[i]); diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 6e6c61e74cc..627ef7a4b72 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -212,24 +212,7 @@ xb_fil_cur_open( posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL); - /* Determine the page size */ - ulint flags = xb_get_space_flags(cursor->file); - if (flags == ULINT_UNDEFINED) { - xb_fil_cur_close(cursor); - return(XB_FIL_CUR_SKIP); - } - - if (!fsp_flags_is_valid(flags, cursor->space_id)) { - ulint cflags = fsp_flags_convert_from_101(flags); - if (cflags == ULINT_UNDEFINED) { - msg("[%02u] mariabackup: Error: Invalid " - "tablespace flags: %x.\n", thread_n, uint(flags)); - return(XB_FIL_CUR_SKIP); - } - flags = cflags; - } - - const page_size_t page_size(flags); + const page_size_t page_size(cursor->node->space->flags); cursor->page_size = page_size; /* Allocate read buffer */ diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 254ecdb740d..382a31f859f 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "write_filt.h" #include "fil_cur.h" #include "xtrabackup.h" +#include /************************************************************************ Write-through page write filter. */ @@ -68,19 +69,22 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, xb_fil_cur_t *cursor) { char meta_name[FN_REFLEN]; - ulint buf_size; xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt); ctxt->cursor = cursor; /* allocate buffer for incremental backup (4096 pages) */ - buf_size = (cursor->page_size.physical() / 4 + 1) - * cursor->page_size.physical(); - cp->delta_buf_base = static_cast(malloc(buf_size)); - memset(cp->delta_buf_base, 0, buf_size); - cp->delta_buf = static_cast - (ut_align(cp->delta_buf_base, cursor->page_size.physical())); + cp->delta_buf_size = (cursor->page_size.physical() / 4) + * cursor->page_size.physical(); + cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size); + + if (!cp->delta_buf) { + msg("[%02u] mariabackup: Error: " + "cannot allocate %zu bytes\n", + cursor->thread_n, (size_t) cp->delta_buf_size); + return (FALSE); + } /* write delta meta info */ snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name, @@ -184,8 +188,7 @@ static void wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt) { xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt); - - free(cp->delta_buf_base); + os_mem_free_large(cp->delta_buf, cp->delta_buf_size); } /************************************************************************ diff --git a/extra/mariabackup/write_filt.h b/extra/mariabackup/write_filt.h index bcab263f1dd..69655db5b0b 100644 --- a/extra/mariabackup/write_filt.h +++ b/extra/mariabackup/write_filt.h @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA /* Incremental page filter context */ typedef struct { - byte *delta_buf_base; + ulint delta_buf_size; byte *delta_buf; ulint npages; } xb_wf_incremental_ctxt_t; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index af00173a4de..9648bce7f53 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2135,28 +2135,6 @@ check_if_skip_table( return(FALSE); } -/** @return the tablespace flags from a given data file -@retval ULINT_UNDEFINED if the file is not readable */ -ulint xb_get_space_flags(pfs_os_file_t file) -{ - byte *buf; - byte *page; - ulint flags; - - buf = static_cast(malloc(2 * UNIV_PAGE_SIZE)); - page = static_cast(ut_align(buf, UNIV_PAGE_SIZE)); - - if (os_file_read(IORequestRead, file, page, 0, UNIV_PAGE_SIZE)) { - flags = fsp_header_get_flags(page); - } else { - flags = ULINT_UNDEFINED; - } - - free(buf); - - return(flags); -} - const char* xb_get_copy_action(const char *dflt) { @@ -2421,8 +2399,15 @@ xtrabackup_copy_logfile(copy_logfile copy) log_mutex_enter(); - lsn_t lsn = log_group_read_log_seg(log_sys->buf, &log_sys->log, - start_lsn, end_lsn); + lsn_t lsn= start_lsn; + for(int retries= 0; retries < 100; retries++) { + if (log_group_read_log_seg(log_sys->buf, &log_sys->log, + &lsn, end_lsn)){ + break; + } + msg("Retrying read of a redo log block"); + my_sleep(1000); + } start_lsn = xtrabackup_copy_log(copy, start_lsn, lsn); @@ -2683,10 +2668,10 @@ xb_load_single_table_tablespace( name = static_cast(ut_malloc_nokey(pathlen)); if (dirname != NULL) { - ut_snprintf(name, pathlen, "%s/%s", dirname, filname); + snprintf(name, pathlen, "%s/%s", dirname, filname); name[pathlen - 5] = 0; } else { - ut_snprintf(name, pathlen, "%s", filname); + snprintf(name, pathlen, "%s", filname); name[pathlen - 5] = 0; } @@ -2804,8 +2789,8 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback) dbpath = static_cast(ut_malloc_nokey(dbpath_len)); } - ut_snprintf(dbpath, dbpath_len, - "%s/%s", fil_path_to_mysql_datadir, dbinfo.name); + snprintf(dbpath, dbpath_len, + "%s/%s", fil_path_to_mysql_datadir, dbinfo.name); os_normalize_path(dbpath); if (check_if_skip_database_by_path(dbpath)) { @@ -3037,7 +3022,7 @@ xb_validate_name( exit(EXIT_FAILURE); } p = strpbrk(name, "/\\~"); - if (p && p - name < NAME_LEN) { + if (p && (uint) (p - name) < NAME_LEN) { msg("mariabackup: name `%s` is not valid.\n", name); exit(EXIT_FAILURE); } @@ -4311,12 +4296,12 @@ xtrabackup_apply_delta( page_size = info.page_size.physical(); page_size_shift = get_bit_shift(page_size); - msg("mariabackup: page size for %s is %lu bytes\n", + msg("mariabackup: page size for %s is %zu bytes\n", src_path, page_size); if (page_size_shift < 10 || page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) { msg("mariabackup: error: invalid value of page_size " - "(%lu bytes) read from %s\n", page_size, meta_path); + "(%zu bytes) read from %s\n", page_size, meta_path); goto error; } @@ -4418,10 +4403,29 @@ xtrabackup_apply_delta( if (off == 0) { /* Read tablespace size from page 0, and extend the file to specified size.*/ - os_offset_t n_pages = mach_read_from_4(buf + FSP_HEADER_OFFSET + FSP_SIZE); - success = os_file_set_size(dst_path, dst_file, n_pages*page_size); - if (!success) - goto error; + os_offset_t n_pages = mach_read_from_4( + buf + FSP_HEADER_OFFSET + FSP_SIZE); + if (mach_read_from_4(buf + + FIL_PAGE_SPACE_ID)) { + if (!os_file_set_size( + dst_path, dst_file, + n_pages * page_size)) + goto error; + } else if (fil_space_t* space + = fil_space_acquire(0)) { + /* The system tablespace can + consist of multiple files. The + first one has full tablespace + size in page 0, but only the last + file should be extended. */ + fil_node_t* n = UT_LIST_GET_FIRST( + space->chain); + bool fail = !strcmp(n->name, dst_path) + && !fil_space_extend( + space, (ulint)n_pages); + fil_space_release(space); + if (fail) goto error; + } } success = os_file_write(IORequestWrite, diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 045294a2f9e..8eabf8f0e7e 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -149,10 +149,6 @@ void xtrabackup_io_throttling(void); my_bool xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info); -/** @return the tablespace flags from a given data file -@retval ULINT_UNDEFINED if the file is not readable */ -ulint xb_get_space_flags(pfs_os_file_t file); - /************************************************************************ Checks if a table specified as a name in the form "database/name" (InnoDB 5.6) or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 576710e0bde..dbd9941141d 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -192,7 +192,7 @@ static my_long_addr_t read_addr(char** buf) while((c = hex_val(*p++)) != HEX_INVALID) addr = (addr << 4) + c; - *buf = p; + *buf= p-1; return addr; } @@ -203,6 +203,7 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf) if (!se->addr) return -1; + buf++; while (my_isspace(&my_charset_latin1,*buf++)) /* empty */; @@ -281,32 +282,47 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se) } +/* + Resolve anything that starts with [0x or (+0x or start of line and 0x + Skip '_end' as this is an indication of a wrong symbol (stack?) +*/ + static void do_resolve() { char buf[1024], *p; while (fgets(buf, sizeof(buf), fp_dump)) { - /* skip bracket */ - p= (p= strchr(buf, '[')) ? p+1 : buf; - /* skip space */ - while (my_isspace(&my_charset_latin1,*p)) - ++p; - - if (*p++ == '0' && *p++ == 'x') + for (p= buf ; *p ; p++) { - SYM_ENTRY se ; - uchar* addr = (uchar*)read_addr(&p); - if (resolve_addr(addr, &se)) - fprintf(fp_out, "%p %s + %d\n", addr, se.symbol, - (int) (addr - se.addr)); + int found= 0; + if (p[0] == '[' && p[1] == '0' && p[2] == 'x') + found= 3; + if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x') + found= 4; + + /* For stdin */ + if (p == buf && p[0] == '0' && p[1] == 'x') + found= 2; + + if (found) + { + SYM_ENTRY se ; + uchar *addr; + char *tmp= p + found; + addr= (uchar*)read_addr(&tmp); + if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end")) + { + fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol, + (int) (addr - se.addr)); + p= tmp-1; + } + else + { + fputc(*p, stdout); + } + } else - fprintf(fp_out, "%p (?)\n", addr); - - } - else - { - fputs(buf, fp_out); - continue; + fputc(*p, stdout); } } } diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h index b6d7ec6d28c..99e6f628b50 100644 --- a/include/atomic/gcc_builtins.h +++ b/include/atomic/gcc_builtins.h @@ -1,7 +1,7 @@ #ifndef ATOMIC_GCC_BUILTINS_INCLUDED #define ATOMIC_GCC_BUILTINS_INCLUDED -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2017 MariaDB Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#if defined(HAVE_GCC_C11_ATOMICS) -#define MY_ATOMIC_MODE "gcc-atomics-smp" #define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED #define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME @@ -76,21 +74,5 @@ __atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) #define my_atomic_casptr(P, E, D) \ __atomic_compare_exchange_n((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) -#else -#define MY_ATOMIC_MODE "gcc-builtins-smp" -#define make_atomic_load_body(S) \ - ret= __sync_fetch_and_or(a, 0); -#define make_atomic_store_body(S) \ - (void) __sync_lock_test_and_set(a, v); -#define make_atomic_add_body(S) \ - v= __sync_fetch_and_add(a, v); -#define make_atomic_fas_body(S) \ - v= __sync_lock_test_and_set(a, v); -#define make_atomic_cas_body(S) \ - int ## S sav; \ - int ## S cmp_val= *cmp; \ - sav= __sync_val_compare_and_swap(a, cmp_val, set);\ - if (!(ret= (sav == cmp_val))) *cmp= sav -#endif #endif /* ATOMIC_GCC_BUILTINS_INCLUDED */ diff --git a/include/atomic/gcc_sync.h b/include/atomic/gcc_sync.h new file mode 100644 index 00000000000..82eea35b2ce --- /dev/null +++ b/include/atomic/gcc_sync.h @@ -0,0 +1,106 @@ +#ifndef GCC_SYNC_INCLUDED +#define GCC_SYNC_INCLUDED + +/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* Old GCC __sync builtins introduced in GCC 4.1 */ + +static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) +{ + int32 cmp_val= *cmp; + int32 sav= __sync_val_compare_and_swap(a, cmp_val, set); + int ret= (sav == cmp_val); + if (!ret) + *cmp = sav; + return ret; +} + +static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set) +{ + int64 cmp_val= *cmp; + int64 sav= __sync_val_compare_and_swap(a, cmp_val, set); + int ret= (sav == cmp_val); + if (!ret) + *cmp = sav; + return ret; +} + +static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set) +{ + void *cmp_val= *cmp; + void *sav= __sync_val_compare_and_swap(a, cmp_val, set); + int ret= (sav == cmp_val); + if (!ret) + *cmp = sav; + return ret; +} + +static inline int32 my_atomic_add32(int32 volatile *a, int32 v) +{ + return __sync_fetch_and_add(a, v); +} + +static inline int64 my_atomic_add64(int64 volatile *a, int64 v) +{ + return __sync_fetch_and_add(a, v); +} + +static inline int32 my_atomic_fas32(int32 volatile *a, int32 v) +{ + return __sync_lock_test_and_set(a, v); +} + +static inline int64 my_atomic_fas64(int64 volatile *a, int64 v) +{ + return __sync_lock_test_and_set(a, v); +} + +static inline void * my_atomic_fasptr(void * volatile *a, void * v) +{ + return __sync_lock_test_and_set(a, v); +} + +static inline int32 my_atomic_load32(int32 volatile *a) +{ + return __sync_fetch_and_or(a, 0); +} + +static inline int64 my_atomic_load64(int64 volatile *a) +{ + return __sync_fetch_and_or(a, 0); +} + +static inline void* my_atomic_loadptr(void * volatile *a) +{ + return __sync_fetch_and_or(a, 0); +} + +static inline void my_atomic_store32(int32 volatile *a, int32 v) +{ + (void) __sync_lock_test_and_set(a, v); +} + +static inline void my_atomic_store64(int64 volatile *a, int64 v) +{ + (void) __sync_lock_test_and_set(a, v); +} + +static inline void my_atomic_storeptr(void * volatile *a, void *v) +{ + (void) __sync_lock_test_and_set(a, v); +} + +#endif /* GCC_SYNC_INCLUDED */ diff --git a/include/atomic/generic-msvc.h b/include/atomic/generic-msvc.h index d06229ce5ef..56fa4f66fcd 100644 --- a/include/atomic/generic-msvc.h +++ b/include/atomic/generic-msvc.h @@ -1,5 +1,7 @@ -/* Copyright (c) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc. - Use is subject to license terms. +#ifndef ATOMIC_MSC_INCLUDED +#define ATOMIC_MSC_INCLUDED + +/* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,79 +16,132 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _atomic_h_cleanup_ -#define _atomic_h_cleanup_ "atomic/generic-msvc.h" - #include -/* - x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate - function calls to kernel32 instead, even in the optimized build. - We force intrinsics as described in MSDN documentation for - _InterlockedCompareExchange. -*/ -#ifdef _M_IX86 -#if (_MSC_VER >= 1500) -#include +static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) +{ + int32 initial_cmp= *cmp; + int32 initial_a= InterlockedCompareExchange((volatile LONG*)a, + set, initial_cmp); + int ret= (initial_a == initial_cmp); + if (!ret) + *cmp= initial_a; + return ret; +} + +static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set) +{ + int64 initial_cmp= *cmp; + int64 initial_a= InterlockedCompareExchange64((volatile LONGLONG*)a, + (LONGLONG)set, + (LONGLONG)initial_cmp); + int ret= (initial_a == initial_cmp); + if (!ret) + *cmp= initial_a; + return ret; +} + +static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set) +{ + void *initial_cmp= *cmp; + void *initial_a= InterlockedCompareExchangePointer(a, set, initial_cmp); + int ret= (initial_a == initial_cmp); + if (!ret) + *cmp= initial_a; + return ret; +} + +static inline int32 my_atomic_add32(int32 volatile *a, int32 v) +{ + return (int32)InterlockedExchangeAdd((volatile LONG*)a, v); +} + +static inline int64 my_atomic_add64(int64 volatile *a, int64 v) +{ + return (int64)InterlockedExchangeAdd64((volatile LONGLONG*)a, (LONGLONG)v); +} + + +/* + According to MSDN: + + Simple reads and writes to properly-aligned 32-bit variables are atomic + operations. + ... + Simple reads and writes to properly aligned 64-bit variables are atomic on + 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be + atomic on 32-bit Windows. + + https://msdn.microsoft.com/en-us/library/windows/desktop/ms684122(v=vs.85).aspx +*/ + +static inline int32 my_atomic_load32(int32 volatile *a) +{ + int32 value= *a; + MemoryBarrier(); + return value; +} + +static inline int64 my_atomic_load64(int64 volatile *a) +{ +#ifdef _M_X64 + int64 value= *a; + MemoryBarrier(); + return value; #else -C_MODE_START -/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/ -LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp); -LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target, - LONGLONG Value, LONGLONG Comp); -C_MODE_END - -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedCompareExchange64) + return (int64) InterlockedCompareExchange64((volatile LONGLONG *) a, 0, 0); #endif +} -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -/* - No need to do something special for InterlockedCompareExchangePointer - as it is a #define to InterlockedCompareExchange. The same applies to - InterlockedExchangePointer. -*/ -#endif /*_M_IX86*/ +static inline void* my_atomic_loadptr(void * volatile *a) +{ + void *value= *a; + MemoryBarrier(); + return value; +} -#define MY_ATOMIC_MODE "msvc-intrinsics" -/* Implement using CAS on WIN32 */ -#define IL_COMP_EXCHG32(X,Y,Z) \ - InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z)) -#define IL_COMP_EXCHG64(X,Y,Z) \ - InterlockedCompareExchange64((volatile LONGLONG *)(X), \ - (LONGLONG)(Y),(LONGLONG)(Z)) -#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer +static inline int32 my_atomic_fas32(int32 volatile *a, int32 v) +{ + return (int32)InterlockedExchange((volatile LONG*)a, v); +} -#define make_atomic_cas_body(S) \ - int ## S initial_cmp= *cmp; \ - int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \ - if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a; +static inline int64 my_atomic_fas64(int64 volatile *a, int64 v) +{ + return (int64)InterlockedExchange64((volatile LONGLONG*)a, v); +} -#ifndef _M_IX86 -/* Use full set of optimised functions on WIN64 */ -#define IL_EXCHG_ADD32(X,Y) \ - InterlockedExchangeAdd((volatile LONG *)(X),(Y)) -#define IL_EXCHG_ADD64(X,Y) \ - InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y)) -#define IL_EXCHG32(X,Y) \ - InterlockedExchange((volatile LONG *)(X),(Y)) -#define IL_EXCHG64(X,Y) \ - InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y)) -#define IL_EXCHGptr InterlockedExchangePointer +static inline void * my_atomic_fasptr(void * volatile *a, void * v) +{ + return InterlockedExchangePointer(a, v); +} -#define make_atomic_add_body(S) \ - v= IL_EXCHG_ADD ## S (a, v) -#define make_atomic_swap_body(S) \ - v= IL_EXCHG ## S (a, v) -#define make_atomic_load_body(S) \ - ret= 0; /* avoid compiler warning */ \ - ret= IL_COMP_EXCHG ## S (a, ret, ret); +static inline void my_atomic_store32(int32 volatile *a, int32 v) +{ + MemoryBarrier(); + *a= v; +} + +static inline void my_atomic_store64(int64 volatile *a, int64 v) +{ +#ifdef _M_X64 + MemoryBarrier(); + *a= v; +#else + (void) InterlockedExchange64((volatile LONGLONG *) a, v); #endif +} + +static inline void my_atomic_storeptr(void * volatile *a, void *v) +{ + MemoryBarrier(); + *a= v; +} + + /* my_yield_processor (equivalent of x86 PAUSE instruction) should be used to improve performance on hyperthreaded CPUs. Intel recommends to use it in - spin loops also on non-HT machines to reduce power consumption (see e.g + spin loops also on non-HT machines to reduce power consumption (see e.g http://softwarecommunity.intel.com/articles/eng/2004.htm) Running benchmarks for spinlocks implemented with InterlockedCompareExchange @@ -94,35 +149,18 @@ C_MODE_END YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting loop count in the range 200-300 brought best results. */ -#ifndef YIELD_LOOPS #define YIELD_LOOPS 200 -#endif -static __inline int my_yield_processor() +static inline int my_yield_processor() { int i; - for(i=0; i -#define MY_ATOMIC_MODE "solaris-atomic" - #if defined(__GNUC__) #define atomic_typeof(T,V) __typeof__(V) #else #define atomic_typeof(T,V) T #endif -#define uintptr_t void * -#define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y) - -#define make_atomic_cas_body(S) \ - atomic_typeof(uint ## S ## _t, *cmp) sav; \ - sav = atomic_cas_ ## S( \ - (volatile uint ## S ## _t *)a, \ - (uint ## S ## _t)*cmp, \ - (uint ## S ## _t)set); \ - if (! (ret= (sav == *cmp))) \ +static inline int my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) +{ + int ret; + atomic_typeof(uint32_t, *cmp) sav; + sav= atomic_cas_32((volatile uint32_t *)a, (uint32_t)*cmp, (uint32_t)set); + ret= (sav == *cmp); + if (!ret) *cmp= sav; + return ret; +} -#define make_atomic_add_body(S) \ - int ## S nv; /* new value */ \ - nv= atomic_add_ ## S ## _nv((volatile uint ## S ## _t *)a, v); \ - v= nv - v +static inline int my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set) +{ + int ret; + atomic_typeof(uint64_t, *cmp) sav; + sav= atomic_cas_64((volatile uint64_t *)a, (uint64_t)*cmp, (uint64_t)set); + ret= (sav == *cmp); + if (!ret) + *cmp= sav; + return ret; +} -/* ------------------------------------------------------------------------ */ +static inline int my_atomic_casptr(void * volatile *a, void **cmp, void *set) +{ + int ret; + atomic_typeof(void *, *cmp) sav; + sav= atomic_cas_ptr((volatile void **)a, (void *)*cmp, (void *)set); + ret= (sav == *cmp); + if (!ret) + *cmp= sav; + return ret; +} -#define make_atomic_load_body(S) \ - ret= atomic_or_ ## S ## _nv((volatile uint ## S ## _t *)a, 0) +static inline int32 my_atomic_add32(int32 volatile *a, int32 v) +{ + int32 nv= atomic_add_32_nv((volatile uint32_t *)a, v); + return nv - v; +} -#define make_atomic_store_body(S) \ - (void) atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v) +static inline int64 my_atomic_add64(int64 volatile *a, int64 v) +{ + int64 nv= atomic_add_64_nv((volatile uint64_t *)a, v); + return nv - v; +} -#define make_atomic_fas_body(S) \ - v= atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v) +static inline int32 my_atomic_fas32(int32 volatile *a, int32 v) +{ + return atomic_swap_32((volatile uint32_t *)a, (uint32_t)v); +} -#else /* cleanup */ +static inline int64 my_atomic_fas64(int64 volatile *a, int64 v) +{ + return atomic_swap_64((volatile uint64_t *)a, (uint64_t)v); +} -#undef uintptr_t -#undef atomic_or_ptr_nv +static inline void * my_atomic_fasptr(void * volatile *a, void * v) +{ + return atomic_swap_ptr(a, v); +} -#endif +static inline int32 my_atomic_load32(int32 volatile *a) +{ + return atomic_or_32_nv((volatile uint32_t *)a, 0); +} +static inline int64 my_atomic_load64(int64 volatile *a) +{ + return atomic_or_64_nv((volatile uint64_t *)a, 0); +} + +static inline void* my_atomic_loadptr(void * volatile *a) +{ + return atomic_add_ptr_nv(a, 0); +} + +static inline void my_atomic_store32(int32 volatile *a, int32 v) +{ + (void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v); +} + +static inline void my_atomic_store64(int64 volatile *a, int64 v) +{ + (void) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v); +} + +static inline void my_atomic_storeptr(void * volatile *a, void *v) +{ + (void) atomic_swap_ptr((volatile void **)a, (void *)v); +} + +#endif /* ATOMIC_SOLARIS_INCLUDED */ diff --git a/include/my_atomic.h b/include/my_atomic.h index bcb6005a8c2..32c9d6b4736 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -110,119 +110,13 @@ #include "atomic/generic-msvc.h" #elif defined(HAVE_SOLARIS_ATOMIC) #include "atomic/solaris.h" -#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) +#elif defined(HAVE_GCC_C11_ATOMICS) #include "atomic/gcc_builtins.h" +#elif defined(HAVE_GCC_ATOMIC_BUILTINS) +#include "atomic/gcc_sync.h" #endif -#ifndef HAVE_GCC_C11_ATOMICS -#ifndef make_atomic_cas_body -/* nolock.h was not able to generate even a CAS function, fall back */ -#error atomic ops for this platform are not implemented -#endif - -#define intptr void * - -/* define missing functions by using the already generated ones */ -#ifndef make_atomic_add_body -#define make_atomic_add_body(S) \ - int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \ - v=tmp; -#endif -#ifndef make_atomic_fas_body -#define make_atomic_fas_body(S) \ - int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, v)) ; \ - v=tmp; -#endif -#ifndef make_atomic_load_body -#define make_atomic_load_body(S) \ - ret= 0; /* avoid compiler warning */ \ - (void)(my_atomic_cas ## S(a, &ret, ret)); -#endif -#ifndef make_atomic_store_body -#define make_atomic_store_body(S) \ - (void)(my_atomic_fas ## S (a, v)); -#endif - -#define make_atomic_cas(S) \ -static inline int my_atomic_cas ## S(int ## S volatile *a, \ - int ## S *cmp, int ## S set) \ -{ \ - int8 ret; \ - make_atomic_cas_body(S); \ - return ret; \ -} - -#define make_atomic_add(S) \ -static inline int ## S my_atomic_add ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_add_body(S); \ - return v; \ -} - -#define make_atomic_fas(S) \ -static inline int ## S my_atomic_fas ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_fas_body(S); \ - return v; \ -} - -#define make_atomic_load(S) \ -static inline int ## S my_atomic_load ## S(int ## S volatile *a)\ -{ \ - int ## S ret; \ - make_atomic_load_body(S); \ - return ret; \ -} - -#define make_atomic_store(S) \ -static inline void my_atomic_store ## S( \ - int ## S volatile *a, int ## S v) \ -{ \ - make_atomic_store_body(S); \ -} - -make_atomic_cas(32) -make_atomic_cas(64) -make_atomic_cas(ptr) - -make_atomic_add(32) -make_atomic_add(64) - -make_atomic_load(32) -make_atomic_load(64) -make_atomic_load(ptr) - -make_atomic_fas(32) -make_atomic_fas(64) -make_atomic_fas(ptr) - -make_atomic_store(32) -make_atomic_store(64) -make_atomic_store(ptr) - -#ifdef _atomic_h_cleanup_ -#include _atomic_h_cleanup_ -#undef _atomic_h_cleanup_ -#endif - -#undef make_atomic_add -#undef make_atomic_cas -#undef make_atomic_load -#undef make_atomic_store -#undef make_atomic_fas -#undef make_atomic_add_body -#undef make_atomic_cas_body -#undef make_atomic_load_body -#undef make_atomic_store_body -#undef make_atomic_fas_body -#undef intptr -#endif - /* the macro below defines (as an expression) the code that will be run in spin-loops. Intel manuals recummend to have PAUSE there. diff --git a/include/my_base.h b/include/my_base.h index b93300d7562..1e7cacd3426 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -204,6 +204,11 @@ enum ha_extra_function { HA_EXTRA_PREPARE_FOR_FORCED_CLOSE, /* Inform handler that we will do an alter table */ HA_EXTRA_PREPARE_FOR_ALTER_TABLE, + /* + Used in ha_partition::handle_ordered_index_scan() to inform engine + that we are starting an ordered index scan. Needed by Spider + */ + HA_EXTRA_STARTING_ORDERED_INDEX_SCAN }; /* Compatible option, to be deleted in 6.0 */ diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 3e242280be4..14197955f9a 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -45,6 +45,8 @@ extern "C" { /* compatibility functions */ #define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D) #define bitmap_free(A) my_bitmap_free(A) +/* Reset memory. Faster then doing a full bzero */ +#define my_bitmap_clear(A) ((A)->bitmap= 0) extern void create_last_word_mask(MY_BITMAP *map); extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, diff --git a/include/my_cpu.h b/include/my_cpu.h index 026b92c1b74..e255de85960 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -21,17 +21,18 @@ The defines are the same ones used by the linux kernel */ -#if defined(__powerpc__) +#ifdef _ARCH_PWR8 +#include /* Very low priority */ -#define HMT_very_low() asm volatile("or 31,31,31") +#define HMT_very_low() __ppc_set_ppr_very_low() /* Low priority */ -#define HMT_low() asm volatile("or 1,1,1") +#define HMT_low() __ppc_set_ppr_low() /* Medium low priority */ -#define HMT_medium_low() asm volatile("or 6,6,6") +#define HMT_medium_low() __ppc_set_ppr_med_low() /* Medium priority */ -#define HMT_medium() asm volatile("or 2,2,2") +#define HMT_medium() __ppc_set_ppr_med() /* Medium high priority */ -#define HMT_medium_high() asm volatile("or 5,5,5") +#define HMT_medium_high() __ppc_set_ppr_med_high() /* High priority */ #define HMT_high() asm volatile("or 3,3,3") #else diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index ad5a792173a..b122d888c6d 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -649,7 +649,6 @@ void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton); void thd_storage_lock_wait(MYSQL_THD thd, long long value); int thd_tx_isolation(const MYSQL_THD thd); int thd_tx_is_read_only(const MYSQL_THD thd); -int thd_rpl_is_parallel(const MYSQL_THD thd); /** Create a temporary file. diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 02fe3b75227..de4356af740 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); -int thd_rpl_is_parallel(const void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 6aba0ddb889..e515699cad6 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); -int thd_rpl_is_parallel(const void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index 1f7b4e90908..7defe0aec2c 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); -int thd_rpl_is_parallel(const void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index afc4a597b0f..a36f51e74e1 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -472,7 +472,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); -int thd_rpl_is_parallel(const void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 0d2c0719b87..9701ad1b92f 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -518,7 +518,6 @@ void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); -int thd_rpl_is_parallel(const void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql_version.h.in b/include/mysql_version.h.in index f22e00dabb9..59df2b7c086 100644 --- a/include/mysql_version.h.in +++ b/include/mysql_version.h.in @@ -22,6 +22,7 @@ #define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@" #define MYSQL_CONFIG_NAME "my" #define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@" +#define SERVER_MATURITY_LEVEL @SERVER_MATURITY_LEVEL@ #ifdef WITH_WSREP #define WSREP_PATCH_VERSION "@WSREP_PATCH_VERSION@" diff --git a/libmariadb b/libmariadb index 7e53ab36981..63f841f78f5 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 7e53ab369815590ff92913b581d43eb7786f2fe2 +Subproject commit 63f841f78f520d7f3bcff1fe8cecec9d8c47829d diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index d2f605e0f96..f885602eaad 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -65,6 +65,8 @@ flush logs; # To make it predictable, we do a useless update now, but which has the # interest of making the slave catch both rotate events. +let $skip_checkpoint_events=1; + eval create table t3 (a int)ENGINE=$engine_type; # Sync slave and force it to start on another binary log diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 44a7fd12d27..69a2b58288b 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,7 +17,7 @@ # Default values that applies to all MySQL Servers [mysqld] disable-getopt-prefix-matching - +plugin-maturity=unknown open-files-limit= 1024 local-infile character-set-server= latin1 diff --git a/mysql-test/include/filter_file.inc b/mysql-test/include/filter_file.inc index 17c7c1985d7..bfe53896710 100644 --- a/mysql-test/include/filter_file.inc +++ b/mysql-test/include/filter_file.inc @@ -53,6 +53,9 @@ # # $rpl_debug # If set, verbose debug info is printed. +# +# $filter_script +# If set, rows matching this regexp will be filtered out --let $include_filename= filter_file.inc --source include/begin_include_file.inc @@ -67,10 +70,12 @@ if ($rpl_debug) --let _FF_PRE_SCRIPT= $pre_script --let _FF_SCRIPT= $script +--let _FF_FILTER_SCRIPT= $filter_script --let _FF_INPUT_FILE= $input_file --let _FF_OUTPUT_FILE= $output_file --let _FF_SELECT_COLUMNS= $select_columns --let _FF_DEBUG= $rpl_debug + if (!$output_file) { --let _FF_OUTPUT_FILE= $input_file @@ -79,6 +84,7 @@ perl; my $pre_script = $ENV{'_FF_PRE_SCRIPT'}; $pre_script =~ s/DOLLAR/\$/g; my $script = $ENV{'_FF_SCRIPT'}; + my $filter_script = $ENV{'_FF_FILTER_SCRIPT'}; $script =~ s/DOLLAR/\$/g; my $input_file = $ENV{'_FF_INPUT_FILE'}; my $output_file = $ENV{'_FF_OUTPUT_FILE'}; @@ -123,7 +129,10 @@ perl; { ' . $script . ' } - $filtered_contents .= $_."\n"; + if (!$filter_script || ! m/$filter_script/) + { + $filtered_contents .= $_."\n"; + } } close FILE or die "Error closing $input_file: $!"; open FILE, "> $output_file" or die "Error opening $output_file: $!"; diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc index 5df3080a6ed..a035031e49a 100644 --- a/mysql-test/include/have_debug.inc +++ b/mysql-test/include/have_debug.inc @@ -2,8 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless this is a debug build. # -# The test below is redundant - -if (`select version() not like '%debug%'`) { - --skip Needs a debug build -} diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc index 5571c345850..c0da490dde0 100644 --- a/mysql-test/include/have_example_plugin.inc +++ b/mysql-test/include/have_example_plugin.inc @@ -1,14 +1,4 @@ # -# Check if server has support for loading plugins +# suite.pm will make sure that all tests including this file +# will be skipped unless dynamic ha_example plugin is available # -if (`SELECT @@have_dynamic_loading != 'YES'`) { - --skip Example plugin requires dynamic loading -} - -# -# Check if the variable EXAMPLE_PLUGIN is set -# -if (!$HA_EXAMPLE_SO) { - --skip Need example plugin -} - diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 5447d935f3c..69ffdb5b284 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -2,9 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless innodb is enabled # -# The test below is redundant - -if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) -{ - --skip Test requires InnoDB. -} diff --git a/mysql-test/include/have_plugin_auth.opt b/mysql-test/include/have_plugin_auth.opt index 0204e148656..12a9334fa22 100644 --- a/mysql-test/include/have_plugin_auth.opt +++ b/mysql-test/include/have_plugin_auth.opt @@ -1 +1 @@ ---plugin-load-add=$AUTH_TEST_PLUGIN_SO +--plugin-load-add=$AUTH_TEST_PLUGIN_SO --plugin-maturity=unknown diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 71c693961c1..b7b2a316dfb 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -224,6 +224,12 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"), ("Slave I/O: Setting @slave_until_gtid failed with error.*"), ("Slave I/O: Get master GTID position failed with error.*"), + + /* + MDEV-12501 -- set --maturity-level by default + */ + ("Plugin .* is of maturity level .* while the server is .*"), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc index 88185af3b15..4c168f71979 100644 --- a/mysql-test/include/not_embedded.inc +++ b/mysql-test/include/not_embedded.inc @@ -2,9 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless this is an embedded test run # -# The test below is redundant - -if (`select version() like '%embedded%'`) { - This should never happen; -} - diff --git a/mysql-test/include/not_windows.inc b/mysql-test/include/not_windows.inc index 9240271077a..08373095438 100644 --- a/mysql-test/include/not_windows.inc +++ b/mysql-test/include/not_windows.inc @@ -1,4 +1,4 @@ ---require r/not_windows.require -disable_query_log; -select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE"; -enable_query_log; +# +# suite.pm will make sure that all tests including this file +# will be skipped unless this is on Windows +# diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index b2462e0d1b1..57fe1ffe0e3 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -7,7 +7,7 @@ # [--let $binlog_file= [ | LAST]] # [--let $binlog_start= ] # [--let $binlog_limit= 1, 3 ] -# [--let $keep_gtid_events= 1] +# [--let $skip_checkpoint_events= 1] # --source include/show_binlog_events.inc # # Parameters: @@ -26,12 +26,6 @@ # Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.: # $binlog_limit= 3 -- print three events # $binlog_limit= 4, 3 -- skip four events, print the three next events -# -# $keep_gtid_events -# By default, Gtid_log_event and Previous_gtid_log_event are -# filtered out, so that the output is independent of whether GTIDs -# are enabled or not. If this flag is set, events are kept but -# the actual GTID values are masked out. --let $include_filename= show_binlog_events.inc --source include/begin_include_file.inc diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 368cfc9e3a7..9ee01f73999 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -104,8 +104,15 @@ let $script= s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; || --let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; + --delimiter ; +if ($skip_checkpoint_events) +{ + let $filter_script=Binlog_checkpoint; +} + + #--let $select_columns= 1 3 6 --let $input_file= $output_file --source include/filter_file.inc diff --git a/mysql-test/include/show_gtid_list.inc b/mysql-test/include/show_gtid_list.inc new file mode 100644 index 00000000000..96f813f180c --- /dev/null +++ b/mysql-test/include/show_gtid_list.inc @@ -0,0 +1,15 @@ +# ==== Purpose ==== +# +# Extract Gtid_list info from SHOW BINLOG EVENTS output masking +# non-deterministic fields. +# +# ==== Usage ==== +# +# [--let $binlog_file=filename +# +if ($binlog_file) +{ + --let $_in_binlog_file=in '$binlog_file' +} +--replace_column 2 # 5 # +--eval show binlog events $_in_binlog_file limit 1,1 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 760a96587f0..8922a4b8c06 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2794,7 +2794,7 @@ sub mysql_server_start($) { # Some InnoDB options are incompatible with the default bootstrap. # If they are used, re-bootstrap if ( $extra_opts and - "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ ) + "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path/ ) { mysql_install_db($mysqld, undef, $extra_opts); } @@ -4439,7 +4439,7 @@ sub extract_warning_lines ($$) { qr|feedback plugin: failed to retrieve the MAC address|, qr|Plugin 'FEEDBACK' init function returned error|, qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, - qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|, + qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|, qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind qr|Failed to setup SSL|, qr|SSL error: Failed to set ciphers to use|, diff --git a/mysql-test/r/analyze_stmt_privileges2.result b/mysql-test/r/analyze_stmt_privileges2.result index 892791dd8f8..cf38810b598 100644 --- a/mysql-test/r/analyze_stmt_privileges2.result +++ b/mysql-test/r/analyze_stmt_privileges2.result @@ -1452,7 +1452,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra @@ -1797,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra @@ -1813,7 +1813,7 @@ SELECT * FROM t1; a b EXPLAIN SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found ANALYZE SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 3c9cbb18bcb..ca314573581 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -1168,3 +1168,112 @@ CAST('-1' AS UNSIGNED) 18446744073709551615 DROP TABLE t1; SET sql_mode=DEFAULT; +# +# MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES +# +SET sql_mode=STRICT_ALL_TABLES; +SELECT CAST('xxx' AS CHAR(1)); +CAST('xxx' AS CHAR(1)) +x +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +CREATE OR REPLACE TABLE t1 (a VARCHAR(1)); +INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1))); +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(3)); +INSERT INTO t1 VALUES ('xxx'); +UPDATE t1 SET a=CAST(a AS CHAR(1)); +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +# Conversion problems still escalate warnings to errors (without right truncation) +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1' +# Conversion problems still escalate warnings to errors (with right truncation) +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1' +# CAST(number AS CHAR) escalates warnings to errors on truncation +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES (CAST(123 AS CHAR(1))); +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +UPDATE t1 SET a=CAST(123 AS CHAR(1)); +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(10); +SET a=CAST(123 AS CHAR(1)); +END; +$$ +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +# CAST(temporal AS CHAR) escalates warnings to errors on truncation +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1))); +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1)); +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(10); +SET a=CAST(TIME'10:20:30' AS CHAR(1)); +END; +$$ +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +SET sql_mode=DEFAULT; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index ade8a4f7549..e57d2ef1dcf 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -230,7 +230,7 @@ insert into t2 (a) values (1023); do (f2(23)); Warnings: Error 1062 Duplicate entry '23' for key 'a' -Note 4092 At line 4 in test.f2 +Note 4093 At line 4 in test.f2 select * from t2; a 1023 diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result index 79e0bdf5e20..c880df7b39f 100644 --- a/mysql-test/r/create_drop_binlog.result +++ b/mysql-test/r/create_drop_binlog.result @@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info # # Format_desc 1 # VER diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result index 8e529a587fa..3ba6581d61b 100644 --- a/mysql-test/r/create_drop_function.result +++ b/mysql-test/r/create_drop_function.result @@ -3,8 +3,8 @@ CREATE FUNCTION f1(str char(20)) RETURNS CHAR(100) RETURN CONCAT('Hello, ', str, '!'); SELECT * FROM mysql.proc WHERE name like 'f1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE SELECT f1('world'); f1('world') Hello, world! diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result index d23b9b713ad..8dc10297bdb 100644 --- a/mysql-test/r/create_drop_view.result +++ b/mysql-test/r/create_drop_view.result @@ -55,5 +55,5 @@ id DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' DROP TABLE t1; diff --git a/mysql-test/r/cte_grant.result b/mysql-test/r/cte_grant.result index 1282a98fdef..2ee31be3435 100644 --- a/mysql-test/r/cte_grant.result +++ b/mysql-test/r/cte_grant.result @@ -63,3 +63,61 @@ connection root; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +# +# MDEV-13453: privileges checking for CTE +# +create database db; +use db; +create table t1 (i int); +insert into t1 +values (3), (7), (1), (4), (2), (3), (1); +create table t2 (a int, b int); +insert into t2 +values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; +connect con1,localhost,foo,,; +use db; +with cte as (select * from t1 where i < 4) +select * from cte; +i +3 +1 +2 +3 +1 +with cte as (select * from t1 where i < 4 group by i) +select * from cte; +i +1 +2 +3 +with cte as (select * from t1 where i < 4) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select * from t1 where i < 4 group by i) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select b from t2 where a < 4) +select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2' +with cte as (select a from t2 where a < 4) +select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; +a +1 +3 +connection default; +revoke SELECT on db.t1 from foo@localhost; +connection con1; +with cte as (select * from t1 where i < 4) +select * from cte; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +disconnect con1; +connection default; +drop database db; +drop user foo@localhost; diff --git a/mysql-test/r/custom_aggregate_functions.result b/mysql-test/r/custom_aggregate_functions.result new file mode 100644 index 00000000000..ca8612ba652 --- /dev/null +++ b/mysql-test/r/custom_aggregate_functions.result @@ -0,0 +1,938 @@ +create table t2 (sal int(10)); +create aggregate function f1(x INT) returns int +begin +declare continue handler for not found return 0; +loop +fetch group next row; +insert into t2 (sal) values (x); +end loop; +end| +create table t1 (sal int(10),id int(10)); +INSERT INTO t1 (sal,id) VALUES (5000,1); +INSERT INTO t1 (sal,id) VALUES (2000,1); +INSERT INTO t1 (sal,id) VALUES (1000,1); +select f1(sal) from t1 where id>= 1; +f1(sal) +0 +Warnings: +Note 4093 At line 5 in test.f1 +Note 4093 At line 5 in test.f1 +Note 4093 At line 5 in test.f1 +select * from t2; +sal +5000 +2000 +1000 +drop table t2; +drop function f1; +create aggregate function f1(x INT) returns INT +begin +insert into t1(sal) values (x); +return x; +end| +ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function +create function f1(x INT) returns INT +begin +set x=5; +fetch group next row; +return x+1; +end | +ERROR HY000: Non-aggregate function contains aggregate specific instructions: (FETCH GROUP NEXT ROW) +create aggregate function f1(x INT) returns INT +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end | +select f1(1); +f1(1) +1 +show create function f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11) +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end latin1 latin1_swedish_ci latin1_swedish_ci +alter function f1 aggregate none; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'aggregate none' at line 1 +show create function f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11) +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end latin1 latin1_swedish_ci latin1_swedish_ci +select f1(1); +f1(1) +1 +drop function f1; +create aggregate function f2(i int) returns int +begin +FEtCH GROUP NEXT ROW; +if i <= 0 then +return 0; +elseif i = 1 then +return (select count(*) from t1 where id = i); +else +return (select count(*) + f2( i - 1) from t1 where id = i); +end if; +end| +select f2(1)| +f2(1) +3 +select f2(2)| +ERROR HY000: Recursive stored functions and triggers are not allowed +select f2(3)| +ERROR HY000: Recursive stored functions and triggers are not allowed +drop function f2| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini+x; +fetch group next row; +end loop; +end| +select f1(10); +f1(10) +10 +select f1(sal) from t1; +f1(sal) +6000 +select f1(sal) from t1 where 1=0; +f1(sal) +NULL +drop function f1; +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +end| +ERROR 42000: No RETURN found in FUNCTION test.f1 +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +return -1; +end| +select f1(sal) from t1| +ERROR 02000: No data - zero rows fetched, selected, or processed +drop function f1| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found return mini; +FETCH GROUP NEXT ROW; +set mini = mini + x; +end| +select f1(sal) from t1| +ERROR 2F005: FUNCTION f1 ended without RETURN +drop function f1| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found set mini=-1; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +return 0; +end| +select f1(sal) from t1| +ERROR 2F005: FUNCTION f1 ended without RETURN +drop function f1| +drop table t1| +create table t1 (sal int, id int, val int, counter int, primary key(id)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +drop table t1; +create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +drop table t1; +create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 3000 +3 6000 +4 8000 +drop table t1; +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +create aggregate function f2() returns double +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z = z+1; +end loop; +end| +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +prepare test from "select f2() from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +set @param= 1; +execute test using @param; +f2() +5 +set @param= 3; +execute test using @param; +f2() +2 +set @param= 4; +execute test using @param; +f2() +1 +deallocate prepare test; +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +set @param= 1; +execute test using @param; +f1(sal) +17000 +set @param= 3; +execute test using @param; +f1(sal) +8000 +set @param= 4; +execute test using @param; +f1(sal) +3000 +set @param= 5; +execute test using @param; +f1(sal) +NULL +deallocate prepare test; +drop function f2; +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f1(sal) +15000 +drop function f1; +create function f1(x int) returns int +return -1; +execute test using @param; +f1(sal) +-1 +-1 +-1 +-1 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +execute test using @param; +f1(sal) +15000 +deallocate prepare test; +drop table t1; +drop function f1; +create table t1 (sal int, id int, val varchar(10), counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4); +create table t2 (sal int, id int, val int, counter int); +INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +create aggregate function f1(x double) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +create aggregate function f2(x INT) returns CHAR(10) +begin +declare mini INT default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini + x; +end loop; +end| +create aggregate function f3(x INT) returns CHAR(10) +begin +declare mini INT default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini + x; +fetch group next row; +set mini= mini - x; +end loop; +end| +create aggregate function f4(x INT, y varchar(10)) returns varchar(1000) +begin +declare str varchar(1000) default ''; +declare continue handler for not found return str; +loop +fetch group next row; +set str= concat(str,y); +end loop; +end| +create aggregate function f5(x INT) returns varchar(1000) +begin +declare z int default 0; +DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2; +declare continue handler for not found return 0; +loop +fetch group next row; +set z = z+x; +end loop; +end| +create function f6(x int) returns int +return (select f1(sal) from t1)| +select f1(sal) from t1; +f1(sal) +5000 +select f1(sal) from t1 where id>= 1 group by counter; +f1(sal) +1000 +1000 +1000 +1000 +1000 +select f3(sal) from t1; +f3(sal) +1000 +select f2(val) from t1; +ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1 +select val, id, c from (select f1(sal) as c from t2) as t1, t2; +val id c +10 2 17000 +11 4 17000 +15 3 17000 +16 1 17000 +18 2 17000 +select f1(sal),f1(val), f1(id), f1(sal) from t2; +f1(sal) f1(val) f1(id) f1(sal) +17000 70 12 17000 +select f4(sal, val) from t1; +f4(sal, val) +abcdefghij +select c from (select f1(sal) as c from t2) as t1; +c +17000 +select f1((select val from t2 where 0 > 1)) from t1; +f1((select val from t2 where 0 > 1)) +NULL +select f1((select val from t2 where id= 1)) from t1; +f1((select val from t2 where id= 1)) +80 +select f5(sal) from t1; +f5(sal) +0 +SELECT f1(sal)*f1(sal) FROM t1; +f1(sal)*f1(sal) +25000000 +SELECT (SELECT f1(sal) FROM t1) FROM t2; +(SELECT f1(sal) FROM t1) +5000 +5000 +5000 +5000 +5000 +select id, f1(sal) from t1; +id f1(sal) +2 5000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +2 5000 +select f1(sal), f1(sal) from t1 where id>= 1 group by counter; +f1(sal) f1(sal) +1000 1000 +1000 1000 +1000 1000 +1000 1000 +1000 1000 +select f1(sal), f1(sal) from t1 where id>= 1 group by id ; +f1(sal) f1(sal) +1000 1000 +1000 1000 +1000 1000 +2000 2000 +select f1(sal) from t1 where id>= 1 group by id ; +f1(sal) +1000 +1000 +1000 +2000 +select f1(sal) from t1 where id>= 1 order by counter; +f1(sal) +5000 +select f1(sal) from t1 where id>= 1 group by id order by counter; +f1(sal) +2000 +1000 +1000 +1000 +select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter; +counter id f1(sal) +2 2 2000 +3 3 1000 +4 4 1000 +5 1 1000 +select id, f1(sal) from t1 where id>= 1 group by id order by counter; +id f1(sal) +2 2000 +3 1000 +4 1000 +1 1000 +drop table t1; +drop table t2; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +create aggregate function f1(x INT) returns INT +begin +declare z double default 1000; +declare continue handler for not found return z; +loop +fetch group next row; +set z= (z&x); +end loop; +end| +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0); +INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2); +select f1(sal) from t1 where id>= 1; +f1(sal) +768 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare count double default 0; +declare continue handler for not found return z/count; +loop +fetch group next row; +set z= z+x; +set count= count+1; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +4923.076923076923 +drop function f1; +create aggregate function f1(x INT) returns INT +begin +declare maxi INT default -1; +declare continue handler for not found return maxi; +loop +fetch group next row; +if maxi < x then +set maxi= x; +end if; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +9000 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare mini INT default 100000; +declare continue handler for not found return mini; +loop +fetch group next row; +if mini > x then +set mini = x; +end if; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +1000 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z^x; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +16288 +drop function f1; +create aggregate function f1(x INT) returns INT +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +64000 +create aggregate function f2() returns INT +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+1; +end loop; +end| +select f2() from t1; +f2() +13 +create table t2 (sal int, id int); +INSERT INTO t2 (sal, id) VALUES (NULL, 1); +INSERT INTO t2 (sal, id) VALUES (2000, 1); +INSERT INTO t2 (sal, id) VALUES (3000, 1); +select f1(sal) from t2; +f1(sal) +NULL +select f1(1); +f1(1) +1 +create function f3() returns int +return (select f1(sal) from t1); +select f3(); +f3() +64000 +create function f4() returns INT +return 1; +create aggregate function f5() returns INT +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+f3(); +end loop; +end| +select f5() from t2; +f5() +192000 +Warnings: +Note 4093 At line 6 in test.f5 +Note 4093 At line 6 in test.f5 +Note 4093 At line 6 in test.f5 +create aggregate function f6(x INT) returns INT +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +if x then +set z= z+(select f1(sal) from t1); +end if; +end loop; +end| +select f6(sal) from t2; +f6(sal) +128000 +Warnings: +Note 4093 At line 6 in test.f6 +Note 4093 At line 6 in test.f6 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 7000 +2 7000 +3 6000 +4 12000 +5 10000 +6 10000 +7 12000 +select counter, f1(sal) from t1 where id>= 1 group by counter; +counter f1(sal) +0 7000 +1 10000 +2 2000 +3 13000 +4 12000 +5 7000 +7 2000 +8 5000 +9 6000 +select val, f1(sal) from t1 where id>= 1 group by val; +val f1(sal) +10 3000 +11 13000 +12 7000 +13 5000 +14 4000 +15 5000 +16 7000 +18 6000 +19 14000 +select counter, f1(sal) from t1 where id>= 1 group by id order by counter; +counter f1(sal) +0 12000 +2 6000 +2 7000 +4 12000 +5 7000 +7 10000 +9 10000 +select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter; +counter id f1(sal) f1(sal) +0 7 12000 12000 +2 2 7000 7000 +2 3 6000 6000 +4 4 12000 12000 +5 1 7000 7000 +7 5 10000 10000 +9 6 10000 10000 +select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc; +counter id f1(sal) sum(distinct sal) +0 7 12000 12000 +2 2 7000 7000 +2 3 6000 6000 +4 4 12000 12000 +5 1 7000 7000 +7 5 10000 10000 +9 6 10000 10000 +create table t3 (i int); +INSERT INTO t3 (i) select f1(sal) from t1; +select * from t3; +i +64000 +create aggregate function f7(x INT) returns INT +begin +declare z int default 0; +DECLARE done BOOLEAN DEFAULT FALSE; +DECLARE a,b,c INT; +DECLARE cur1 CURSOR FOR SELECT id FROM test.t2; +declare continue handler for not found return z; +outer_loop: LOOP +FETCH GROUP NEXT ROW; +set z= z+x; +inner_block: begin +DECLARE cur2 CURSOR FOR SELECT id FROM test.t2; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN cur2; +read_loop: LOOP +FETCH cur2 INTO a; +IF done THEN +CLOSE cur2; +LEAVE read_loop; +END IF; +END LOOP read_loop; +end inner_block; +END LOOP outer_loop; +end| +select f7(sal) from t1; +f7(sal) +64000 +Warnings: +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +drop table t1; +drop table t2; +drop table t3; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 220fd5a8c74..32184c5637b 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -896,34 +896,34 @@ WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_N A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT ORDER BY TOTAL DESC; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 2b49ec901ba..730a02f6bfa 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2014,7 +2014,7 @@ SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: @@ -2029,7 +2029,7 @@ SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 3fd5370f470..37005fb017e 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1' Note 1051 Unknown table 'test.table2' DROP VIEW IF EXISTS view1,view2,view3,view4; Warnings: -Note 4090 Unknown VIEW: 'test.view1' -Note 4090 Unknown VIEW: 'test.view2' -Note 4090 Unknown VIEW: 'test.view3' -Note 4090 Unknown VIEW: 'test.view4' +Note 4091 Unknown VIEW: 'test.view1' +Note 4091 Unknown VIEW: 'test.view2' +Note 4091 Unknown VIEW: 'test.view3' +Note 4091 Unknown VIEW: 'test.view4' # Test error message when trigger does not find table CREATE TABLE table1(a int); diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 97e49af96d4..f593e0dfaba 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -2,7 +2,7 @@ drop table if exists t1; create table t1 (id int not null, str char(10), unique(str)); explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; id str @@ -218,8 +218,8 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET SESSION sql_mode=@old_sql_mode; @@ -387,7 +387,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN EXTENDED SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 0.00 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t` diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index d7cdeac499e..fd342606b3f 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -1204,7 +1204,7 @@ create table t1 (i int) engine=myisam; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found explain format=json select * from t1; EXPLAIN diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 097e07ac715..723a1952d79 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1254,3 +1254,129 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +drop table if exists t1, t2; +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); +select grp,group_concat(c) from t1 group by grp; +grp group_concat(c) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c limit 1 ) from t1 group by grp; +grp group_concat(c limit 1 ) +1 b +2 c +3 E +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +grp group_concat(c limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +grp group_concat(c limit 1,10 ) +1 c +2 b +3 C,D,E +select grp,group_concat(c limit 1000) from t1 group by grp; +grp group_concat(c limit 1000) +1 b,c +2 c,b +3 E,C,D,E +select group_concat(grp limit 0) from t1; +group_concat(grp limit 0) + +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) f' at line 1 +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +grp group_concat(distinct c limit 1,10 ) +1 c +2 b +3 C,D +select grp,group_concat(c order by a) from t1 group by grp; +grp group_concat(c order by a) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +grp group_concat(c order by a limit 2 ) +1 b,c +2 c,b +3 E,C +select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp; +grp group_concat(c order by a limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c order by c) from t1 group by grp; +grp group_concat(c order by c) +1 b,c +2 b,c +3 C,D,E,E +select grp,group_concat(c order by c limit 2) from t1 group by grp; +grp group_concat(c order by c limit 2) +1 b,c +2 b,c +3 C,D +select grp,group_concat(c order by c desc) from t1 group by grp; +grp group_concat(c order by c desc) +1 c,b +2 c,b +3 E,E,D,C +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; +grp group_concat(c order by c desc limit 2) +1 c,b +2 c,b +3 E,E +drop table t1; +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; +group_concat(a,b limit 2) +1a,1b +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x +set @x=2; +execute STMT using @x; +group_concat(b limit ?) +a,b +set @x=1000; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x,y +set @x=0; +execute STMT using @x; +group_concat(b limit ?) + +set @x="adasfa"; +execute STMT using @x; +ERROR HY000: Limit only accepts integer values +set @x=-1; +execute STMT using @x; +ERROR HY000: Incorrect arguments to EXECUTE +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +group_concat(a,b limit ?) +1a,1b,2x,2y +drop table t2; +# +# End of 10.3 tests +# diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 3340328cad6..9f3928615ec 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2066,7 +2066,7 @@ HAVING ('m') IN ( SELECT v FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table set optimizer_switch=@tmp_optimizer_switch; diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result index e340c04107d..27493ae710b 100644 --- a/mysql-test/r/func_group_innodb.result +++ b/mysql-test/r/func_group_innodb.result @@ -125,14 +125,14 @@ select 1, max(1) from t1i where 1=99; 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index fe45338b36f..1bf8231f4dd 100644 --- a/mysql-test/r/func_hybrid_type.result +++ b/mysql-test/r/func_hybrid_type.result @@ -3443,8 +3443,8 @@ EXECUTE stmt USING @a,@a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(21) DEFAULT NULL, - `b` varchar(21) DEFAULT NULL + `a` varchar(20) DEFAULT NULL, + `b` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 15e4fbec605..25d47574b59 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -28,6 +28,9 @@ NULL select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); json_value('{"key1": [1,2,3], "key1":123}', '$.key1') 123 +select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z'); +JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') +Mon"t"y select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2') NULL @@ -725,6 +728,9 @@ json_contains_path('{"foo":"bar"}', 'one', '$[]') NULL Warnings: Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3 +select JSON_VALID(0x36f0c8dccd83c5eac156da); +JSON_VALID(0x36f0c8dccd83c5eac156da) +0 # # Start of 10.3 tests # diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index b1862d46613..7389eeed5d7 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1340,12 +1340,12 @@ DROP TABLE t1; create table t1(f1 varchar(4)); explain extended select encode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1` explain extended select decode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1` drop table t1; diff --git a/mysql-test/r/get_diagnostics.result b/mysql-test/r/get_diagnostics.result index a75b775297c..63ed6867096 100644 --- a/mysql-test/r/get_diagnostics.result +++ b/mysql-test/r/get_diagnostics.result @@ -590,7 +590,7 @@ DROP PROCEDURE p1; SHOW WARNINGS; Level Code Message Error 54321 MESSAGE_TEXT text -Note 4092 At line 16 in test.p1 +Note 4093 At line 16 in test.p1 CREATE PROCEDURE p1() BEGIN DECLARE var INT; diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result index d888b08351d..1d6e2193fc9 100644 --- a/mysql-test/r/gis-json.result +++ b/mysql-test/r/gis-json.result @@ -89,6 +89,21 @@ ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1) SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5) {"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]} +SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. # # End of 10.2 tests # diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index fe67da8001f..3f2e6d39db8 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -4390,7 +4390,7 @@ SELECT ST_BUFFER(Point(1,1), Point(1,1)); ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g'; EXECUTE stmt USING 1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_envelope' +ERROR HY000: Illegal parameter data type int for operation 'st_envelope' EXECUTE stmt USING POINT(1,1); SHOW CREATE TABLE t1; Table Create Table @@ -4404,7 +4404,7 @@ DROP TABLE t1; DEALLOCATE PREPARE stmt; PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g'; EXECUTE stmt USING 1,1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_buffer' +ERROR HY000: Illegal parameter data type int for operation 'st_buffer' EXECUTE stmt USING POINT(1,1),POINT(1,1); ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' EXECUTE stmt USING POINT(1,1),0; @@ -4455,7 +4455,7 @@ SELECT POINT(1,POINT(1,1)); ERROR HY000: Illegal parameter data type geometry for operation 'point' PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g'; EXECUTE stmt USING 1,1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_geometryfromtext' +ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext' EXECUTE stmt USING POINT(1,1),POINT(1,1); ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' EXECUTE stmt USING 'POINT(1 1)',1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index c5a3d83557a..5d43c8287ad 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1432,7 +1432,7 @@ Warnings: Note 1305 FUNCTION test.test_function does not exist drop view if exists v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' create table test (col1 varchar(30)); create function test_function() returns varchar(30) begin diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index c2c2785c209..4f6318fd507 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -671,6 +671,7 @@ proc character_set_client char(32) proc collation_connection char(32) proc db_collation char(32) proc body_utf8 longblob +proc aggregate enum('NONE','GROUP') drop table t115; create procedure p108 () begin declare c cursor for select data_type from information_schema.columns; open c; open c; end;// @@ -1277,7 +1278,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE'); select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; routine_name diff --git a/mysql-test/r/intersect.result b/mysql-test/r/intersect.result index 7a0301a23e6..05adaf160ed 100644 --- a/mysql-test/r/intersect.result +++ b/mysql-test/r/intersect.result @@ -689,4 +689,17 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci drop view v1; drop tables t1,t2,t3; +# +# MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery +# +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); +SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 ); +i +select i from t where +exists ((select 6 as r from dual having t.i <> 6) +intersect +(select 3 from dual having t.i <> 3)); +i +drop table t; # End of 10.3 tests diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index 917a31e2a79..708c72fffb5 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -1321,7 +1321,7 @@ c11 c21 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result index 1ffd94547cc..eb59531b7d2 100644 --- a/mysql-test/r/join_nested_jcl6.result +++ b/mysql-test/r/join_nested_jcl6.result @@ -1332,7 +1332,7 @@ c11 c21 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result index c94599235b1..7d1ca948c8b 100644 --- a/mysql-test/r/limit_rows_examined.result +++ b/mysql-test/r/limit_rows_examined.result @@ -98,11 +98,11 @@ create table t0 (c0 int); explain select * from t0 LIMIT ROWS EXAMINED 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found explain select * from t0 LIMIT ROWS EXAMINED 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found select * from t0 LIMIT ROWS EXAMINED 1; c0 drop table t0; @@ -592,7 +592,7 @@ create table t3_empty like t3; explain select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3_empty system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3_empty system NULL NULL NULL NULL 0 Const row not found select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; max(c1) NULL diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result index 12c5e627f7a..09e662f5d6a 100644 --- a/mysql-test/r/myisam_explain_non_select_all.result +++ b/mysql-test/r/myisam_explain_non_select_all.result @@ -2184,13 +2184,13 @@ INSERT INTO t1 VALUES (1, 1, 10), (2, 2, 20); # EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value @@ -2199,7 +2199,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` @@ -2219,13 +2219,13 @@ Handler_read_rnd_next 4 # EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value @@ -2234,7 +2234,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10 @@ -2571,12 +2571,12 @@ CREATE VIEW v1 (x) AS SELECT b FROM t2; # EXPLAIN INSERT INTO v1 SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_rnd_next 1 @@ -2584,7 +2584,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2781,7 +2781,7 @@ CREATE TABLE t2 (id INT); INSERT INTO t1 VALUES (1), (2); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found; Using temporary; Using filesort +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 DROP TABLE t1,t2; #74 @@ -2879,7 +2879,7 @@ CALL p16(); DROP PROCEDURE p16; CALL p15(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found DROP PROCEDURE p15; CALL p14(); DROP PROCEDURE p14; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 5ee31bbe227..bac33753d4c 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -1258,3 +1258,4 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +mysqlbinlog Ver VER for OS at ARCH diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index e31571e93a8..b56c1a26fb0 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -242,7 +242,7 @@ The following options may be given as the first argument: This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit - DEFAULT clauses. The old behavior is deprecated. + DEFAULT clauses. --external-locking Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. @@ -1118,8 +1118,19 @@ The following options may be given as the first argument: (Defaults to on; use --skip-slave-sql-verify-checksum to disable.) --slave-transaction-retries=# Number of times the slave SQL thread will retry a - transaction in case it failed with a deadlock or elapsed - lock wait timeout, before giving up and stopping + transaction in case it failed with a deadlock, elapsed + lock wait timeout or listed in + slave_transaction_retry_errors, before giving up and + stopping + --slave-transaction-retry-errors=name + Tells the slave thread to retry transaction for + replication when a query event returns an error from the + provided list. Deadlock and elapsed lock wait timeout + errors are automatically added to this list + --slave-transaction-retry-interval=# + Interval of the slave SQL thread will retry a transaction + in case it failed with a deadlock or elapsed lock wait + timeout or listed in slave_transaction_retry_errors --slave-type-conversions=name Set of slave type conversions that are enabled. If the variable is empty, no conversions are allowed and it is @@ -1543,7 +1554,6 @@ performance-schema-session-connect-attrs-size -1 performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size -1 -plugin-maturity unknown port 3306 port-open-timeout 0 preload-buffer-size 32768 @@ -1604,9 +1614,11 @@ slave-parallel-mode conservative slave-parallel-threads 0 slave-parallel-workers 0 slave-run-triggers-for-rbr NO -slave-skip-errors (No default value) +slave-skip-errors OFF slave-sql-verify-checksum TRUE slave-transaction-retries 10 +slave-transaction-retry-errors 1213,1205 +slave-transaction-retry-interval 0 slave-type-conversions slow-launch-time 2 slow-query-log FALSE diff --git a/mysql-test/r/not_windows.require b/mysql-test/r/not_windows.require deleted file mode 100644 index 09aae1ed1d0..00000000000 --- a/mysql-test/r/not_windows.require +++ /dev/null @@ -1,2 +0,0 @@ -TRUE -1 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index f43e6ce18af..946ecb51426 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -2635,7 +2635,7 @@ SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 LEFT JOIN t3 ON t2.i2 = t3.i3 ORDER BY t1.i1 LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index Warnings: @@ -3159,3 +3159,51 @@ pk 2 3 DROP TABLE t1; +# +# MDEV-13994: Bad join results with orderby_uses_equalities=on +# +CREATE TABLE books ( +id int(16) NOT NULL AUTO_INCREMENT, +library_id int(16) NOT NULL DEFAULT 0, +wings_id int(12) NOT NULL DEFAULT 0, +scheduled_for_removal int(1) DEFAULT 0, +PRIMARY KEY (id), +KEY library_idx (library_id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1); +CREATE TABLE wings ( +id int(11) NOT NULL AUTO_INCREMENT, +department_id int(11) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT INTO wings VALUES (505,11745),(707,11768); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='orderby_uses_equalities=off'; +SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +wing_id department_id +707 11768 +SET optimizer_switch='orderby_uses_equalities=on'; +SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +wing_id department_id +707 11768 +explain extended SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00 +2 MATERIALIZED books ref library_idx library_idx 4 const 1 100.00 Using where +Warnings: +Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id` +set optimizer_switch= @save_optimizer_switch; +DROP TABLE books, wings; diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result index 4f59a2f8c20..3ff1f92e94a 100644 --- a/mysql-test/r/order_by_innodb.result +++ b/mysql-test/r/order_by_innodb.result @@ -48,3 +48,76 @@ where key1<3 or key2<3; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where drop table t0, t1; +# +# MDEV-14071: wrong results with orderby_uses_equalities=on +# (duplicate of MDEV-13994) +# +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), +(381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); +INSERT INTO t1 VALUES +(77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0), +(106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0), +(268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0); +INSERT INTO t2 VALUES +(127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5), +(375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8), +(498,9),(656,8),(656,9); +INSERT INTO t3 VALUES +(4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine'); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='orderby_uses_equalities=off'; +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SET optimizer_switch='orderby_uses_equalities=on'; +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +set optimizer_switch= @save_optimizer_switch; +DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result index cafa9d9db4d..4c439c37e4d 100644 Binary files a/mysql-test/r/outfile.result and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index f398ef07d56..7a614a146a1 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -513,6 +513,9 @@ COUNT(*) SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SUM(c) 400 +SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +SUM(c+0.0) +400.0 ALTER TABLE t1 DROP INDEX b; SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); COUNT(*) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 09d8728601f..961621af0f7 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -29,7 +29,7 @@ Table Op Msg_type Msg_text test.t1 analyze status OK EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index +1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index DROP TABLE t1; # # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY @@ -663,7 +663,7 @@ EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,col1,col2 col1,col2 8,8 NULL # Using intersect(col1,col2); Using where; Using index; Using filesort +1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 0fb24b74218..422132dd1c3 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -18,7 +18,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # # # # # # # # # 3 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -# # # # # # # # # 10 # +# # # # # # # # # 9 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra # # # # # # # # # 3 # @@ -105,7 +105,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 @@ -168,7 +168,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a <= 7; a -1 @@ -182,7 +182,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 @@ -424,7 +424,7 @@ a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 @@ -474,7 +474,7 @@ a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a <= 6; a -1 @@ -487,7 +487,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 @@ -744,13 +744,13 @@ a 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 3 Using where; Using index @@ -759,26 +759,26 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index @@ -790,16 +790,16 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 index a a 4 NULL 5 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index # test without index ALTER TABLE t1 DROP KEY a; SELECT * FROM t1 WHERE a < '1001-01-01'; @@ -1076,7 +1076,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index @@ -1104,10 +1104,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index @@ -1119,10 +1119,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index @@ -1405,7 +1405,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index @@ -1433,10 +1433,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index @@ -1448,10 +1448,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index @@ -2867,18 +2867,18 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where explain partitions select * from t2 where b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96 +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b = 6; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref b b 5 const 96 100.00 +1 SIMPLE t2 ref b b 5 const 76 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6 explain partitions select * from t2 where b = 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96 +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b in (1,3,5); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5) explain partitions select * from t2 where b in (1,3,5); @@ -2886,7 +2886,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (2,4,6); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 25.05 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6) explain partitions select * from t2 where b in (2,4,6); @@ -2894,7 +2894,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (7,8,9); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 36.70 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9) explain partitions select * from t2 where b in (7,8,9); @@ -2902,7 +2902,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 44.84 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 explain partitions select * from t2 where b > 5; @@ -2910,7 +2910,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 8; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 22.09 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8 explain partitions select * from t2 where b > 5 and b < 8; @@ -2918,15 +2918,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 7; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where +1 SIMPLE t2 range b b 5 NULL 76 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7 explain partitions select * from t2 where b > 5 and b < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where +1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 76 Using where explain extended select * from t2 where b > 0 and b < 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 41.65 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5 explain partitions select * from t2 where b > 0 and b < 5; @@ -2960,10 +2960,10 @@ flush status; delete from t2 where b = 7; show status like 'Handler_read_rnd_next'; Variable_name Value -Handler_read_rnd_next 915 +Handler_read_rnd_next 0 show status like 'Handler_read_key'; Variable_name Value -Handler_read_key 0 +Handler_read_key 5 flush status; delete from t2 where b > 5; show status like 'Handler_read_rnd_next'; @@ -3136,7 +3136,7 @@ drop table t2; create table t1 (s1 int); explain partitions select 1 from t1 union all select 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found 2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used drop table t1; create table t1 (a bigint unsigned not null) partition by range(a) ( diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index dd9e074db0c..7ae029d488c 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -961,7 +961,7 @@ INSERT INTO t2 SELECT * FROM t1; # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by @@ -972,7 +972,7 @@ a MAX(b) # Should be no more than 4 reads. SHOW status LIKE 'handler_read_key'; Variable_name Value -Handler_read_key 4 +Handler_read_key 2 FLUSH status; SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; a MAX(b) diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index 9644a8afe8d..bc8dd162481 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -415,7 +415,7 @@ select @@profiling; drop table if exists t1, t2, t3; drop view if exists v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' drop function if exists f1; set session profiling = OFF; set global profiling_history_size= @start_value; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 68139b62f95..2c44ce9aa93 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3394,7 +3394,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` bigint(20) DEFAULT NULL + `c1` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = b'10100100101'; @a @a = b'10100100101' @@ -3484,7 +3484,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` bigint(20) DEFAULT NULL + `c1` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 2010; @a @a = 2010 @@ -3556,7 +3556,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('a', 16); @a @a = REPEAT('a', 16) @@ -3574,7 +3574,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('b', 16); @a @a = REPEAT('b', 16) @@ -3592,7 +3592,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('c', 16); @a @a = REPEAT('c', 16) @@ -3610,7 +3610,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('d', 16); @a @a = REPEAT('d', 16) @@ -3628,7 +3628,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('e', 16); @a @a = REPEAT('e', 16) @@ -3646,7 +3646,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('f', 16); @a @a = REPEAT('f', 16) @@ -3772,7 +3772,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 'aaa'; @a @a = 'aaa' @@ -3790,7 +3790,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 'aaa'; @a @a = 'aaa' @@ -4413,7 +4413,7 @@ EXECUTE stmt USING 10; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` bigint(21) NOT NULL + `c1` int(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXECUTE stmt USING 10.123; @@ -4620,10 +4620,10 @@ EXECUTE IMMEDIATE SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(21) NOT NULL, + `a` bigint(20) NOT NULL, `b` decimal(3,1) DEFAULT NULL, `c` double NOT NULL, - `d` varchar(3) NOT NULL + `d` tinytext NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXECUTE IMMEDIATE @@ -4632,7 +4632,7 @@ EXECUTE IMMEDIATE SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(21) NOT NULL, + `a` int(2) NOT NULL, `b` decimal(3,1) DEFAULT NULL, `c` double NOT NULL, `d` varchar(3) NOT NULL @@ -4998,3 +4998,159 @@ ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NE EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger DROP PROCEDURE p1; +# +# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +# +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +CHARSET(CONCAT(5,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; +COERCIBILITY(?) +5 +# +# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +# +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +# +# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +# +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +# +# MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +# +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 101010 +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(1) NOT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(2) NOT NULL, + `b` int(2) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(9) NOT NULL, + `b` int(9) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(10) NOT NULL, + `b` bigint(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index eb9b1d16011..bb8703b4185 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -235,7 +235,7 @@ select benchmark(1,1) from t1; benchmark(1,1) explain extended select benchmark(1,1) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1` show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 80aef096828..61886b2be98 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2284,7 +2284,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; # # Start of 10.1 tests diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index b0672eed54e..f6c523f9900 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2286,7 +2286,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; # # Start of 10.1 tests diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c7156ddae91..4b7aecd675d 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2330,7 +2330,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where @@ -4660,17 +4660,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result index 8462e19fda8..2c37c2d28d8 100644 --- a/mysql-test/r/select_found.result +++ b/mysql-test/r/select_found.result @@ -83,7 +83,7 @@ UNIQUE KEY e_n (email,name) ); EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found; Using temporary +1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary 1 SIMPLE t2 ALL NULL NULL NULL NULL 200 SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; email diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 92be057c62c..e548da79774 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -2341,7 +2341,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join) @@ -4671,17 +4671,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -5493,7 +5493,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index c7156ddae91..4b7aecd675d 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -2330,7 +2330,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where @@ -4660,17 +4660,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 7400dff3958..cdb210ae2d9 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -784,7 +784,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +Note 1003 select 7 AS `a` from `test`.`t1` where 0 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1508,7 +1508,7 @@ select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 960a873c854..47d2e6fd554 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -791,7 +791,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +Note 1003 select 7 AS `a` from `test`.`t1` where 0 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1518,7 +1518,7 @@ select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result index 671df4b7f17..09493f0da30 100644 --- a/mysql-test/r/signal.result +++ b/mysql-test/r/signal.result @@ -1715,7 +1715,7 @@ show warnings $$ Level Code Message Warning 1012 Raising a warning Error 5555 RESIGNAL to not found -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1740,7 +1740,7 @@ show warnings $$ Level Code Message Warning 1012 Raising a warning Error 5555 RESIGNAL to error -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1789,7 +1789,7 @@ show warnings $$ Level Code Message Error 1012 Raising a not found Error 5555 RESIGNAL to not found -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1814,7 +1814,7 @@ show warnings $$ Level Code Message Error 1012 Raising a not found Error 5555 RESIGNAL to error -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1863,7 +1863,7 @@ show warnings $$ Level Code Message Error 1012 Raising an error Error 5555 RESIGNAL to not found -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1888,7 +1888,7 @@ show warnings $$ Level Code Message Error 1012 Raising an error Error 5555 RESIGNAL to error -Note 4092 At line 9 in test.test_resignal +Note 4093 At line 9 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1931,7 +1931,7 @@ show warnings $$ Level Code Message Warning 1264 Out of range value for column 'a' at row 1 Error 5555 RESIGNAL to a not found -Note 4092 At line 8 in test.test_resignal +Note 4093 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -1953,7 +1953,7 @@ show warnings $$ Level Code Message Warning 1264 Out of range value for column 'a' at row 1 Error 5555 RESIGNAL to an error -Note 4092 At line 8 in test.test_resignal +Note 4093 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2004,7 +2004,7 @@ show warnings $$ Level Code Message Error 1329 No data - zero rows fetched, selected, or processed Error 5555 RESIGNAL to a not found -Note 4092 At line 10 in test.test_resignal +Note 4093 At line 10 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2030,7 +2030,7 @@ show warnings $$ Level Code Message Error 1329 No data - zero rows fetched, selected, or processed Error 5555 RESIGNAL to an error -Note 4092 At line 10 in test.test_resignal +Note 4093 At line 10 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2073,7 +2073,7 @@ show warnings $$ Level Code Message Error 1051 Unknown table 'test.no_such_table' Error 5555 RESIGNAL to a not found -Note 4092 At line 8 in test.test_resignal +Note 4093 At line 8 in test.test_resignal drop procedure test_resignal $$ create procedure test_resignal() begin @@ -2095,7 +2095,7 @@ show warnings $$ Level Code Message Error 1051 Unknown table 'test.no_such_table' Error 5555 RESIGNAL to an error -Note 4092 At line 8 in test.test_resignal +Note 4093 At line 8 in test.test_resignal drop procedure test_resignal $$ # # More complex cases @@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message show warnings $$ Level Code Message Error 9999 Hi, I am a useless error message -Note 4092 At line 7 in test.peter_p2 +Note 4093 At line 7 in test.peter_p2 drop procedure peter_p1 $$ drop procedure peter_p2 $$ CREATE PROCEDURE peter_p1 () @@ -2198,16 +2198,16 @@ Level Code Message Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL' Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL' -Note 4092 At line 8 in test.peter_p1 +Note 4093 At line 8 in test.peter_p1 ERROR 42000: Hi, I am a useless error message show warnings $$ Level Code Message Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL' Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL' -Note 4092 At line 8 in test.peter_p1 +Note 4093 At line 8 in test.peter_p1 Error 9999 Hi, I am a useless error message -Note 4092 At line 10 in test.peter_p2 +Note 4093 At line 10 in test.peter_p2 drop procedure peter_p1 $$ drop procedure peter_p2 $$ drop procedure if exists peter_p3 $$ @@ -2225,7 +2225,7 @@ show warnings $$ Level Code Message Error 1 Original Error 2 Original -Note 4092 At line 4 in test.peter_p3 +Note 4093 At line 4 in test.peter_p3 drop procedure peter_p3 $$ drop table t_warn; drop table t_cursor; diff --git a/mysql-test/r/signal_demo3.result b/mysql-test/r/signal_demo3.result index a98d587937c..1d597aaf71c 100644 --- a/mysql-test/r/signal_demo3.result +++ b/mysql-test/r/signal_demo3.result @@ -79,23 +79,23 @@ show warnings; Level Code Message Error 1051 Unknown table 'demo.oops_it_is_not_here' Error 1644 Oops in proc_9 -Note 4092 At line 4 in demo.proc_9 +Note 4093 At line 4 in demo.proc_9 Error 1644 Oops in proc_8 -Note 4092 At line 4 in demo.proc_8 +Note 4093 At line 4 in demo.proc_8 Error 1644 Oops in proc_7 -Note 4092 At line 4 in demo.proc_7 +Note 4093 At line 4 in demo.proc_7 Error 1644 Oops in proc_6 -Note 4092 At line 4 in demo.proc_6 +Note 4093 At line 4 in demo.proc_6 Error 1644 Oops in proc_5 -Note 4092 At line 4 in demo.proc_5 +Note 4093 At line 4 in demo.proc_5 Error 1644 Oops in proc_4 -Note 4092 At line 4 in demo.proc_4 +Note 4093 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4092 At line 4 in demo.proc_3 +Note 4093 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4092 At line 4 in demo.proc_2 +Note 4093 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4092 At line 4 in demo.proc_1 +Note 4093 At line 4 in demo.proc_1 SET @@session.max_error_count = 5; SELECT @@session.max_error_count; @@session.max_error_count @@ -104,11 +104,11 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4092 At line 4 in demo.proc_3 +Note 4093 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4092 At line 4 in demo.proc_2 +Note 4093 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4092 At line 4 in demo.proc_1 +Note 4093 At line 4 in demo.proc_1 SET @@session.max_error_count = 7; SELECT @@session.max_error_count; @@session.max_error_count @@ -117,13 +117,13 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4092 At line 4 in demo.proc_4 +Note 4093 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4092 At line 4 in demo.proc_3 +Note 4093 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4092 At line 4 in demo.proc_2 +Note 4093 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4092 At line 4 in demo.proc_1 +Note 4093 At line 4 in demo.proc_1 SET @@session.max_error_count = 9; SELECT @@session.max_error_count; @@session.max_error_count @@ -132,15 +132,15 @@ call proc_1(); ERROR 45000: Oops in proc_1 show warnings; Level Code Message -Note 4092 At line 4 in demo.proc_5 +Note 4093 At line 4 in demo.proc_5 Error 1644 Oops in proc_4 -Note 4092 At line 4 in demo.proc_4 +Note 4093 At line 4 in demo.proc_4 Error 1644 Oops in proc_3 -Note 4092 At line 4 in demo.proc_3 +Note 4093 At line 4 in demo.proc_3 Error 1644 Oops in proc_2 -Note 4092 At line 4 in demo.proc_2 +Note 4093 At line 4 in demo.proc_2 Error 1644 Oops in proc_1 -Note 4092 At line 4 in demo.proc_1 +Note 4093 At line 4 in demo.proc_1 drop database demo; SET @@global.max_error_count = @start_global_value; SELECT @@global.max_error_count; diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index ddb2901b8a4..3a4dc9db6f8 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -998,3 +998,306 @@ Pos Instruction 7 set b.a@1["a"] a.a@0["a"] DROP PROCEDURE p1; DROP TABLE t1; +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +# Integer range FOR loop +CREATE PROCEDURE p1() +BEGIN +FOR i IN 1..3 +DO +SELECT i; +END FOR; +END; +$$ +CALL p1; +i +1 +i +2 +i +3 +SHOW PROCEDURE CODE p1; +Pos Instruction +0 set i@0 1 +1 set [upper_bound]@1 3 +2 jump_if_not 6(6) i@0 <= [upper_bound]@1 +3 stmt 0 "SELECT i" +4 set i@0 i@0 + 1 +5 jump 2 +DROP PROCEDURE p1; +# Nested integer range FOR loops +CREATE PROCEDURE p1() +BEGIN +fori: +FOR i IN 1..3 +DO +forj: +FOR j IN 1..3 +DO +IF i = 3 THEN +LEAVE fori; +END IF; +IF j = 3 THEN +LEAVE forj; +END IF; +SELECT i,j; +END FOR; +END FOR; +END; +$$ +CALL p1; +i j +1 1 +i j +1 2 +i j +2 1 +i j +2 2 +SHOW PROCEDURE CODE p1; +Pos Instruction +0 set i@0 1 +1 set [upper_bound]@1 3 +2 jump_if_not 17(17) i@0 <= [upper_bound]@1 +3 set j@2 1 +4 set [upper_bound]@3 3 +5 jump_if_not 13(13) j@2 <= [upper_bound]@3 +6 jump_if_not 8(8) i@0 = 3 +7 jump 17 +8 jump_if_not 10(10) j@2 = 3 +9 jump 13 +10 stmt 0 "SELECT i,j" +11 set j@2 j@2 + 1 +12 jump 5 +13 set i@0 i@0 + 1 +14 jump 2 +DROP PROCEDURE p1; +# Explicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +FOR rec1 IN cur1 +DO +SELECT rec1.a, rec1.b; +SET rec1.a= 11; +SET rec1.b= 'b1'; +SELECT rec1.a, rec1.b; +END FOR; +FOR rec0 IN cur0 +DO +SET rec0.a= 10; +SET rec0.b='b0'; +END FOR; +FOR rec2 IN cur2 +DO +SET rec2.a= 10; +SET rec2.b='b0'; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush cur0@0 +1 cpush cur1@1 +2 cpush cur2@2 +3 cursor_copy_struct cur1 rec1@0 +4 copen cur1@1 +5 cfetch cur1@1 rec1@0 +6 jump_if_not 13(13) `cur1`%FOUND +7 stmt 0 "SELECT rec1.a, rec1.b" +8 set rec1.a@0["a"] 11 +9 set rec1.b@0["b"] 'b1' +10 stmt 0 "SELECT rec1.a, rec1.b" +11 cfetch cur1@1 rec1@0 +12 jump 6 +13 cursor_copy_struct cur0 rec0@1 +14 copen cur0@0 +15 cfetch cur0@0 rec0@1 +16 jump_if_not 21(21) `cur0`%FOUND +17 set rec0.a@1["a"] 10 +18 set rec0.b@1["b"] 'b0' +19 cfetch cur0@0 rec0@1 +20 jump 16 +21 cursor_copy_struct cur2 rec2@2 +22 copen cur2@2 +23 cfetch cur2@2 rec2@2 +24 jump_if_not 29(29) `cur2`%FOUND +25 set rec2.a@2["a"] 10 +26 set rec2.b@2["b"] 'b0' +27 cfetch cur2@2 rec2@2 +28 jump 24 +29 cpop 3 +DROP PROCEDURE p1; +# Nested explicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +FOR rec0 IN cur0 +DO +BEGIN +DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b; +SET rec0.a= 11; +SET rec0.b= 'b0'; +FOR rec1 IN cur1 +DO +SET rec1.a= 11; +SET rec1.b= 'b1'; +BEGIN +DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b; +FOR rec2 IN cur2 +DO +SET rec2.a=12; +SET rec2.b='b2'; +END FOR; +END; +END FOR; +END; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush cur0@0 +1 cursor_copy_struct cur0 rec0@0 +2 copen cur0@0 +3 cfetch cur0@0 rec0@0 +4 jump_if_not 29(29) `cur0`%FOUND +5 cpush cur1@1 +6 set rec0.a@0["a"] 11 +7 set rec0.b@0["b"] 'b0' +8 cursor_copy_struct cur1 rec1@1 +9 copen cur1@1 +10 cfetch cur1@1 rec1@1 +11 jump_if_not 26(26) `cur1`%FOUND +12 set rec1.a@1["a"] 11 +13 set rec1.b@1["b"] 'b1' +14 cpush cur2@2 +15 cursor_copy_struct cur2 rec2@2 +16 copen cur2@2 +17 cfetch cur2@2 rec2@2 +18 jump_if_not 23(23) `cur2`%FOUND +19 set rec2.a@2["a"] 12 +20 set rec2.b@2["b"] 'b2' +21 cfetch cur2@2 rec2@2 +22 jump 18 +23 cpop 1 +24 cfetch cur1@1 rec1@1 +25 jump 11 +26 cpop 1 +27 cfetch cur0@0 rec0@0 +28 jump 4 +29 cpop 1 +DROP PROCEDURE p1; +# Implicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) +DO +SELECT rec1.a, rec1.b; +SET rec1.a= 11; +SET rec1.b= 'b1'; +SELECT rec1.a, rec1.b; +END FOR; +FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) +DO +SET rec0.a= 10; +SET rec0.b='b0'; +END FOR; +FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) +DO +SET rec2.a= 10; +SET rec2.b='b0'; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush [implicit_cursor]@0 +1 cursor_copy_struct [implicit_cursor] rec1@0 +2 copen [implicit_cursor]@0 +3 cfetch [implicit_cursor]@0 rec1@0 +4 jump_if_not 11(11) `[implicit_cursor]`%FOUND +5 stmt 0 "SELECT rec1.a, rec1.b" +6 set rec1.a@0["a"] 11 +7 set rec1.b@0["b"] 'b1' +8 stmt 0 "SELECT rec1.a, rec1.b" +9 cfetch [implicit_cursor]@0 rec1@0 +10 jump 4 +11 cpop 1 +12 cpush [implicit_cursor]@0 +13 cursor_copy_struct [implicit_cursor] rec0@1 +14 copen [implicit_cursor]@0 +15 cfetch [implicit_cursor]@0 rec0@1 +16 jump_if_not 21(21) `[implicit_cursor]`%FOUND +17 set rec0.a@1["a"] 10 +18 set rec0.b@1["b"] 'b0' +19 cfetch [implicit_cursor]@0 rec0@1 +20 jump 16 +21 cpop 1 +22 cpush [implicit_cursor]@0 +23 cursor_copy_struct [implicit_cursor] rec2@2 +24 copen [implicit_cursor]@0 +25 cfetch [implicit_cursor]@0 rec2@2 +26 jump_if_not 31(31) `[implicit_cursor]`%FOUND +27 set rec2.a@2["a"] 10 +28 set rec2.b@2["b"] 'b0' +29 cfetch [implicit_cursor]@0 rec2@2 +30 jump 26 +31 cpop 1 +DROP PROCEDURE p1; +# Nested implicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) +DO +SET rec0.a= 11; +SET rec0.b= 'b0'; +FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) +DO +SET rec1.a= 11; +SET rec1.b= 'b1'; +FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) +DO +SET rec2.a=12; +SET rec2.b='b2'; +END FOR; +END FOR; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush [implicit_cursor]@0 +1 cursor_copy_struct [implicit_cursor] rec0@0 +2 copen [implicit_cursor]@0 +3 cfetch [implicit_cursor]@0 rec0@0 +4 jump_if_not 29(29) `[implicit_cursor]`%FOUND +5 set rec0.a@0["a"] 11 +6 set rec0.b@0["b"] 'b0' +7 cpush [implicit_cursor]@1 +8 cursor_copy_struct [implicit_cursor] rec1@1 +9 copen [implicit_cursor]@1 +10 cfetch [implicit_cursor]@1 rec1@1 +11 jump_if_not 26(26) `[implicit_cursor]`%FOUND +12 set rec1.a@1["a"] 11 +13 set rec1.b@1["b"] 'b1' +14 cpush [implicit_cursor]@2 +15 cursor_copy_struct [implicit_cursor] rec2@2 +16 copen [implicit_cursor]@2 +17 cfetch [implicit_cursor]@2 rec2@2 +18 jump_if_not 23(23) `[implicit_cursor]`%FOUND +19 set rec2.a@2["a"] 12 +20 set rec2.b@2["b"] 'b2' +21 cfetch [implicit_cursor]@2 rec2@2 +22 jump 18 +23 cpop 1 +24 cfetch [implicit_cursor]@1 rec1@1 +25 jump 11 +26 cpop 1 +27 cfetch [implicit_cursor]@0 rec0@0 +28 jump 4 +29 cpop 1 +DROP PROCEDURE p1; diff --git a/mysql-test/r/sp-cursor.result b/mysql-test/r/sp-cursor.result index d068c19b22b..1f8cb7f0635 100644 --- a/mysql-test/r/sp-cursor.result +++ b/mysql-test/r/sp-cursor.result @@ -480,3 +480,134 @@ DROP PROCEDURE p1; # # End of MDEV-12457 Cursors with parameters # +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +# Explicit cursor +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT * FROM t1; +FOR rec IN cur +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +a b +3 b3 +DROP TABLE t1; +# Explicit cursor with parameters +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa; +FOR rec IN cur(2) +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +2 b2 +a b +3 b3 +DROP TABLE t1; +# Explicit cursor + label +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT * FROM t1; +forrec: +FOR rec IN cur +DO +SELECT rec.a AS a, rec.b AS b; +IF rec.a = 2 THEN +LEAVE forrec; +END IF; +END FOR forrec; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; +# Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND" +BEGIN NOT ATOMIC +DECLARE x INT; +DECLARE cur CURSOR FOR SELECT 1 AS x; +FOR rec IN cur +DO +FETCH cur INTO x; +END FOR; +END; +$$ +ERROR 02000: No data - zero rows fetched, selected, or processed +# Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND" +BEGIN NOT ATOMIC +DECLARE done INT DEFAULT 0; +DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION +SELECT 2,'y2' UNION +SELECT 3,'y3'; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +forrec: +FOR rec IN cur +DO +SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH'; +FETCH cur INTO rec; +IF done THEN +SELECT 'NO DATA' AS `Explicit FETCH`; +LEAVE forrec; +ELSE +SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH'; +END IF; +END FOR; +END; +$$ +Implicit FETCH +1 y1 +Explicit FETCH +2 y2 +Implicit FETCH +3 y3 +Explicit FETCH +NO DATA +# Implicit cursor +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +FOR rec IN (SELECT * FROM t1) +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; +# Implicit cursor + label +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +forrec: +FOR rec IN (SELECT * FROM t1) +DO +SELECT rec.a AS a, rec.b AS b; +IF rec.a = 2 THEN +LEAVE forrec; +END IF; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 5bb3b17d4b8..112fdb3978d 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); +call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted"); call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); flush table mysql.proc; use test; @@ -14,13 +14,13 @@ create table t1 (id int); create trigger t1_ai after insert on t1 for each row call bug14233(); alter table mysql.proc drop security_type; call bug14233(); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted create view v1 as select bug14233_f(); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted insert into t1 values (0); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted show procedure status; -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted flush table mysql.proc; call bug14233(); ERROR HY000: Incorrect information in file: './mysql/proc.frm' @@ -146,7 +146,7 @@ alter table mysql.proc drop column security_type; # The below statement should not cause assertion failure. drop database mysqltest; Warnings: -Error 1805 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +Error 1805 Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted # Restore mysql.proc. drop table mysql.proc; # diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index f0bc1874850..ad4b18fc37a 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1212,7 +1212,7 @@ ERROR 42S02: Unknown table 'c' in field list drop procedure bug15091; drop function if exists bug16896; create aggregate function bug16896() returns int return 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() returns int return 1' at line 1 +ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function DROP PROCEDURE IF EXISTS bug14702; CREATE IF NOT EXISTS PROCEDURE bug14702() BEGIN @@ -1990,8 +1990,8 @@ Warning 1264 Out of range value for column 'a' at row 1 Note 1292 Truncated incorrect INTEGER value: '222222 ' Warning 1264 Out of range value for column 'b' at row 1 Error 1048 Column 'c' cannot be null -Note 4092 At line 6 in test.t1_bi -Note 4092 At line 2 in test.p1 +Note 4093 At line 6 in test.t1_bi +Note 4093 At line 2 in test.p1 DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/r/sp-for-loop.result b/mysql-test/r/sp-for-loop.result new file mode 100644 index 00000000000..0da09586df5 --- /dev/null +++ b/mysql-test/r/sp-for-loop.result @@ -0,0 +1,208 @@ +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +CREATE TABLE t1 (a INT); +FOR i IN 1..3 +DO +INSERT INTO t1 VALUES (i); +END FOR; +/ +SELECT * FROM t1; +a +1 +2 +3 +DROP TABLE t1; +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +FOR i IN lower_bound . . upper_bound +DO +NULL +END FOR; +RETURN total; +END; +/ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '. upper_bound +DO +NULL +END FOR; +RETURN total; +END' at line 4 +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +lab: +FOR i IN lower_bound .. upper_bound +DO +SET total= total + i; +IF i = lim THEN +LEAVE lab; +END IF; +-- Bounds are calculated only once. +-- The below assignments have no effect on the loop condition +SET lower_bound= 900; +SET upper_bound= 1000; +END FOR; +RETURN total; +END; +/ +SELECT f1(1, 3, 100) FROM DUAL; +f1(1, 3, 100) +6 +SELECT f1(1, 3, 2) FROM DUAL; +f1(1, 3, 2) +3 +DROP FUNCTION f1; +CREATE FUNCTION f1() RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +FOR i IN 1 .. 5 +DO +SET total= total + 1000; +forj: +FOR j IN 1 .. 5 +DO +SET total= total + 1; +IF j = 3 THEN +LEAVE forj; -- End the internal loop +END IF; +END FOR; +END FOR; +RETURN total; +END; +/ +SELECT f1() FROM DUAL; +f1() +5015 +DROP FUNCTION f1; +CREATE FUNCTION f1 (a INT, b INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +fori: +FOR i IN REVERSE a..1 +DO +SET total= total + i; +IF i = b THEN +LEAVE fori; +END IF; +END FOR; +RETURN total; +END +/ +SELECT f1(3, 100) FROM DUAL; +f1(3, 100) +6 +SELECT f1(3, 2) FROM DUAL; +f1(3, 2) +5 +DROP FUNCTION f1; +# Testing labeled FOR LOOP statement +CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +la: +FOR ia IN 1 .. a +DO +SET total= total + 1000; +lb: +FOR ib IN 1 .. b +DO +SET total= total + 1; +IF ib = limitb THEN +LEAVE lb; +END IF; +IF ia = limita THEN +LEAVE la; +END IF; +END FOR lb; +END FOR la; +RETURN total; +END; +/ +SELECT f1(1, 1, 1, 1) FROM DUAL; +f1(1, 1, 1, 1) +1001 +SELECT f1(1, 2, 1, 2) FROM DUAL; +f1(1, 2, 1, 2) +1001 +SELECT f1(2, 1, 2, 1) FROM DUAL; +f1(2, 1, 2, 1) +2002 +SELECT f1(2, 1, 2, 2) FROM DUAL; +f1(2, 1, 2, 2) +1001 +SELECT f1(2, 2, 2, 2) FROM DUAL; +f1(2, 2, 2, 2) +2003 +SELECT f1(2, 3, 2, 3) FROM DUAL; +f1(2, 3, 2, 3) +2004 +DROP FUNCTION f1; +# Testing labeled ITERATE in a labeled FOR LOOP statement +CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +la: +FOR ia IN 1 .. a +DO +SET total= total + 1000; +BEGIN +DECLARE ib INT DEFAULT 1; +WHILE ib <= b +DO +IF ib > blim THEN +ITERATE la; +END IF; +SET ib= ib + 1; +SET total= total + 1; +END WHILE; +END; +END FOR la; +RETURN total; +END; +/ +SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL; +f1(3,3,0) f1(3,3,1) f1(3,3,2) f1(3,3,3) f1(3,3,4) +3000 3003 3006 3009 3009 +DROP FUNCTION f1; +# Testing INTERATE statement +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +fori: +FOR i IN 1 .. a +DO +IF i=5 THEN +ITERATE fori; +END IF; +SET total= total + 1; +END FOR; +RETURN total; +END; +/ +SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL; +f1(3) f1(4) f1(5) f1(6) +3 4 4 5 +DROP FUNCTION f1; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +lj: +FOR j IN 1 .. 2 +DO +FOR i IN 1 .. a +DO +IF i=5 THEN +ITERATE lj; +END IF; +SET total= total + 1; +END FOR; +END FOR; +RETURN total; +END; +/ +SELECT f1(3), f1(4), f1(5) FROM DUAL; +f1(3) f1(4) f1(5) +6 8 8 +DROP FUNCTION f1; diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result index 535e67046d8..800d83f1f74 100644 --- a/mysql-test/r/sp-group.result +++ b/mysql-test/r/sp-group.result @@ -3,7 +3,7 @@ Warnings: Note 1051 Unknown table 'test.t1' drop view if exists view_t1; Warnings: -Note 4090 Unknown VIEW: 'test.view_t1' +Note 4091 Unknown VIEW: 'test.view_t1' SET sql_mode=ONLY_FULL_GROUP_BY; CREATE TABLE t1 ( pk INT, diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b66faec260f..3b8f35e0c79 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -3211,7 +3211,7 @@ drop procedure bug10961| DROP PROCEDURE IF EXISTS bug6866| DROP VIEW IF EXISTS tv| Warnings: -Note 4090 Unknown VIEW: 'test.tv' +Note 4091 Unknown VIEW: 'test.tv' DROP TABLE IF EXISTS tt1,tt2,tt3| Warnings: Note 1051 Unknown table 'test.tt1' @@ -5324,7 +5324,7 @@ DROP PROCEDURE bug21414| set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')| call това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго()| ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) drop database това_е_дълго_име_за_база_данни_нали| @@ -7823,7 +7823,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show warnings; Level Code Message Error 1062 Duplicate entry '2' for key 'PRIMARY' -Note 4092 At line 5 in test.p1 +Note 4093 At line 5 in test.p1 select * from t1; id 1 @@ -8116,6 +8116,18 @@ CALL p(); drop procedure p; drop view v; drop table t, tmp_t; +# +# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 ); +REPLACE INTO v1 VALUES (f1()); +ERROR HY000: The target table v1 of the INSERT is not insertable-into +SET @aux = f1(); +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; #End of 10.1 tests # # MDEV-11081: CURSOR for query with GROUP BY diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 7ba8b545e6a..8e46fa91c2c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1161,20 +1161,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1644,7 +1644,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1652,7 +1652,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1663,7 +1663,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1671,7 +1671,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3734,7 +3734,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 6126a7ed3f5..d3f46429cf7 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -21,7 +21,7 @@ ORDER BY count(*); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL a 5 NULL 2 Using index 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found +3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found # should not crash the next statement SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) @@ -1261,7 +1261,7 @@ SET optimizer_switch='materialization=off'; EXPLAIN SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); @@ -1269,7 +1269,7 @@ c1 c1 EXPLAIN SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); @@ -1278,7 +1278,7 @@ SET optimizer_switch='materialization=on'; EXPLAIN SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where @@ -2191,7 +2191,7 @@ INSERT INTO t2 VALUES (1); EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2199,7 +2199,7 @@ NULL 1 EXPLAIN SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2207,7 +2207,7 @@ NULL 1 EXPLAIN SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2215,7 +2215,7 @@ NULL 1 EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; MAX(a) bb @@ -2223,7 +2223,7 @@ NULL NULL EXPLAIN SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2231,7 +2231,7 @@ NULL NULL EXPLAIN SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 350275d2463..6b5db62093e 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -2544,7 +2544,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found +2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); i 10 @@ -2553,7 +2553,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found +2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); i 10 diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index b4feb8de200..125da8da517 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -162,7 +162,7 @@ EXPLAIN SELECT * FROM (SELECT * FROM t2) AS a2 WHERE (SELECT distinct SUM(distinct f3 ) FROM t1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table insert into t2 values (1),(2); diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index c09f3c94710..51fe0aa80df 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -1165,20 +1165,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1648,7 +1648,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1656,7 +1656,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1667,7 +1667,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1675,7 +1675,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3737,7 +3737,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 0aefeaf44d9..6381e1939db 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -1168,20 +1168,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1651,7 +1651,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1659,7 +1659,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1670,7 +1670,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1678,7 +1678,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3737,7 +3737,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6115,7 +6115,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6129,7 +6129,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6715,7 +6715,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 92defb3c36d..1a56c333887 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -1164,20 +1164,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1647,7 +1647,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1655,7 +1655,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1666,7 +1666,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1674,7 +1674,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3733,7 +3733,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b47dab2e79e..26aee4269b6 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -1167,20 +1167,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1650,7 +1650,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1658,7 +1658,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1669,7 +1669,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1677,7 +1677,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3740,7 +3740,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6126,7 +6126,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6140,7 +6140,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6726,7 +6726,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 9d04ddd9829..e962add85c8 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -1164,20 +1164,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1647,7 +1647,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1655,7 +1655,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1666,7 +1666,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1674,7 +1674,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3733,7 +3733,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index a1880162487..54fb47f2a93 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -224,6 +224,7 @@ proc CREATE TABLE `proc` ( `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, + `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' show create table event; diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 9141c6cb479..df81b8d81c9 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -224,6 +224,7 @@ proc CREATE TABLE `proc` ( `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, + `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' show create table event; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index b751632307a..8473b3bb90d 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2329,6 +2329,23 @@ DROP TRIGGER t1_bi; DROP TABLE t1; SET TIMESTAMP=DEFAULT; set time_zone= @@global.time_zone; +# +# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE TABLE t2 (a int); +CREATE TABLE t3 (a int); +create trigger trg after insert on t2 for each row +INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1; +drop table t1; +insert into t2 value (2); +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE TABLE t1 (i INT); +insert into t2 value (2); +DROP VIEW v1; +DROP TABLE t1,t2,t3; +End of 10.1 tests. create table t1 (i int); create trigger tr1 after insert on t1 for each row set @a=@a+1; create trigger tr2 after insert on t1 for each row set @a=@a+1; diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 1258de317ec..ae72619b5ae 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -352,3 +352,9 @@ EXPLAIN SELECT * FROM t1 WHERE a='1.1'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; +# +# MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters +# +SET NAMES utf8; +CREATE TABLE t1 (a SET('a,bü')); +ERROR 22007: Illegal set 'a,bü' value found during parsing diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index b193f032146..9ec3b1056fd 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1634,8 +1634,8 @@ UNION SELECT a FROM t1 ORDER BY a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNION t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNION t1 system NULL NULL NULL NULL 0 0.00 Const row not found NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t1` union /* select#2 */ select NULL AS `a` from `test`.`t1` order by `a` diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 635323a5867..120a13254a0 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2934,10 +2934,10 @@ CREATE TABLE t1 (s1 int); CREATE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found EXPLAIN SELECT * FROM v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found INSERT INTO t1 VALUES (1), (3), (2); EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1); id select_type table type possible_keys key key_len ref rows Extra @@ -4609,7 +4609,7 @@ WHERE t4.a >= t1.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 @@ -4625,7 +4625,7 @@ WHERE t4.a >= v1.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 @@ -4657,7 +4657,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) @@ -4674,7 +4674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) @@ -5166,7 +5166,7 @@ CREATE TABLE t4 (i4 INT); INSERT INTO t4 VALUES (1),(2); DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 ); CREATE VIEW v2 AS select v1_field1 from t4 join v1; prepare my_stmt from "select v1_field1 from v2"; diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 04ad19c5ddc..82594128d85 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -144,7 +144,7 @@ revoke select on mysqltest.v5 from mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci @@ -167,13 +167,13 @@ grant show view on mysqltest.* to mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; View Create View character_set_client collation_connection @@ -1190,7 +1190,7 @@ select * from v1; i explain select * from v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as eugene connect test11765687,localhost,eugene,,mysqltest1; @@ -1238,12 +1238,12 @@ select k from t3; k explain select k from t3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found select * from v3; k explain select * from v3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as inga connect test11765687,localhost,inga,,mysqltest1; @@ -1284,8 +1284,8 @@ select * from v2; i j explain select * from v2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as noam connect test11765687,localhost,noam,,mysqltest1; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 5d805ac572a..d808479e8ef 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -353,7 +353,7 @@ ERROR 23000: Duplicate entry '11' for key 'a' SHOW WARNINGS; Level Code Message -Note 4092 At line 4 in test.f1 +Note 4093 At line 4 in test.f1 Error 1062 Duplicate entry '11' for key 'a' DROP TABLE t1; diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 6434b26dba1..6309ab090b5 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3274,5 +3274,21 @@ row_number() over (partition by i order by i) i 1 2 DROP TABLE t1; # +# MDEV-13384: "window" seems like a reserved column name but it's not listed as one +# +# Currently we allow window as an identifier, except for table aliases. +# +CREATE TABLE door (id INT, window VARCHAR(10)); +SELECT id +FROM door as window; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2 +SELECT id, window +FROM door; +id window +SELECT id, window +FROM door as window; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2 +DROP TABLE door; +# # Start of 10.3 tests # 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 new file mode 100644 index 00000000000..99f2a57835f --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result @@ -0,0 +1,78 @@ +RESET MASTER; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (); +and the command execution is effective thence rotates binlog as usual +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +Non-existed domain is warned, the command completes without rotation +but with a warning +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +Warnings: +Warning 1076 The gtid domain being deleted ('99') is not in the current binlog state +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET @@SESSION.gtid_domain_id=1; +SET @@SESSION.server_id=1; +CREATE TABLE t (a int); +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +FLUSH BINARY LOGS; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +PURGE BINARY LOGS TO 'master-bin.000003';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Gtid_list of the current binlog does not contain '1': +show binlog events in 'master-bin.000004' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Gtid_list 1 # [] +But the previous log's Gtid_list may have it which explains a warning from the following command +show binlog events in 'master-bin.000003' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000003 # Gtid_list 1 # [1-1-1] +Already deleted domain in Gtid_list of the earliest log is benign +but may cause a warning +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Warnings: +Warning 1076 The current gtid binlog state is incompatible with a former one missing gtids from the '1-1' domain-server pair which is referred to in the gtid list describing an earlier state. Ignore if the domain ('1') was already explicitly deleted. +Warning 1076 The gtid domain being deleted ('1') is not in the current binlog state +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000005'; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); +Warnings: +Warning 1076 The gtid domain being deleted ('0') is not in the current binlog state +Gtid_list of the current binlog does not contain 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0: +show binlog events in 'master-bin.000006' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000006 # Gtid_list 1 # [] +SET @@SESSION.gtid_domain_id=1;; +SET @@SESSION.server_id=1; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SET @@SESSION.server_id=2; +SET @@SESSION.gtid_seq_no=2; +INSERT INTO t SET a=2; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=11; +INSERT INTO t SET a=11; +SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state; +FLUSH BINARY LOGS; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state"; +as original state out of order for 11 domain state +1-1-1,1-2-2,11-11-11 1-1-1,1-2-2,11-11-1 +PURGE BINARY LOGS TO 'master-bin.000007'; +the following command succeeds with warnings +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Warnings: +Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. +DROP TABLE t; +RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result new file mode 100644 index 00000000000..b4627caceb2 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result @@ -0,0 +1,6 @@ +SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error'; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +ERROR HY000: Could not delete gtid domain. Reason: injected error. +SHOW WARNINGS; +Level Code Message +Error 1076 Could not delete gtid domain. Reason: injected error. diff --git a/mysql-test/suite/binlog/r/binlog_killed.result b/mysql-test/suite/binlog/r/binlog_killed.result index cda4e8ad6f4..d751b1f9002 100644 --- a/mysql-test/suite/binlog/r/binlog_killed.result +++ b/mysql-test/suite/binlog/r/binlog_killed.result @@ -179,6 +179,97 @@ RELEASE_LOCK("a") 1 drop table t4; drop function bug27563; +FLUSH LOGS; +connect con3, localhost, root,,; +connection con3; +MI: MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000002 # Gtid_list # # [#-#-#] +master-bin.000002 # Binlog_checkpoint # # master-bin.000001 +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=3 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=4 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +IM: INNODB, MyISAM +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=4 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=5 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +IMI: INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=5 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=6 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Intvar # # INSERT_ID=7 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +MI2: MyISAM, INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=6 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=7 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=8 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Intvar # # INSERT_ID=9 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK connection default; disconnect con1; disconnect con2; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 0b7491e4364..75f64500878 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ps.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result @@ -185,3 +185,46 @@ master-bin.000004 # Gtid # # GTID #-#-# master-bin.000004 # Query # # use `test`; DROP PROCEDURE p1 master-bin.000004 # Gtid # # GTID #-#-# master-bin.000004 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +# +#MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +# +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10'; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10'; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +DROP TABLE t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000005 # Binlog_checkpoint # # master-bin.000005 +master-bin.000005 # Gtid # # GTID #-#-# +master-bin.000005 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 101010 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # GTID #-#-# +master-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/suite/binlog/r/load_data_stm_view.result b/mysql-test/suite/binlog/r/load_data_stm_view.result index ddbdb71983f..c21ffb7dcc6 100644 --- a/mysql-test/suite/binlog/r/load_data_stm_view.result +++ b/mysql-test/suite/binlog/r/load_data_stm_view.result @@ -1,3 +1,4 @@ +reset master; create table t1 (i int, j int); create view v1 as select i from t1; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i); 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 new file mode 100644 index 00000000000..0faafa35a1b --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test @@ -0,0 +1,137 @@ +# Prove basic properties of +# +# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...) +# +# The command removes the supplied list of domains from the current +# @@global.gtid_binlog_state provided the binlog files do not contain +# events from such domains. + +# The test is not format specific. One format is chosen to run it. +--source include/have_binlog_format_mixed.inc + +# Reset binlog state +RESET MASTER; + +# Empty list is accepted +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (); +--echo and the command execution is effective thence rotates binlog as usual +--source include/show_binary_logs.inc + +--echo Non-existed domain is warned, the command completes without rotation +--echo but with a warning +--let $binlog_pre_flush=query_get_value(SHOW MASTER STATUS, Position, 1) +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +--let $binlog_start=$binlog_pre_flush +--source include/show_binary_logs.inc + +# Log one event in a specified domain and try to delete the domain +SET @@SESSION.gtid_domain_id=1; +SET @@SESSION.server_id=1; +CREATE TABLE t (a int); + +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# the same error after log rotation +FLUSH BINARY LOGS; +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# the latest binlog does not really contain any events incl ones from 1-domain +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# So now it's safe to delete +--error 0 +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +--echo Gtid_list of the current binlog does not contain '1': +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +--source include/show_gtid_list.inc +--echo But the previous log's Gtid_list may have it which explains a warning from the following command +--let $binlog_file=$purge_to_binlog +--source include/show_gtid_list.inc + +--echo Already deleted domain in Gtid_list of the earliest log is benign +--echo but may cause a warning +--error 0 +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# Few domains delete. The chosen number verifies among others how +# expected overrun of the static buffers of underlying dynamic arrays is doing. +--let $domain_cnt=17 +--let $server_in_domain_cnt=3 +--let $domain_list= +--disable_query_log +while ($domain_cnt) +{ + --let servers=$server_in_domain_cnt + --eval SET @@SESSION.gtid_domain_id=$domain_cnt + while ($servers) + { + --eval SET @@SESSION.server_id=10*$domain_cnt + $servers + --eval INSERT INTO t SET a=@@SESSION.server_id + + --dec $servers + } + --let $domain_list= $domain_cnt, $domain_list + + --dec $domain_cnt +} +--enable_query_log +--let $zero=0 +--let $domain_list= $domain_list$zero + +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list) + +# Now satisfy the safety condtion to purge log files containing $domain list +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 +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list) +--echo Gtid_list of the current binlog does not contain $domain_list: +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +--source include/show_gtid_list.inc + +# Show reaction on @@global.gtid_binlog_state not succeeding +# earlier state as described by the 1st binlog' Gtid_list. +# Now let it be out-order gtid logged to a domain unrelated to deletion. + +--let $del_d_id=1 +--eval SET @@SESSION.gtid_domain_id=$del_d_id; +SET @@SESSION.server_id=1; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SET @@SESSION.server_id=2; +SET @@SESSION.gtid_seq_no=2; +INSERT INTO t SET a=2; + +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=11; +INSERT INTO t SET a=11; + +SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state; +FLUSH BINARY LOGS; + +# Inject out of order for domain '11' before +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; + +SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state"; + +# to delete '1', first to purge logs containing its events +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog' + +--echo the following command succeeds with warnings +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id) + +# +# Cleanup +# + +DROP TABLE t; +RESET MASTER; diff --git a/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test new file mode 100644 index 00000000000..5de549c45bb --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test @@ -0,0 +1,11 @@ +# Check "internal" error branches of +# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...) +# handler. +--source include/have_debug.inc +--source include/have_binlog_format_mixed.inc + +SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error'; +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); + +SHOW WARNINGS; diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index 73759ee5aa5..8ac223603a3 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -349,6 +349,87 @@ drop table t4; drop function bug27563; +# Prove that killing connection in the middle +# of mixed engine transactions affect binlogging +# as specified. + +# keep binlogging for this piece of test in a new file +FLUSH LOGS; + +# Connection con3 as transaction generator thoughout the test +connect (con3, localhost, root,,); + +connection con3; +let $ID= `select connection_id()`; + +--echo MI: MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +#Connection con1 as killer throughout the test +connection con1; +--replace_result $ID ID +--eval KILL $ID +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +--let $binlog_start= 4 +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo IM: INNODB, MyISAM +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo IMI: INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo MI2: MyISAM, INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc + + # # common cleanup # diff --git a/mysql-test/suite/binlog/t/binlog_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test index e6e54985f6f..b83991b1356 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_ps.test +++ b/mysql-test/suite/binlog/t/binlog_stm_ps.test @@ -99,3 +99,19 @@ DROP TABLE t1; --let $binlog_file = LAST source include/show_binlog_events.inc; + +--echo # +--echo #MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +--echo # + +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10'; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10'; +DROP TABLE t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; diff --git a/mysql-test/suite/binlog/t/load_data_stm_view.test b/mysql-test/suite/binlog/t/load_data_stm_view.test index b70651b4e2d..9f64b813eec 100644 --- a/mysql-test/suite/binlog/t/load_data_stm_view.test +++ b/mysql-test/suite/binlog/t/load_data_stm_view.test @@ -8,6 +8,8 @@ 1 EOF +reset master; + create table t1 (i int, j int); create view v1 as select i from t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -15,6 +17,8 @@ create view v1 as select i from t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 select * from v1; +--let $binlog_file = LAST --source include/show_binlog_events.inc drop view v1; drop table t1; +--remove_file $MYSQLTEST_VARDIR/3940.data diff --git a/mysql-test/suite/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result index ed7cb4c51d5..158d15e9f90 100644 --- a/mysql-test/suite/compat/oracle/r/ps.result +++ b/mysql-test/suite/compat/oracle/r/ps.result @@ -247,3 +247,18 @@ DROP PROCEDURE p1; # # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions # +# +# MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash +# +SELECT ? FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? FROM DUAL' at line 1 +SELECT :a FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':a FROM DUAL' at line 1 +SELECT :1 FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':1 FROM DUAL' at line 1 +SELECT 1+? FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? FROM DUAL' at line 1 +SELECT 1+:a FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':a FROM DUAL' at line 1 +SELECT 1+:1 FROM DUAL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':1 FROM DUAL' at line 1 diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result index 3030a3dc658..a46daf30a8f 100644 --- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result +++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result @@ -1359,3 +1359,36 @@ t2 CREATE TABLE "t2" ( "b" varchar(3) DEFAULT NULL, "c" time DEFAULT NULL ) +# +# MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode +# +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (0),(1),(2),(3); +CREATE FUNCTION f1() RETURN INT is +BEGIN +FOR v1 in (SELECT id FROM t1) +LOOP +NULL; +END LOOP; +RETURN 1; +END; +$$ +SELECT f1(); +f1() +1 +DROP FUNCTION f1; +DROP TABLE t1; +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); +CREATE FUNCTION f1() RETURN INT IS +CURSOR cur IS SELECT id FROM t1; +rec cur%ROWTYPE; +BEGIN +RETURN 1; +END; +$$ +SELECT f1(); +f1() +1 +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result index 53411e80251..2bf4f50e6d5 100644 --- a/mysql-test/suite/compat/oracle/r/sp.result +++ b/mysql-test/suite/compat/oracle/r/sp.result @@ -2404,3 +2404,31 @@ t1 CREATE TABLE "t1" ( "aa_timestamp5" timestamp(5) NULL DEFAULT NULL, "aa_date0" datetime DEFAULT NULL ) +# +# MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar" +# +CREATE TABLE t1 (x INT); +INSERT INTO t1 VALUES (10); +CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1; +CREATE PROCEDURE p1 +AS +a INT := 1; +b INT := 2; +BEGIN +CREATE TABLE t2 AS SELECT a,b FROM v1; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t2; +END; +$$ +CALL p1(); +Table Create Table +t2 CREATE TABLE "t2" ( + "a" int(11) DEFAULT NULL, + "b" int(11) DEFAULT NULL +) +a b +1 2 +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/ps.test b/mysql-test/suite/compat/oracle/t/ps.test index 08bb957c33f..357b50e0eab 100644 --- a/mysql-test/suite/compat/oracle/t/ps.test +++ b/mysql-test/suite/compat/oracle/t/ps.test @@ -264,3 +264,27 @@ DROP PROCEDURE p1; --echo # --echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions --echo # + + +--echo # +--echo # MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash +--echo # + +# When running with --ps, the below queries return +# CR_PARAMS_NOT_BOUND instead of ER_PARSE_ERROR + +--disable_ps_protocol +--error ER_PARSE_ERROR +SELECT ? FROM DUAL; +--error ER_PARSE_ERROR +SELECT :a FROM DUAL; +--error ER_PARSE_ERROR +SELECT :1 FROM DUAL; + +--error ER_PARSE_ERROR +SELECT 1+? FROM DUAL; +--error ER_PARSE_ERROR +SELECT 1+:a FROM DUAL; +--error ER_PARSE_ERROR +SELECT 1+:1 FROM DUAL; +--enable_ps_protocol diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test index 19a50eacca1..fd148d1f261 100644 --- a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test +++ b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test @@ -1444,3 +1444,39 @@ BEGIN END; $$ DELIMITER ;$$ + +--echo # +--echo # MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode +--echo # + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (0),(1),(2),(3); +DELIMITER $$; +CREATE FUNCTION f1() RETURN INT is +BEGIN + FOR v1 in (SELECT id FROM t1) + LOOP + NULL; + END LOOP; + RETURN 1; +END; +$$ +DELIMITER ;$$ +SELECT f1(); +DROP FUNCTION f1; +DROP TABLE t1; + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); +DELIMITER $$; +CREATE FUNCTION f1() RETURN INT IS + CURSOR cur IS SELECT id FROM t1; + rec cur%ROWTYPE; +BEGIN + RETURN 1; +END; +$$ +DELIMITER ;$$ +SELECT f1(); +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test index 61a37459483..e7adbb5403a 100644 --- a/mysql-test/suite/compat/oracle/t/sp.test +++ b/mysql-test/suite/compat/oracle/t/sp.test @@ -2233,3 +2233,30 @@ BEGIN END; $$ DELIMITER ;$$ + + +--echo # +--echo # MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar" +--echo # + + +CREATE TABLE t1 (x INT); +INSERT INTO t1 VALUES (10); +CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1; +DELIMITER $$; +CREATE PROCEDURE p1 +AS + a INT := 1; + b INT := 2; +BEGIN + CREATE TABLE t2 AS SELECT a,b FROM v1; + SHOW CREATE TABLE t2; + SELECT * FROM t2; + DROP TABLE t2; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt index ce7f1ddef7e..66aaef98c54 100644 --- a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt +++ b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt @@ -1,2 +1,3 @@ --plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO --loose-example-key-management +--plugin-maturity=unknown diff --git a/mysql-test/suite/federated/federated_partition.result b/mysql-test/suite/federated/federated_partition.result index a2d5fcffd9b..c8a61d825b6 100644 --- a/mysql-test/suite/federated/federated_partition.result +++ b/mysql-test/suite/federated/federated_partition.result @@ -10,7 +10,8 @@ create table federated.t1_1 (s1 int primary key) engine=myisam; create table federated.t1_2 (s1 int primary key) engine=innodb; connection master; create table t1 (s1 int primary key) engine=federated -partition by list (s1) +CONNECTION="remember_this" + partition by list (s1) (partition p1 values in (1,3) connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1', partition p2 values in (2,4) @@ -20,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` int(11) NOT NULL, PRIMARY KEY (`s1`) -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='remember_this' PARTITION BY LIST (`s1`) (PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) diff --git a/mysql-test/suite/federated/federated_partition.test b/mysql-test/suite/federated/federated_partition.test index ef1e27ec505..47110b5eebf 100644 --- a/mysql-test/suite/federated/federated_partition.test +++ b/mysql-test/suite/federated/federated_partition.test @@ -25,6 +25,7 @@ create table federated.t1_2 (s1 int primary key) engine=innodb; connection master; --replace_result $SLAVE_MYPORT SLAVE_PORT eval create table t1 (s1 int primary key) engine=federated + CONNECTION="remember_this" partition by list (s1) (partition p1 values in (1,3) connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1', diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index 7468d5db0be..50b4073a839 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1; ERROR 42S02: Table 'test.v1' doesn't exist DROP VIEW IF EXISTS v2; Warnings: -Note 4090 Unknown VIEW: 'test.v2' +Note 4091 Unknown VIEW: 'test.v2' Testcase 3.3.1.25 -------------------------------------------------------------------------------- @@ -7566,7 +7566,7 @@ Call sp1() ; ERROR 42000: PROCEDURE test.sp1 does not exist Drop view if exists test.v1 ; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Drop procedure sp1 ; ERROR 42000: PROCEDURE test.sp1 does not exist @@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1; DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Testcase 3.3.1.68 -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index d1eba03b180..00cd4e666e5 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -28,7 +28,6 @@ def mysql db Create_tmp_table_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_g def mysql db Create_view_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NEVER NULL def mysql db Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql db Truncate_versioning_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Event_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Execute_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL @@ -41,6 +40,7 @@ def mysql db References_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general def mysql db Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Show_view_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Trigger_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL +def mysql db Truncate_versioning_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql db User 3 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL def mysql event body 3 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL @@ -134,6 +134,7 @@ def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references NEVER NULL +def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') select,insert,update,references NEVER NULL def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references NEVER NULL @@ -236,7 +237,6 @@ def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_gene def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Truncate_versioning_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL @@ -268,6 +268,7 @@ def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL b def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references NEVER NULL def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL +def mysql user Truncate_versioning_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL @@ -501,6 +502,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32) 1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob +3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP') 3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index c4370b768c6..c167a9584e5 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -120,6 +120,7 @@ def mysql index_stats prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL i def mysql index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI NEVER NULL def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) NEVER NULL def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI NEVER NULL +def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') NEVER NULL def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) NEVER NULL @@ -483,6 +484,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32) 1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob +3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP') 3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index 4c422d600bf..df658deded0 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1; ERROR 42S02: Table 'test.v1' doesn't exist DROP VIEW IF EXISTS v2; Warnings: -Note 4090 Unknown VIEW: 'test.v2' +Note 4091 Unknown VIEW: 'test.v2' Testcase 3.3.1.25 -------------------------------------------------------------------------------- @@ -7567,7 +7567,7 @@ Call sp1() ; ERROR 42000: PROCEDURE test.sp1 does not exist Drop view if exists test.v1 ; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Drop procedure sp1 ; ERROR 42000: PROCEDURE test.sp1 does not exist @@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1; DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Testcase 3.3.1.68 -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result index 36c99148020..5f23c45f594 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views-big.result +++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result @@ -4784,7 +4784,7 @@ CREATE VIEW v2 AS Select * from test.v1; ERROR 42S02: Table 'test.v1' doesn't exist DROP VIEW IF EXISTS v2; Warnings: -Note 4090 Unknown VIEW: 'test.v2' +Note 4091 Unknown VIEW: 'test.v2' Testcase 3.3.1.25 -------------------------------------------------------------------------------- @@ -8387,7 +8387,7 @@ Call sp1() ; ERROR 42000: PROCEDURE test.sp1 does not exist Drop view if exists test.v1 ; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Drop procedure sp1 ; ERROR 42000: PROCEDURE test.sp1 does not exist @@ -22989,7 +22989,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1; DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1; Warnings: -Note 4090 Unknown VIEW: 'test.v1' +Note 4091 Unknown VIEW: 'test.v1' Testcase 3.3.1.68 -------------------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index af3faf707d8..e5e009a86de 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -1771,48 +1771,48 @@ Testcase 4.1.9: drop procedure -------------------------------------------------------------------------------- SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate DROP PROCEDURE IF EXISTS sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE PROCEDURE sp9()SELECT * from t1; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE DROP PROCEDURE sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE PROCEDURE sp9()SELECT * from t1; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE DROP PROCEDURE IF EXISTS sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.1.10: ---------------- DROP FUNCTION -------------------------------------------------------------------------------- SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate DROP FUNCTION IF EXISTS fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE FUNCTION fn10() returns int return 100; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE DROP FUNCTION fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE FUNCTION fn10() returns int return 100; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE DROP FUNCTION IF EXISTS fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.1.11: ---------------- @@ -4477,7 +4477,7 @@ CREATE PROCEDURE sp1() for:BEGIN SELECT @x; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'for:BEGIN +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':BEGIN SELECT @x; END' at line 2 DROP PROCEDURE IF EXISTS sp1; @@ -16170,15 +16170,15 @@ insert into t43 values('abcde', 'a!@#$%^&*('); CREATE PROCEDURE d1.sp4() SELECT * from d1.t43; SELECT * from mysql.proc where specific_name = 'sp4'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43 NONE USE db_storedproc; DROP DATABASE d1; CREATE DATABASE d1; USE d1; create table t44(a char(5), b char(10)); SELECT * from mysql.proc where specific_name = 'sp4'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate USE db_storedproc; DROP DATABASE d1; @@ -16220,8 +16220,8 @@ CREATE PROCEDURE sp8 ( n char(20) ) sql security DEFINER comment 'initial' USE d2; alter procedure d1.sp8 sql security DEFINER comment 'updated'; SELECT * from mysql.proc where specific_name='sp8' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n NONE Testcase 4.4.9: -------------------------------------------------------------------------------- @@ -16237,7 +16237,7 @@ END// USE d2; alter function d1.fn2 sql security DEFINER comment 'updated'; SELECT * from mysql.proc where specific_name='fn2' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate d1 fn2 FUNCTION fn2 SQL CONTAINS_SQL NO DEFINER n int int(11) BEGIN declare a int; set a = 0.9 * n; @@ -16246,7 +16246,7 @@ END root@localhost modified created updated latin1 latin1_swedish_ci latin1_swe declare a int; set a = 0.9 * n; return a; -END +END NONE Testcase 4.4.10: -------------------------------------------------------------------------------- @@ -16256,7 +16256,7 @@ SELECT * from t1 where t1.f1 = n; USE d2; DROP PROCEDURE d1.sp9; SELECT * from mysql.proc where specific_name='sp9' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.4.11: -------------------------------------------------------------------------------- @@ -16270,7 +16270,7 @@ END// USE d2; DROP FUNCTION d1.fn3; SELECT * from mysql.proc where specific_name='fn3' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate USE db_storedproc; DROP DATABASE d1; DROP DATABASE d2; diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index b24f3603894..8de704dbec8 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -4,6 +4,7 @@ [mysqld] wsrep-on=1 binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result new file mode 100644 index 00000000000..17d347a11fb --- /dev/null +++ b/mysql-test/suite/galera/r/MW-388.result @@ -0,0 +1,46 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +CREATE PROCEDURE insert_proc () +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; +END; +INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); +INSERT INTO t1 VALUES (3, 'node 1'); +END| +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +INSERT INTO t1 VALUES (1, 'node 2');; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET SESSION wsrep_sync_wait = 0; +SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; +CALL insert_proc ();; +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; +SET GLOBAL DEBUG = ""; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SELECT @errno = 1213; +@errno = 1213 +1 +SELECT * FROM t1; +f1 f2 +1 node 2 +3 node 1 +SELECT * FROM t1; +f1 f2 +1 node 2 +3 node 1 +SET GLOBAL wsrep_slave_threads = DEFAULT; +DROP TABLE t1; +DROP PROCEDURE insert_proc; +SET GLOBAL debug = NULL; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET debug_sync='RESET'; +SELECT @@debug_sync; +@@debug_sync +ON - current signal: '' diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result index 8b208ff82d5..c175a0a0e7a 100644 --- a/mysql-test/suite/galera/r/sql_log_bin.result +++ b/mysql-test/suite/galera/r/sql_log_bin.result @@ -7,6 +7,7 @@ INSERT INTO t1 VALUES (1); # Disable binary logging for current session SET SQL_LOG_BIN=OFF; INSERT INTO t1 VALUES (2); +FLUSH BINARY LOGS; CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t2 VALUES (1); CREATE TABLE test.t3 AS SELECT * from t1; diff --git a/mysql-test/suite/galera/suite.opt b/mysql-test/suite/galera/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/galera/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 361743f1243..bad0484be16 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test new file mode 100644 index 00000000000..209695dca80 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-388.test @@ -0,0 +1,76 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; + +DELIMITER |; +CREATE PROCEDURE insert_proc () +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; + END; + INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); + INSERT INTO t1 VALUES (3, 'node 1'); +END| +DELIMITER ;| + +# We need two slave threads here to guarantee progress. +# If we use only one thread the following could happen +# in node_1: +# We block the only slave thread in wsrep_apply_cb and we +# issue an INSERT (by calling the stored procedure) that will +# try to acquire galera's local monitor in pre_commit(). +# This usually works fine, except for when a commit cut event +# sneaks in the slave queue and gets a local seqno smaller than +# that of the INSERT. Because there is only one slave thread, +# commit cut is not processed and therefore does not advance +# local monitor, and our INSERT remains stuck there. +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; + +--connection node_2 +--send INSERT INTO t1 VALUES (1, 'node 2'); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; +--send CALL insert_proc (); + +--connection node_1a +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; + + +SET GLOBAL DEBUG = ""; +SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--reap + +--connection node_1 +# We expect no errors here, because the handler in insert_proc() caught the deadlock error +--reap +SELECT @errno = 1213; +SELECT * FROM t1; + +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +SET GLOBAL wsrep_slave_threads = DEFAULT; +DROP TABLE t1; +DROP PROCEDURE insert_proc; + +SET GLOBAL debug = NULL; +SET debug_sync='RESET'; + +# Make sure no pending signals are leftover to surprise subsequent tests. +SELECT @@debug_sync; diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test index de8310e52d2..739255609ee 100644 --- a/mysql-test/suite/galera/t/galera_ftwrl.test +++ b/mysql-test/suite/galera/t/galera_ftwrl.test @@ -29,12 +29,11 @@ SELECT * FROM t1; UNLOCK TABLES; -SHOW TABLES; -SELECT COUNT(*) = 1 FROM t1; - --disable_query_log --eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig"; --enable_query_log -DROP TABLE t1; +SHOW TABLES; +SELECT COUNT(*) = 1 FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index dcc4a8d14c3..aa4543cf81c 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -25,7 +25,7 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; my $pid_filename = $ENV{'NODE_2_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -19 $mysqld_pid"); + system("kill -SIGSTOP $mysqld_pid"); exit(0); EOF @@ -37,7 +37,7 @@ INSERT INTO t1 VALUES (1); my $pid_filename = $ENV{'NODE_2_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -18 $mysqld_pid"); + system("kill -SIGCONT $mysqld_pid"); exit(0); EOF diff --git a/mysql-test/suite/galera/t/sql_log_bin.test b/mysql-test/suite/galera/t/sql_log_bin.test index 615bc4c30af..9f8f7c84486 100644 --- a/mysql-test/suite/galera/t/sql_log_bin.test +++ b/mysql-test/suite/galera/t/sql_log_bin.test @@ -1,5 +1,13 @@ # Test to check the behavior of galera cluster with sql_log_bin=ON|OFF & binary # logging is disabled. sql_bin_log should not affect galera replication. +# +# The following bugfixes are tested: +# +# MDEV-9510: Segmentation fault in binlog thread. +# A scenario otherwise causing a similar segfault is replayed. +# The test must pass having no crashes. +# The sequence of sql statements is provided by original +# sql_log_bin.test augmented with a FLUSH BINLOG LOGS, below. --source include/galera_cluster.inc --source include/have_innodb.inc @@ -15,6 +23,10 @@ INSERT INTO t1 VALUES (1); --echo # Disable binary logging for current session SET SQL_LOG_BIN=OFF; INSERT INTO t1 VALUES (2); + +# MDEV-9510: the following binlog rotation due to FLUSH segfaults wo/ the fixes +FLUSH BINARY LOGS; + CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t2 VALUES (1); CREATE TABLE test.t3 AS SELECT * from t1; diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 91aa53ad7b1..48b3c002c04 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -3,6 +3,7 @@ [mysqld] binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index c91e6e07d76..3a1237ecf75 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_stats.result b/mysql-test/suite/gcol/r/innodb_virtual_stats.result new file mode 100644 index 00000000000..4ef499f932f --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_stats.result @@ -0,0 +1,127 @@ +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b), +KEY idxa (a), +KEY vidxcd (c, d) +) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO t (a,b) VALUES (1, 2); +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +ALTER TABLE t DROP INDEX vidxcd; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +DROP TABLE t; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_stats.test b/mysql-test/suite/gcol/t/innodb_virtual_stats.test new file mode 100644 index 00000000000..7e3c8f4e00e --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_stats.test @@ -0,0 +1,52 @@ +--source include/have_innodb.inc + +# +# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN +# + +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b), + KEY idxa (a), + KEY vidxcd (c, d) +) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; + +INSERT INTO t (a,b) VALUES (1, 2); + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP INDEX vidxcd; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +DROP TABLE t; diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc new file mode 100644 index 00000000000..3c10517933f --- /dev/null +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc @@ -0,0 +1,185 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + IF i%2 = 0 AND load_even = 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + IF i%2 != 0 AND load_even != 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +SELECT @@innodb_fill_factor; + +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +# Load half records +CALL populate_t1(1); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; + +SELECT * FROM t1 WHERE id = 3000; +SELECT * FROM t1 WHERE title = 'a3000'; +SELECT * FROM t1 WHERE title = 'b3000'; + +SELECT * FROM t1 WHERE id = 4000; +SELECT * FROM t1 WHERE title = 'a4000'; +SELECT * FROM t1 WHERE title = 'b4000'; + +SELECT * FROM t1 WHERE id = 4001; +SELECT * FROM t1 WHERE title = 'a4001'; + +-- disable_query_log +# Load half records (follow up load) +CALL populate_t1(0); +-- enable_query_log +SELECT COUNT(*) FROM t1; + + +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +# Test Blob +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b BLOB, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +let $cnt= 5000; +-- disable_query_log +WHILE ($cnt>=4950) +{ +EVAL INSERT INTO t1 VALUES + ($cnt, REPEAT(CONCAT('a', $cnt),2000), CONCAT('a', $cnt)); +dec $cnt; +} +-- enable_query_log +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +# Restore global variables +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=default; +} + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc new file mode 100644 index 00000000000..48de3a1962d --- /dev/null +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc @@ -0,0 +1,221 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Not supported in embedded +-- source include/not_embedded.inc + +# This test case needs to crash the server. Needs a debug server. +-- source include/have_debug.inc + +# Don't test this under valgrind, memory leaks will occur. +-- source include/not_valgrind.inc + +# Avoid CrashReporter popup on Mac +-- source include/not_crashrep.inc + +-- source include/have_innodb.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +# Test scenarios: +# 1. Test restart; +# 2. Test crash recovery. + +# Test Restart +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +CREATE INDEX idx_title ON t1(title); + +--source include/restart_mysqld.inc + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +-- echo # Test Blob + +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +SELECT CHAR_LENGTH(b) FROM t1; + +ALTER TABLE t1 DROP COLUMN c; + +--source include/restart_mysqld.inc + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1; + +DROP TABLE t1; + +# Test Crash Recovery + +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SET debug_dbug='+d,crash_commit_before'; + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +--error 2013 +CREATE INDEX idx_title ON t1(title); + +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect + +SELECT COUNT(*) FROM t1; + +CHECK TABLE t1; + +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +-- echo # Test Blob + +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +SELECT CHAR_LENGTH(b) FROM t1; + +SET debug_dbug='+d,crash_commit_before'; + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +--error 2013 +ALTER TABLE t1 DROP COLUMN c; + +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1; + +DROP TABLE t1; + +# Restore global variables +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=default; +} + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/ddl_purge.result b/mysql-test/suite/innodb/r/ddl_purge.result new file mode 100644 index 00000000000..45f4c99e97b --- /dev/null +++ b/mysql-test/suite/innodb/r/ddl_purge.result @@ -0,0 +1,25 @@ +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB; +connect con1,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=1; +connect con2,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=2; +connection default; +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged'; +ALTER TABLE t1 FORCE; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR prepared'; +INSERT INTO t1 SET pk=1; +COMMIT; +disconnect con1; +connection con2; +UPDATE t1 SET b=1; +DELETE FROM t1; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL logged'; +disconnect con2; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result new file mode 100644 index 00000000000..474ebf33bbd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result @@ -0,0 +1,60 @@ +set sql_mode=''; +set innodb_strict_mode=0; +CREATE TABLE `v` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT v values (1); +CREATE TABLE `vp` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +`v_id` int(10) unsigned NOT NULL, +`p_id` int(10) unsigned NOT NULL, +`ppp` varchar(255) NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`), +KEY `FK_vp_v` (`v_id`), +CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT vp VALUES (12, 1, 100, 'text12'); +INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`); +Warnings: +Warning 1364 Field 'v_id' doesn't have a default value +Warning 1364 Field 'p_id' doesn't have a default value +SELECT * FROM vp; +id v_id p_id ppp +12 1 100 test12-2 +DROP TABLE vp, v; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +UNIQUE KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2,t1; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result new file mode 100644 index 00000000000..84bc9dc9769 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -0,0 +1,13 @@ +# +# Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +# +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), +key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +select * from t1; +f1 f2 f3 +14 25 34 +drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result new file mode 100644 index 00000000000..ec7ce044cb7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result @@ -0,0 +1,1037 @@ +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b BLOB, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=10; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +10 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=50; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +50 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=default; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result new file mode 100644 index 00000000000..cd5a3c340da --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result @@ -0,0 +1,485 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SET debug_dbug='+d,crash_commit_before'; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET debug_dbug='+d,crash_commit_before'; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SET debug_dbug='+d,crash_commit_before'; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET debug_dbug='+d,crash_commit_before'; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SET debug_dbug='+d,crash_commit_before'; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET debug_dbug='+d,crash_commit_before'; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET debug_dbug='+d,crash_commit_before'; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET debug_dbug='+d,crash_commit_before'; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result new file mode 100644 index 00000000000..d2b812642f6 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result @@ -0,0 +1,54 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +SET @saved_dbug= @@SESSION.debug_dbug; +SET debug_dbug='+d,ib_index_build_fail_before_flush'; +CREATE INDEX idx_id ON t1(id); +ERROR 70100: Query execution was interrupted +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CREATE INDEX idx_title ON t1(title); +ERROR 70100: Query execution was interrupted +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CREATE FULLTEXT INDEX fidx_title ON t1(title); +ERROR 70100: Query execution was interrupted +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD COLUMN content TEXT, FORCE; +ERROR 70100: Query execution was interrupted +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET debug_dbug= @saved_dbug; +INSERT INTO t1 VALUES(10001, 10001, 'a10000'); +ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title); +ERROR 23000: Duplicate entry 'a10000' for key 'idx_title' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title); +ERROR 23000: Duplicate entry 'a10000' for key 'idx_title' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result new file mode 100644 index 00000000000..ae050170b4f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -0,0 +1,222 @@ +include/master-slave.inc +[connection master] +connection master; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 100) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ; +SELECT COUNT(*) FROM t1; +COUNT(*) +50 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 40 AND id > 30; +INSERT INTO t1 VALUES(38, 38, 'b38'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20; +SELECT * FROM t1 WHERE id = 28; +class id title +28 28 b28 +SELECT * FROM t1 WHERE title = 'a28'; +class id title +SELECT * FROM t1 WHERE title = 'b28'; +class id title +28 28 b28 +SELECT * FROM t1 WHERE id = 38; +class id title +38 38 b38 +SELECT * FROM t1 WHERE title = 'a38'; +class id title +SELECT * FROM t1 WHERE title = 'b38'; +class id title +38 38 b38 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +CREATE TABLE t_part ( +class INT , +id INT , +title VARCHAR(30) +) ENGINE=InnoDB +PARTITION BY RANGE(id) +SUBPARTITION BY KEY(id) +SUBPARTITIONS 4 +( +PARTITION p0 VALUES LESS THAN (5000), +PARTITION p1 VALUES LESS THAN (MAXVALUE) +); +INSERT INTO t_part SELECT * FROM t1; +ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10)); +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +include/sync_slave_sql_with_master.inc +connection slave; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(100) DEFAULT NULL, + KEY `idx_id` (`id`), + KEY `idx_title` (`title`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t_part; +Table Create Table +t_part CREATE TABLE `t_part` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(30) DEFAULT NULL, + KEY `idx` (`class`,`id`,`title`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`id`) +SUBPARTITION BY KEY (`id`) +SUBPARTITIONS 4 +(PARTITION `p0` VALUES LESS THAN (5000) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT COUNT(*) FROM t_part; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +connection master; +DROP PROCEDURE populate_t1; +DROP TABLE t1; +DROP TABLE t_part; +include/rpl_end.inc diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result new file mode 100644 index 00000000000..b48207d4497 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -0,0 +1,139 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 1000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index cdfdbad9e20..3663c18ea44 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -238,14 +238,14 @@ select 1, max(1) from t1i where 1=99; 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) @@ -1853,7 +1853,7 @@ explain select b from t1 where a not in (select max(b) from t1,t2 group by a) group by a; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 set optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/r/innodb_stats_debug.result b/mysql-test/suite/innodb/r/innodb_stats_debug.result new file mode 100644 index 00000000000..8f599acc08c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_debug.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist"); +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1; +SET @save_debug= @@SESSION.debug_dbug; +SET debug_dbug= '+d,stats_index_error'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Operation failed +SET debug_dbug= @save_debug; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 098d9fa3b5d..d274d834faa 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -9,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -191,7 +191,7 @@ +@@ -250,7 +250,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -202,7 +202,7 @@ +@@ -261,7 +261,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -212,7 +212,7 @@ +@@ -271,7 +271,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -36,7 +36,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -317,7 +317,7 @@ +@@ -374,7 +374,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -45,7 +45,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -340,7 +340,7 @@ +@@ -397,7 +397,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -54,16 +54,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -353,7 +353,7 @@ +@@ -410,7 +410,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +8 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -532,7 +532,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -600,7 +600,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -72,7 +72,7 @@ connection default; ROLLBACK; connection analyze; -@@ -542,7 +542,7 @@ +@@ -610,7 +610,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -81,7 +81,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -553,7 +553,7 @@ +@@ -621,7 +621,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -90,7 +90,7 @@ connection default; ROLLBACK; connection analyze; -@@ -563,7 +563,7 @@ +@@ -631,7 +631,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -99,7 +99,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -668,7 +668,7 @@ +@@ -734,7 +734,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -108,7 +108,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -691,7 +691,7 @@ +@@ -757,7 +757,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -117,16 +117,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -704,7 +704,7 @@ +@@ -770,7 +770,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +7 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -883,7 +883,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -960,7 +960,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -135,7 +135,7 @@ connection default; ROLLBACK; connection analyze; -@@ -893,7 +893,7 @@ +@@ -970,7 +970,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -144,7 +144,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -904,7 +904,7 @@ +@@ -981,7 +981,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -153,7 +153,7 @@ connection default; ROLLBACK; connection analyze; -@@ -914,7 +914,7 @@ +@@ -991,7 +991,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -162,7 +162,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1019,7 +1019,7 @@ +@@ -1094,7 +1094,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -171,7 +171,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1042,7 +1042,7 @@ +@@ -1117,7 +1117,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -180,12 +180,12 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1055,7 +1055,7 @@ +@@ -1130,7 +1130,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +7 connection default; - DROP TABLE big; - disconnect analyze; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff index a313765df3a..b96262866e5 100644 --- a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff @@ -1,6 +1,6 @@ --- instant_alter.result +++ instant_alter,8k.result -@@ -181,7 +181,7 @@ +@@ -240,7 +240,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -9,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -191,7 +191,7 @@ +@@ -250,7 +250,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -202,7 +202,7 @@ +@@ -261,7 +261,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -212,7 +212,7 @@ +@@ -271,7 +271,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -36,7 +36,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -317,7 +317,7 @@ +@@ -374,7 +374,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -45,7 +45,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -340,7 +340,7 @@ +@@ -397,7 +397,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -54,16 +54,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -353,7 +353,7 @@ +@@ -410,7 +410,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -532,7 +532,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -600,7 +600,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -72,7 +72,7 @@ connection default; ROLLBACK; connection analyze; -@@ -542,7 +542,7 @@ +@@ -610,7 +610,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -81,7 +81,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -553,7 +553,7 @@ +@@ -621,7 +621,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -90,7 +90,7 @@ connection default; ROLLBACK; connection analyze; -@@ -563,7 +563,7 @@ +@@ -631,7 +631,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -99,7 +99,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -668,7 +668,7 @@ +@@ -734,7 +734,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -108,7 +108,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -691,7 +691,7 @@ +@@ -757,7 +757,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -117,16 +117,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -704,7 +704,7 @@ +@@ -770,7 +770,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -883,7 +883,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -960,7 +960,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -135,7 +135,7 @@ connection default; ROLLBACK; connection analyze; -@@ -893,7 +893,7 @@ +@@ -970,7 +970,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -144,7 +144,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -904,7 +904,7 @@ +@@ -981,7 +981,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -153,7 +153,7 @@ connection default; ROLLBACK; connection analyze; -@@ -914,7 +914,7 @@ +@@ -991,7 +991,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -162,7 +162,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1019,7 +1019,7 @@ +@@ -1094,7 +1094,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -171,7 +171,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1042,7 +1042,7 @@ +@@ -1117,7 +1117,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -180,12 +180,12 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1055,7 +1055,7 @@ +@@ -1130,7 +1130,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - disconnect analyze; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result index 137cf8b766d..795d302087f 100644 --- a/mysql-test/suite/innodb/r/instant_alter_debug.result +++ b/mysql-test/suite/innodb/r/instant_alter_debug.result @@ -35,7 +35,7 @@ ALTER TABLE t4 ADD COLUMN b INT; SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS LEFT JOIN t4 ON (NUMERIC_SCALE = pk); COUNT(*) -1746 +1747 SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL enter WAIT_FOR delete'; ALTER TABLE t4 ADD COLUMN c INT; connect dml,localhost,root,,; diff --git a/mysql-test/suite/innodb/r/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result new file mode 100644 index 00000000000..b6d14124371 --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_restart.result @@ -0,0 +1,12 @@ +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1; +connect con1,localhost,root,,test; +SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; +TRUNCATE TABLE t1; +connection default; +SET DEBUG_SYNC='now WAIT_FOR committed'; +disconnect con1; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result new file mode 100644 index 00000000000..ab3eeb08dc7 --- /dev/null +++ b/mysql-test/suite/innodb/r/update_time.result @@ -0,0 +1,54 @@ +# +# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled +# correctly for InnoDB tables. +# +CREATE TABLE t (a INT) ENGINE=INNODB; +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +INSERT INTO t VALUES (1); +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +# We cant deterministically check that the saved value is correct, but +# at least we check that it is a timestamp not older than 2 minutes. +# Usually update_time and NOW() are equal below, but on heavily loaded +# machines NOW() could be younger. +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; +COUNT(*) +1 +CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; +COUNT(*) +1 +# INSERT lots of data in table 'big': begin +# INSERT lots of data in table 'big': end +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; +COUNT(*) +0 +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +DROP TEMPORARY TABLE big; +# Test the behavior after restart with a prepared XA transaction +XA START 'xatrx'; +INSERT INTO t VALUES (5); +XA END 'xatrx'; +XA PREPARE 'xatrx'; +CONNECT con1,localhost,root,,; +call mtr.add_suppression("Found 1 prepared XA transactions"); +FLUSH TABLES; +# Kill and restart +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +XA COMMIT 'xatrx'; +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t'; +COUNT(update_time) +1 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/suite.opt b/mysql-test/suite/innodb/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/innodb/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/innodb/t/ddl_purge.test b/mysql-test/suite/innodb/t/ddl_purge.test new file mode 100644 index 00000000000..60d17acead8 --- /dev/null +++ b/mysql-test/suite/innodb/t/ddl_purge.test @@ -0,0 +1,36 @@ +--source innodb_default_row_format.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB; + +--connect (con1,localhost,root,,test) +BEGIN; +INSERT INTO t0 SET pk=1; + +--connect (con2,localhost,root,,test) +BEGIN; +INSERT INTO t0 SET pk=2; + +--connection default +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged'; +send ALTER TABLE t1 FORCE; + +--connection con1 +SET DEBUG_SYNC='now WAIT_FOR prepared'; +INSERT INTO t1 SET pk=1; +COMMIT; +--disconnect con1 + +--connection con2 +UPDATE t1 SET b=1; +DELETE FROM t1; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL logged'; +--disconnect con2 + +--connection default +reap; +SET DEBUG_SYNC='RESET'; +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test new file mode 100644 index 00000000000..cc80198d24a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test @@ -0,0 +1,63 @@ +--source include/have_innodb.inc + +# +# MDEV-13206: INSERT ON DUPLICATE KEY UPDATE foreign key fail +# +set sql_mode=''; +set innodb_strict_mode=0; + +CREATE TABLE `v` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT v values (1); + +CREATE TABLE `vp` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `v_id` int(10) unsigned NOT NULL, + `p_id` int(10) unsigned NOT NULL, + `ppp` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`), + KEY `FK_vp_v` (`v_id`), + CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT vp VALUES (12, 1, 100, 'text12'); +INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`); +SELECT * FROM vp; +DROP TABLE vp, v; + +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); + +CREATE TABLE t2 ( + i int not null primary key, + vi int not null, + m int, + UNIQUE KEY (vi), + CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +SELECT * FROM t2; + +DROP TABLE t2,t1; + +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); + +CREATE TABLE t2 ( + i int not null primary key, + vi int not null, + m int, + KEY (vi), + CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +SELECT * FROM t2; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test new file mode 100644 index 00000000000..5cec9e1febf --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -0,0 +1,15 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +--echo # +--echo # Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +--echo # + +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), + key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +select * from t1; +drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test new file mode 100644 index 00000000000..534b4de87f7 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test @@ -0,0 +1,46 @@ +######## suite/innodb/t/innodb_bulk_create_index.test ##### +# # +# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index # +# The basic idea of bulk load is to build an index from bottom up # +# (also known as sorted index build). # +# Earlier index was create by repeatedly inserting records # +# Test scenario : # +# - Run bulk create index on 10K rows # +# - Run bulk create index on table with various row types # +# - Run DML and SELECT after bulk index creation # +# Creation: # +# 2014-06-19 Implemented this test as part of WL#7277 # +# # +###################################################################### + +-- source include/not_embedded.inc +-- source include/innodb_page_size_small.inc +-- source include/big_test.inc + +# Test Row Format: REDUNDANT. +let $row_format = REDUNDANT; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: COMPACT. +let $row_format = COMPACT; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: DYNAMIC. +let $row_format = DYNAMIC; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: COMPRESSED. +let $row_format = COMPRESSED; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Fill Factor: 10 +let $row_format = COMPACT; +SET GLOBAL innodb_fill_factor=10; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Fill Factor: 50 +let $row_format = COMPACT; +SET GLOBAL innodb_fill_factor=50; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +SET GLOBAL innodb_fill_factor=default; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test new file mode 100644 index 00000000000..83a12431802 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test @@ -0,0 +1,23 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Test Restart & Crash Recovery. +-- source include/big_test.inc +-- source include/innodb_page_size_small.inc + +# Test Row Format: REDUNDANT. +let $row_format = REDUNDANT; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: COMPACT. +let $row_format = COMPACT; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: DYNAMIC. +let $row_format = DYNAMIC; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: COMPRESSED. +let $row_format = COMPRESSED; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test new file mode 100644 index 00000000000..cffca0cc773 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test @@ -0,0 +1,75 @@ +# +# Test flush on error in bulk load to make sure we do a proper cleanup. +# Note: We flush all dirty pages before applying any online log in bulk load. +# + +-- source include/have_innodb.inc +-- source include/have_debug.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +SET @saved_dbug= @@SESSION.debug_dbug; +SET debug_dbug='+d,ib_index_build_fail_before_flush'; + +-- error ER_QUERY_INTERRUPTED +CREATE INDEX idx_id ON t1(id); + +CHECK TABLE t1; + +-- error ER_QUERY_INTERRUPTED +CREATE INDEX idx_title ON t1(title); + +CHECK TABLE t1; + +-- error ER_QUERY_INTERRUPTED +CREATE FULLTEXT INDEX fidx_title ON t1(title); + +CHECK TABLE t1; + +-- error ER_QUERY_INTERRUPTED +ALTER TABLE t1 ADD COLUMN content TEXT, FORCE; + +CHECK TABLE t1; + +SET debug_dbug= @saved_dbug; + +INSERT INTO t1 VALUES(10001, 10001, 'a10000'); + +-- error ER_DUP_ENTRY +ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title); + +CHECK TABLE t1; + +-- error ER_DUP_ENTRY +ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title); + +CHECK TABLE t1; + +DROP TABLE t1; + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test new file mode 100644 index 00000000000..5b4eaae7557 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test @@ -0,0 +1,182 @@ +######## suite/innodb/t/innodb_wl7277_1.test ##### +# # +# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index # +# The basic idea of bulk load is to build an index from bottom up # +# (also known as sorted index build). # +# Earlier index was create by repeatedly inserting records # +# Test scenario : # +# - Run bulk create index on replication setup # +# - Run bulk create on partitioned table and see its replictaed # +# to slave # +# Creation: # +# 2014-06-19 Implemented this test as part of WL#7277 # +# # +###################################################################### + +--source include/not_embedded.inc +-- source include/have_innodb.inc +-- source include/have_partition.inc +-- source include/master-slave.inc + +-- connection master +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 100) DO + IF i%2 = 0 AND load_even = 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + IF i%2 != 0 AND load_even != 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ; + + + + +-- disable_query_log +# Load half records +CALL populate_t1(1); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 40 AND id > 30; +INSERT INTO t1 VALUES(38, 38, 'b38'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20; + +SELECT * FROM t1 WHERE id = 28; +SELECT * FROM t1 WHERE title = 'a28'; +SELECT * FROM t1 WHERE title = 'b28'; + +SELECT * FROM t1 WHERE id = 38; +SELECT * FROM t1 WHERE title = 'a38'; +SELECT * FROM t1 WHERE title = 'b38'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +-- disable_query_log +# Load half records (follow up load) +CALL populate_t1(0); +-- enable_query_log +SELECT COUNT(*) FROM t1; + + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +# Create partition table +CREATE TABLE t_part ( + class INT , + id INT , + title VARCHAR(30) + ) ENGINE=InnoDB + PARTITION BY RANGE(id) + SUBPARTITION BY KEY(id) + SUBPARTITIONS 4 + ( + PARTITION p0 VALUES LESS THAN (5000), + PARTITION p1 VALUES LESS THAN (MAXVALUE) + ); +INSERT INTO t_part SELECT * FROM t1; +ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10)); + +SELECT * FROM t_part WHERE id = 10; +SELECT * FROM t_part WHERE title = 'a10'; + +SELECT * FROM t_part WHERE id = 20; +SELECT * FROM t_part WHERE title = 'a20'; + +SELECT * FROM t_part WHERE id = 30; +SELECT * FROM t_part WHERE title = 'a30'; + +SELECT * FROM t_part WHERE id = 101; +SELECT * FROM t_part WHERE title = 'a101'; + + +--source include/sync_slave_sql_with_master.inc +-- connection slave +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t_part; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t_part; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + + + +SELECT * FROM t_part WHERE id = 10; +SELECT * FROM t_part WHERE title = 'a10'; + +SELECT * FROM t_part WHERE id = 20; +SELECT * FROM t_part WHERE title = 'a20'; + +SELECT * FROM t_part WHERE id = 30; +SELECT * FROM t_part WHERE title = 'a30'; + +SELECT * FROM t_part WHERE id = 101; +SELECT * FROM t_part WHERE title = 'a101'; + + +-- connection master +DROP PROCEDURE populate_t1; +DROP TABLE t1; +DROP TABLE t_part; +--source include/rpl_end.inc diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test new file mode 100644 index 00000000000..d04dd59f7e7 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test @@ -0,0 +1,148 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +-- source include/innodb_page_size_small.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 1000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +SELECT @@innodb_fill_factor; + +# Test Compact Table +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 500; +SELECT * FROM t1 WHERE title = 'a500'; + +SELECT * FROM t1 WHERE id = 1000; +SELECT * FROM t1 WHERE title = 'a1000'; + +SELECT * FROM t1 WHERE id = 1010; +SELECT * FROM t1 WHERE title = 'a1010'; + +DROP TABLE t1; + +# Test Blob +CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +SET GLOBAL innodb_file_per_table=default; + +# Test Compressed Table +SET GLOBAL innodb_file_per_table=1; + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 500; +SELECT * FROM t1 WHERE title = 'a500'; + +SELECT * FROM t1 WHERE id = 1000; +SELECT * FROM t1 WHERE title = 'a1000'; + +SELECT * FROM t1 WHERE id = 1010; +SELECT * FROM t1 WHERE title = 'a1010'; + +DROP TABLE t1; + +# Test Compression & Blob +CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +SET GLOBAL innodb_file_per_table=default; + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.combinations b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations new file mode 100644 index 00000000000..f3bc2cc0c25 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations @@ -0,0 +1,4 @@ +[redundant] +innodb_default_row_format=redundant +[dynamic] +innodb_default_row_format=dynamic diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.inc b/mysql-test/suite/innodb/t/innodb_default_row_format.inc new file mode 100644 index 00000000000..15c61dc6342 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_default_row_format.inc @@ -0,0 +1,2 @@ +# See also innodb_default_row_format.combinations +--source include/have_innodb.inc diff --git a/mysql-test/suite/innodb/t/innodb_stats_debug.test b/mysql-test/suite/innodb/t/innodb_stats_debug.test new file mode 100644 index 00000000000..cd41c0b8fb0 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_stats_debug.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist"); + +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1; +SET @save_debug= @@SESSION.debug_dbug; +SET debug_dbug= '+d,stats_index_error'; +ANALYZE TABLE t1; +SET debug_dbug= @save_debug; +ANALYZE TABLE t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test index 26367b8e6ae..47f363a4bb6 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test +++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test @@ -57,5 +57,5 @@ SELECT table_name FROM mysql.innodb_index_stats WHERE table_name='innodb_stats_drop_locked'; --disable_query_log -call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name"); +call mtr.add_suppression("Unable to delete statistics for table test\\.innodb_stats_drop_locked: Lock wait"); --enable_query_log diff --git a/mysql-test/suite/innodb/t/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test new file mode 100644 index 00000000000..60a3d83cd81 --- /dev/null +++ b/mysql-test/suite/innodb/t/truncate_restart.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1; +--connect (con1,localhost,root,,test) +SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; +--send +TRUNCATE TABLE t1; +--connection default +SET DEBUG_SYNC='now WAIT_FOR committed'; +--source include/restart_mysqld.inc +--disconnect con1 +SELECT COUNT(*) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt new file mode 100644 index 00000000000..9f283a9503f --- /dev/null +++ b/mysql-test/suite/innodb/t/update_time-master.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=10M diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test new file mode 100644 index 00000000000..e2213c5d9b7 --- /dev/null +++ b/mysql-test/suite/innodb/t/update_time.test @@ -0,0 +1,78 @@ +################################################################### +-- echo # +-- echo # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled +-- echo # correctly for InnoDB tables. +-- echo # + +-- source include/have_innodb.inc +-- source include/have_innodb_max_16k.inc +# restart does not work with embedded +-- source include/not_embedded.inc + +CREATE TABLE t (a INT) ENGINE=INNODB; + +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; + +INSERT INTO t VALUES (1); + +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; + +-- echo # We cant deterministically check that the saved value is correct, but +-- echo # at least we check that it is a timestamp not older than 2 minutes. +-- echo # Usually update_time and NOW() are equal below, but on heavily loaded +-- echo # machines NOW() could be younger. +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; + +CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; + +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; + +# evict table 't' by inserting as much data as the BP size itself +-- echo # INSERT lots of data in table 'big': begin +-- disable_query_log +BEGIN; +-- let $i = 10240 +while ($i) +{ + INSERT INTO big VALUES (REPEAT('a', 1024)); + dec $i; +} +COMMIT; +-- enable_query_log +-- echo # INSERT lots of data in table 'big': end + +# confirm that all pages for table 't' have been evicted +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; + +# The result from this query will change once update_time becomes persistent +# (WL#6917). +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; + +DROP TEMPORARY TABLE big; + +-- echo # Test the behavior after restart with a prepared XA transaction + +XA START 'xatrx'; +INSERT INTO t VALUES (5); +XA END 'xatrx'; +XA PREPARE 'xatrx'; + +CONNECT (con1,localhost,root,,); + +call mtr.add_suppression("Found 1 prepared XA transactions"); +FLUSH TABLES; + +--source include/kill_and_restart_mysqld.inc + +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; + +XA COMMIT 'xatrx'; + +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t'; + +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.result b/mysql-test/suite/mariabackup/log_checksum_mismatch.result new file mode 100644 index 00000000000..806a5e62cb6 --- /dev/null +++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.result @@ -0,0 +1,14 @@ +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# xtrabackup backup +FOUND 1 /Invalid log block checksum/ in backup.log +INSERT INTO t VALUES(2); +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.test b/mysql-test/suite/mariabackup/log_checksum_mismatch.test new file mode 100644 index 00000000000..f041b0aeedd --- /dev/null +++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.test @@ -0,0 +1,32 @@ +--source include/have_debug.inc + +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch > $backuplog; +--enable_result_log + +--let SEARCH_RANGE = 10000000 +--let SEARCH_PATTERN=Invalid log block checksum +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + + +INSERT INTO t VALUES(2); + + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +SELECT * FROM t; +DROP TABLE t; +rmdir $targetdir; + diff --git a/mysql-test/suite/mariabackup/mdev-14447.opt b/mysql-test/suite/mariabackup/mdev-14447.opt new file mode 100644 index 00000000000..5ac67e950c4 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.opt @@ -0,0 +1 @@ +--sequence --innodb-data-file-path=ibdata_first:3M;ibdata_second:1M:autoextend \ No newline at end of file diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result new file mode 100644 index 00000000000..3bca7eb5701 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.result @@ -0,0 +1,19 @@ +call mtr.add_suppression("InnoDB: New log files created"); +CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; +# Create full backup , modify table, then create incremental/differential backup +BEGIN; +INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; +COMMIT; +SELECT count(*) FROM t; +count(*) +100000 +# Prepare full backup, apply incremental one +# Restore and check results +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT count(*) FROM t; +count(*) +100000 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test new file mode 100644 index 00000000000..48f37646231 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.test @@ -0,0 +1,46 @@ +call mtr.add_suppression("InnoDB: New log files created"); + +let $basedir=$MYSQLTEST_VARDIR/tmp/backup; +let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; + +CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; + +echo # Create full backup , modify table, then create incremental/differential backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; +--enable_result_log +BEGIN; +INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; +COMMIT; +SELECT count(*) FROM t; + +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir; + +--disable_result_log +echo # Prepare full backup, apply incremental one; +exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir; +exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ; + +echo # Restore and check results; +let $targetdir=$basedir; +#-- source include/restart_and_restore.inc + +let $_datadir= `SELECT @@datadir`; +let $innodb_data_file_path=`SELECT @@innodb_data_file_path`; +echo # shutdown server; +--source include/shutdown_mysqld.inc +echo # remove datadir; +rmdir $_datadir; +echo # xtrabackup move back; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir "--innodb_data_file_path=$innodb_data_file_path" --target-dir=$targetdir; +echo # restart server; +--source include/start_mysqld.inc + + +--enable_result_log +SELECT count(*) FROM t; +DROP TABLE t; + +# Cleanup +rmdir $basedir; +rmdir $incremental_dir; diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result index cdf0b2b83dc..465c6c7d762 100644 --- a/mysql-test/suite/parts/r/optimizer.result +++ b/mysql-test/suite/parts/r/optimizer.result @@ -22,7 +22,7 @@ INSERT INTO t2 SELECT * FROM t1; # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by @@ -33,7 +33,7 @@ a MAX(b) # Should be no more than 4 reads. SHOW status LIKE 'handler_read_key'; Variable_name Value -Handler_read_key 4 +Handler_read_key 2 FLUSH status; SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; a MAX(b) diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result index ebbe9efc9df..436aa7bc236 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_view.result @@ -99,7 +99,7 @@ DROP VIEW v1; ERROR 42S02: Unknown VIEW: 'test.v1' DROP VIEW IF EXISTS v2; Warnings: -Note 4090 Unknown VIEW: 'test.v2' +Note 4091 Unknown VIEW: 'test.v2' # Syncing slave with master connection slave; SELECT * FROM v1; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result new file mode 100644 index 00000000000..75a22b78a32 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result @@ -0,0 +1,82 @@ +include/master-slave.inc +[connection master] +connection master; +SET @@SESSION.gtid_domain_id=0; +CREATE TABLE t (a INT); +connection slave; +connection slave; +call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog"); +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +connection master; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=111; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +connection slave; +SET @save.gtid_slave_pos=@@global.gtid_slave_pos; +SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", 11, "-", 111, "-", 1 + 1); +Warnings: +Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-2. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1236] +connection master; +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000002';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); +SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; +@@global.gtid_binlog_pos @@global.gtid_binlog_state +0-1-1 0-1-1 +connection slave; +SELECT @@global.gtid_slave_pos; +@@global.gtid_slave_pos +0-1-1,11-111-2 +include/start_slave.inc +==== BEGIN include/start_slave.inc ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +START SLAVE; +.==== BEGIN include/wait_for_slave_to_start.inc ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +..==== BEGIN include/wait_for_slave_io_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Last_IO_Errno'] +[connection slave] +...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +..==== END include/wait_for_slave_io_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +..==== BEGIN include/wait_for_slave_sql_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +Waiting until 'Slave_SQL_Running' = 'Yes' [timeout='300', $slave_error_param='1'] +[connection slave] +...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +..==== END include/wait_for_slave_sql_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +.==== END include/wait_for_slave_to_start.inc ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +==== END include/start_slave.inc ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +connection master; +INSERT INTO t SET a=1; +connection slave; +include/wait_for_slave_io_error.inc [errno=1236] +connection master; +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000004';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); +connection slave; +include/start_slave.inc +connection master; +SET @@SESSION.gtid_domain_id=0; +DROP TABLE t; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index 0aa718cd405..d0021ac610f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -226,7 +226,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Binlog_checkpoint # # master-bin.000002 master-bin.000002 # Gtid # # GTID #-#-# master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM master-bin.000002 # Gtid # # GTID #-#-# @@ -268,7 +267,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Gtid # # BEGIN GTID #-#-# diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index 46ad3cb9557..1bf5ec91ed4 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -226,7 +226,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Rotate # # master-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Binlog_checkpoint # # master-bin.000002 master-bin.000002 # Gtid # # GTID #-#-# master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB master-bin.000002 # Gtid # # GTID #-#-# @@ -268,7 +267,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB slave-bin.000002 # Gtid # # BEGIN GTID #-#-# diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 2849e5b7ae3..486c02eef71 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -17,7 +17,7 @@ insert into t1 values (b); insert into t1 values (unix_timestamp()); end| select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; @@ -28,10 +28,10 @@ declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end +end NONE connection slave; select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; @@ -42,7 +42,7 @@ declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end +end NONE connection master; set timestamp=1000000000; call foo(); @@ -128,7 +128,7 @@ show warnings; Level Code Message Error 1062 Duplicate entry '20' for key 'a' Warning 1196 Some non-transactional changed tables couldn't be rolled back -Note 4092 At line 4 in mysqltest1.foo4 +Note 4093 At line 4 in mysqltest1.foo4 select * from t2; a 20 @@ -137,19 +137,19 @@ select * from t2; a 20 select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin insert into t2 values(20),(20); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin insert into t2 values(20),(20); -end +end NONE connection master; drop procedure foo4; select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate connection slave; select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate connection master; drop procedure foo; drop procedure foo2; @@ -235,22 +235,22 @@ select fn3(); fn3() 0 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return 0; -end +end NONE select * from t1; a 1000000000 @@ -260,22 +260,22 @@ select * from t1; a 1000000000 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return 0; -end +end NONE connection master; delete from t2; alter table t2 add unique (a); @@ -291,7 +291,7 @@ end| do fn1(100); Warnings: Error 1062 Duplicate entry '100' for key 'a' -Note 4092 At line 3 in mysqltest1.fn1 +Note 4093 At line 3 in mysqltest1.fn1 Warning 1196 Some non-transactional changed tables couldn't be rolled back select fn1(20); ERROR 23000: Duplicate entry '20' for key 'a' diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index 6453538009a..0b3f9bfe350 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -222,7 +222,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Binlog_checkpoint # # master-bin.000002 master-bin.000002 # Gtid # # GTID #-#-# master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM master-bin.000002 # Gtid # # GTID #-#-# @@ -260,7 +259,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Gtid # # BEGIN GTID #-#-# diff --git a/mysql-test/suite/rpl/suite.opt b/mysql-test/suite/rpl/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/rpl/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test new file mode 100644 index 00000000000..622e66c5263 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test @@ -0,0 +1,98 @@ +# In case master's gtid binlog state is divergent from the slave's gtid_slave_pos +# slave may not be able to connect. +# For instance when slave is more updated in some of domains, see +# MDEV-12012 as example, the master's state may require adjustment. +# In a specific case of an "old" divergent domain, that is there +# won't be no more event groups from it generated, the states can be +# made compatible with wiping the problematic domain away. After that slave +# becomes connectable. +# +# Notice that the slave applied gtid state is not really required to +# be similarly cleaned in order for replication to flow. +# However this could lead to an expected error when the master +# resumes binlogging of such domain which the test demonstrate. + +--source include/master-slave.inc + +--connection master +# enforce the default domain_id binlogging explicitly +SET @@SESSION.gtid_domain_id=0; +CREATE TABLE t (a INT); +--sync_slave_with_master + +--connection slave +call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog"); + +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; + +--connection master +# create extra gtid domains for binlog state +--let $extra_domain_id=11 +--let $extra_domain_server_id=111 +--let $extra_gtid_seq_no=1 +--eval SET @@SESSION.gtid_domain_id=$extra_domain_id +--eval SET @@SESSION.server_id=$extra_domain_server_id +--eval SET @@SESSION.gtid_seq_no=$extra_gtid_seq_no +INSERT INTO t SET a=1; + +# +# Set up the slave replication state as if slave knows more events from the extra +# domain. +# +--connection slave +SET @save.gtid_slave_pos=@@global.gtid_slave_pos; +--eval SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", $extra_domain_id, "-", $extra_domain_server_id, "-", $extra_gtid_seq_no + 1) + +# unsuccessful attempt to start slave +START SLAVE IO_THREAD; +--let $slave_io_errno=1236 +--source include/wait_for_slave_io_error.inc + +--connection master +# adjust the master binlog state +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# with final removal of the extra domain +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) +SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; +--connection slave +SELECT @@global.gtid_slave_pos; +# start the slave sucessfully +--let rpl_debug=1 +--source include/start_slave.inc +--let rpl_debug=0 + +--connection master +# but the following gtid from the *extra* domain will break replication +INSERT INTO t SET a=1; + +# take note of the slave io thread error due to being dismissed +# extra domain at connection to master which tried becoming active; +# slave is to stop. +--connection slave +--let $errno=1236 +--source include/wait_for_slave_io_error.inc + +# let's apply the very same medicine +--connection master +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# with final removal of the extra domain +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) + +--connection slave +--source include/start_slave.inc + +# +# cleanup +# +--connection master +SET @@SESSION.gtid_domain_id=0; +DROP TABLE t; + +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 0400843c98a..a1789f02718 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -212,7 +212,7 @@ ERROR 42S02: 'test.t1' is not a SEQUENCE drop table t1; alter sequence if exists t1 minvalue=100; Warnings: -Note 4089 Unknown SEQUENCE: 'test.t1' +Note 4090 Unknown SEQUENCE: 'test.t1' alter sequence t1 minvalue=100; ERROR 42S02: Table 'test.t1' doesn't exist create sequence t1; diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result index 0a44dfe8931..b9394da6fcd 100644 --- a/mysql-test/suite/sql_sequence/create.result +++ b/mysql-test/suite/sql_sequence/create.result @@ -165,7 +165,7 @@ drop sequence t1; ERROR 42S02: 'test.t1' is not a SEQUENCE drop sequence if exists t1; Warnings: -Note 4089 Unknown SEQUENCE: 'test.t1' +Note 4090 Unknown SEQUENCE: 'test.t1' create sequence t1 start with 10 maxvalue=9; ERROR HY000: Sequence 'test.t1' values are conflicting create sequence t1 minvalue= 100 maxvalue=10; @@ -377,7 +377,7 @@ key key1 (next_not_cached_value) ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys) drop sequence if exists t1; Warnings: -Note 4089 Unknown SEQUENCE: 'test.t1' +Note 4090 Unknown SEQUENCE: 'test.t1' create sequence t1; create sequence t2; create table t3 (a int) engine=myisam; @@ -387,8 +387,8 @@ CREATE SEQUENCE s1; drop sequence s1; drop sequence if exists t1,t2,t3,t4; Warnings: -Note 4089 Unknown SEQUENCE: 'test.t3' -Note 4089 Unknown SEQUENCE: 'test.t4' +Note 4090 Unknown SEQUENCE: 'test.t3' +Note 4090 Unknown SEQUENCE: 'test.t4' drop table if exists t1,t2,t3; Warnings: Note 1051 Unknown table 'test.t1' @@ -414,9 +414,9 @@ CREATE TABLE t2 (a int); CREATE SEQUENCE s1; drop sequence if exists t1,t2,s1,s2; Warnings: -Note 4089 Unknown SEQUENCE: 'test.t1' -Note 4089 Unknown SEQUENCE: 'test.t2' -Note 4089 Unknown SEQUENCE: 'test.s2' +Note 4090 Unknown SEQUENCE: 'test.t1' +Note 4090 Unknown SEQUENCE: 'test.t2' +Note 4090 Unknown SEQUENCE: 'test.s2' drop table if exists t1,t2; CREATE TEMPORARY SEQUENCE s1; DROP SEQUENCE s1; diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index b5c800e858a..37491315c3e 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -26,6 +26,7 @@ select * from information_schema.system_variables 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', + 'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result new file mode 100644 index 00000000000..a7815bb3f78 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result @@ -0,0 +1,21 @@ +select @@global.slave_transaction_retry_errors; +@@global.slave_transaction_retry_errors +1213,1205,10,20,400 +select @@session.slave_transaction_retry_errors; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a GLOBAL variable +show global variables like 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1213,1205,10,20,400 +show session variables like 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1213,1205,10,20,400 +select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors'; +VARIABLE_NAME VARIABLE_VALUE +SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400 +select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors'; +VARIABLE_NAME VARIABLE_VALUE +SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400 +set global slave_transaction_retry_errors=1; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable +set session slave_transaction_retry_errors=1; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result new file mode 100644 index 00000000000..8be45f83341 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result @@ -0,0 +1,126 @@ +SET @start_global_value = @@global.slave_transaction_retry_interval; +SELECT @start_global_value; +@start_global_value +0 +'#--------------------FN_DYNVARS_149_01-------------------------#' +SET @@global.slave_transaction_retry_interval = 50; +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +'#--------------------FN_DYNVARS_149_02-------------------------#' +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval = 10; +@@global.slave_transaction_retry_interval = 10 +0 +'#--------------------FN_DYNVARS_149_03-------------------------#' +SET @@global.slave_transaction_retry_interval = 0; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +SET @@global.slave_transaction_retry_interval = 1; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1 +SET @@global.slave_transaction_retry_interval = 15; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +15 +SET @@global.slave_transaction_retry_interval = 1024; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1024 +SET @@global.slave_transaction_retry_interval = 2147483648; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '2147483648' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 2147483648*2-1; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 2147483649*2; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967298' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 4294967295; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +'#--------------------FN_DYNVARS_149_04-------------------------#' +SET @@slave_transaction_retry_interval = 2; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SET @@session.slave_transaction_retry_interval = 3; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SET @@local.slave_transaction_retry_interval = 4; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +'#------------------FN_DYNVARS_149_05-----------------------#' +SET @@global.slave_transaction_retry_interval = -1; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '-1' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +SET @@global.slave_transaction_retry_interval = 2147483649*2147483649; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4611686022722355201' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 65530.34; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = '100'; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = 7483649.56; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = ON; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = OFF; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +'#------------------FN_DYNVARS_149_06-----------------------#' +SET @@global.slave_transaction_retry_interval = 3000; +SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; +@@global.slave_transaction_retry_interval = VARIABLE_VALUE +1 +'#------------------FN_DYNVARS_149_07-----------------------#' +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; +count(VARIABLE_VALUE) +1 +'#------------------FN_DYNVARS_149_08-----------------------#' +SET @@global.slave_transaction_retry_interval = TRUE; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1 +SET @@global.slave_transaction_retry_interval = FALSE; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +'#---------------------FN_DYNVARS_149_09----------------------#' +SET @@global.slave_transaction_retry_interval = 60*60; +SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval; +@@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval +1 +'#---------------------FN_DYNVARS_149_10----------------------#' +SET slave_transaction_retry_interval = 2048; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SELECT slave_transaction_retry_interval; +ERROR 42S22: Unknown column 'slave_transaction_retry_interval' in 'field list' +SELECT @@slave_transaction_retry_interval; +@@slave_transaction_retry_interval +3600 +SET global slave_transaction_retry_interval = 99; +SET @@global.slave_transaction_retry_interval = @start_global_value; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 385ecb4e4e6..b4e449ab241 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -899,7 +900,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated. +VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3188,20 +3189,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index b27c493c6c4..8b0749810e9 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1176,10 +1176,19 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping + VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 @@ -4426,7 +4426,7 @@ + GLOBAL_VALUE_ORIGIN COMPILE-TIME + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors + NUMERIC_MIN_VALUE 0 + NUMERIC_MAX_VALUE 3600 +@@ -4257,7 +4257,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1188,7 +1197,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4485,7 +4485,7 @@ +@@ -4316,7 +4316,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1197,7 +1206,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4790,7 +4790,7 @@ +@@ -4621,7 +4621,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1206,7 +1215,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4888,7 +4888,7 @@ +@@ -4719,7 +4719,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1215,7 +1224,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -4902,7 +4902,7 @@ +@@ -4733,7 +4733,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1224,7 +1233,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -4972,7 +4972,7 @@ +@@ -4761,7 +4761,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1233,7 +1242,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4986,7 +4986,7 @@ +@@ -4775,7 +4775,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1242,7 +1251,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -5191,15 +5191,15 @@ +@@ -4980,15 +4980,15 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TMP_DISK_TABLE_SIZE @@ -1262,7 +1271,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5213,7 +5213,7 @@ +@@ -5002,7 +5002,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 1024 @@ -1271,7 +1280,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5227,7 +5227,7 @@ +@@ -5016,7 +5016,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1280,7 +1289,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5238,7 +5238,7 @@ +@@ -5027,7 +5027,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1289,7 +1298,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -5252,7 +5252,7 @@ +@@ -5041,7 +5041,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1298,7 +1307,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -5350,7 +5350,7 @@ +@@ -5139,7 +5139,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1307,7 +1316,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -5455,7 +5455,7 @@ +@@ -5243,7 +5243,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1316,7 +1325,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -5468,7 +5468,7 @@ +@@ -5256,7 +5256,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1325,7 +1334,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5478,7 +5478,7 @@ +@@ -5266,7 +5266,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1334,7 +1343,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5573,7 +5573,7 @@ +@@ -5351,7 +5351,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 0e6e87619e7..24d3e897bb0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -927,7 +928,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated. +VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3398,20 +3399,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT @@ -4399,13 +4386,41 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping +VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SLAVE_TRANSACTION_RETRY_ERRORS +SESSION_VALUE NULL +GLOBAL_VALUE 1213,1205 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Tells the slave thread to retry transaction for replication when a query event returns an error from the provided list. Deadlock and elapsed lock wait timeout errors are automatically added to this list +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL +SESSION_VALUE NULL +GLOBAL_VALUE 0 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 3600 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_TYPE_CONVERSIONS SESSION_VALUE NULL GLOBAL_VALUE diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt new file mode 100644 index 00000000000..a93f9f02f70 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt @@ -0,0 +1 @@ +--slave_transaction_retry_errors="10,20, 5000, 400" diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test new file mode 100644 index 00000000000..aa2299cf815 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test @@ -0,0 +1,19 @@ +--source include/not_embedded.inc +# +# only global +# +select @@global.slave_transaction_retry_errors; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.slave_transaction_retry_errors; +show global variables like 'slave_transaction_retry_errors'; +show session variables like 'slave_transaction_retry_errors'; +select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors'; +select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors'; + +# +# show that it's read-only +# +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set global slave_transaction_retry_errors=1; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set session slave_transaction_retry_errors=1; diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test new file mode 100644 index 00000000000..4d8d55901d1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test @@ -0,0 +1,190 @@ +--source include/not_embedded.inc +# +# only global +# +####### mysql-test\t\slave_transaction_retry_interval_basic.test ############## +# # +# Variable Name: slave_transaction_retry_interval # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 10 # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable # +# slave_transaction_retry_interval # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc + +################################################################### +# START OF slave_transaction_retry_interval TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.slave_transaction_retry_interval; +SELECT @start_global_value; + +--echo '#--------------------FN_DYNVARS_149_01-------------------------#' +################################################################### +# Display the DEFAULT value of slave_transaction_retry_interval # +################################################################### + +SET @@global.slave_transaction_retry_interval = 50; +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval; + +--echo '#--------------------FN_DYNVARS_149_02-------------------------#' +################################################################### +# Check the DEFAULT value of slave_transaction_retry_interval # +################################################################### + +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval = 10; + +--echo '#--------------------FN_DYNVARS_149_03-------------------------#' +############################################################################### +# Change the value of slave_transaction_retry_interval to a valid value for +# GLOBAL Scope +############################################################################### + +SET @@global.slave_transaction_retry_interval = 0; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 1; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 15; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 1024; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483648; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483648*2-1; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483649*2; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 4294967295; +SELECT @@global.slave_transaction_retry_interval; + +--echo '#--------------------FN_DYNVARS_149_04-------------------------#' +############################################################################## +# Check if variable can be access with session scope # +############################################################################## + +--Error ER_GLOBAL_VARIABLE +SET @@slave_transaction_retry_interval = 2; + +--Error ER_GLOBAL_VARIABLE +SET @@session.slave_transaction_retry_interval = 3; + +--Error ER_GLOBAL_VARIABLE +SET @@local.slave_transaction_retry_interval = 4; + + +--echo '#------------------FN_DYNVARS_149_05-----------------------#' +############################################################################ +# Change the value of slave_transaction_retry_interval to an invalid value # +############################################################################ + +SET @@global.slave_transaction_retry_interval = -1; +SELECT @@global.slave_transaction_retry_interval; + +SET @@global.slave_transaction_retry_interval = 2147483649*2147483649; +SELECT @@global.slave_transaction_retry_interval; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = 65530.34; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = '100'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = 7483649.56; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = OFF; + +--echo '#------------------FN_DYNVARS_149_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SET @@global.slave_transaction_retry_interval = 3000; +SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; + + +--echo '#------------------FN_DYNVARS_149_07-----------------------#' +########################################################################### +# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES # +########################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; + + +--echo '#------------------FN_DYNVARS_149_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.slave_transaction_retry_interval = TRUE; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = FALSE; +SELECT @@global.slave_transaction_retry_interval; + + +--echo '#---------------------FN_DYNVARS_149_09----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + + +SET @@global.slave_transaction_retry_interval = 60*60; +SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval; + + +--echo '#---------------------FN_DYNVARS_149_10----------------------#' +############################################################################### +# Check if slave_transaction_retry_interval can be accessed without @@ sign +# and scope +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET slave_transaction_retry_interval = 2048; +--Error ER_BAD_FIELD_ERROR +SELECT slave_transaction_retry_interval; + +SELECT @@slave_transaction_retry_interval; + +#verifying another another syntax for setting value +SET global slave_transaction_retry_interval = 99; + +#################################### +# Restore initial value # +#################################### + +SET @@global.slave_transaction_retry_interval = @start_global_value; +SELECT @@global.slave_transaction_retry_interval; + +######################################################## +# END OF slave_transaction_retry_interval TESTS # +######################################################## diff --git a/mysql-test/suite/versioning/r/optimized.result b/mysql-test/suite/versioning/r/optimized.result index b28b867f8fc..4c86b6abbc2 100644 --- a/mysql-test/suite/versioning/r/optimized.result +++ b/mysql-test/suite/versioning/r/optimized.result @@ -17,59 +17,59 @@ a b b+0 1 NULL NULL 3 NULL NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6); a b 1 NULL 3 NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select count(*) from t group by b for system_time as of timestamp now(6); count(*) 2 Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b asc; a b 1 NULL 3 NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b desc; a b 1 NULL 3 NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t group by a having a=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t group by b having b=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t where b=2 for system_time as of timestamp now(6); a Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t where b=NULL for system_time as of timestamp now(6); a Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t where b is NULL for system_time as of timestamp now(6); a 1 3 Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6); count(*) b Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a, b from t; a b 1 2 @@ -78,29 +78,29 @@ select count(*) from t for system_time as of timestamp now(6) group by b; count(*) 2 Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) group by b having b=2; a b Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=2; a Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=NULL; a Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b is NULL; a 1 3 Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL; count(*) b Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query create or replace table t ( a int, b int not null without system versioning @@ -111,12 +111,12 @@ a b 1 NULL 3 NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) where b is NULL; a b 1 NULL 3 NULL Warnings: -Warning 4108 Attempt to read unversioned field `b` in historical query -Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4112 Attempt to read unversioned field `b` in historical query drop table t; diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 629004840c1..432165d916a 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -72,7 +72,7 @@ ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERS alter table t1 add partition ( partition p1 versioning); Warnings: -Warning 4111 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. +Warning 4115 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -209,7 +209,7 @@ x 2 delete from t1; Warnings: -Note 4112 Switching from partition `p0` to `p1` +Note 4116 Switching from partition `p0` to `p1` select * from t1 partition (p0) for system_time all; x 1 @@ -219,7 +219,7 @@ x insert into t1 values (3); delete from t1; Warnings: -Warning 4110 Using full partition `p1`, need more VERSIONING partitions! +Warning 4114 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p1) for system_time all; x 2 @@ -252,7 +252,7 @@ x insert into t1 values (4); delete from t1; Warnings: -Note 4112 Switching from partition `p0` to `p1` +Note 4116 Switching from partition `p0` to `p1` select * from t1 partition (p1) for system_time all; x 4 @@ -274,8 +274,8 @@ x 2 delete from t1; Warnings: -Note 4112 Switching from partition `p0` to `p1` -Warning 4110 Using full partition `p1`, need more VERSIONING partitions! +Note 4116 Switching from partition `p0` to `p1` +Warning 4114 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p0sp0) for system_time all; x 1 diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm index b6c5bf15ca1..03e23b8d7cb 100644 --- a/mysql-test/suite/wsrep/suite.pm +++ b/mysql-test/suite/wsrep/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index e8589fa9242..1ae9b13e050 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -7,7 +7,7 @@ drop table if exists t1; # Add the datadir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; # # Check that --bootstrap reads from stdin # diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 17e8be839a8..b514dbb5b2d 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -587,3 +587,140 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES +--echo # + +SET sql_mode=STRICT_ALL_TABLES; +SELECT CAST('xxx' AS CHAR(1)); + +CREATE OR REPLACE TABLE t1 (a VARCHAR(1)); +INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(3)); +INSERT INTO t1 VALUES ('xxx'); +UPDATE t1 SET a=CAST(a AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +DELIMITER ;$$ + + +--echo # Conversion problems still escalate warnings to errors (without right truncation) + +DELIMITER $$; +--error ER_CANNOT_CONVERT_CHARACTER +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + + +--echo # Conversion problems still escalate warnings to errors (with right truncation) + +DELIMITER $$; +--error ER_CANNOT_CONVERT_CHARACTER +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + + +--echo # CAST(number AS CHAR) escalates warnings to errors on truncation + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (CAST(123 AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=CAST(123 AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a VARCHAR(10); + SET a=CAST(123 AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + + +--echo # CAST(temporal AS CHAR) escalates warnings to errors on truncation + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a VARCHAR(10); + SET a=CAST(TIME'10:20:30' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +SET sql_mode=DEFAULT; diff --git a/mysql-test/t/cte_grant.test b/mysql-test/t/cte_grant.test index 44fd4a0bc6e..c6627c05829 100644 --- a/mysql-test/t/cte_grant.test +++ b/mysql-test/t/cte_grant.test @@ -76,4 +76,55 @@ select * from mysqltest.v3; connection root; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; -drop database mysqltest; \ No newline at end of file +drop database mysqltest; + +--echo # +--echo # MDEV-13453: privileges checking for CTE +--echo # + +create database db; +use db; +create table t1 (i int); +insert into t1 + values (3), (7), (1), (4), (2), (3), (1); + +create table t2 (a int, b int); +insert into t2 + values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); + +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; + +--connect (con1,localhost,foo,,) +use db; +with cte as (select * from t1 where i < 4) + select * from cte; +with cte as (select * from t1 where i < 4 group by i) + select * from cte; +with cte as (select * from t1 where i < 4) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +with cte as (select * from t1 where i < 4 group by i) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; + +--error ER_COLUMNACCESS_DENIED_ERROR +with cte as (select b from t2 where a < 4) + select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +with cte as (select a from t2 where a < 4) + select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; + +--connection default +revoke SELECT on db.t1 from foo@localhost; + +--connection con1 + +--error ER_TABLEACCESS_DENIED_ERROR +with cte as (select * from t1 where i < 4) + select * from cte; + +# Cleanup +--disconnect con1 + +--connection default +drop database db; +drop user foo@localhost; diff --git a/mysql-test/t/custom_aggregate_functions.test b/mysql-test/t/custom_aggregate_functions.test new file mode 100644 index 00000000000..20fcc35f39f --- /dev/null +++ b/mysql-test/t/custom_aggregate_functions.test @@ -0,0 +1,773 @@ +create table t2 (sal int(10)); +delimiter |; + +create aggregate function f1(x INT) returns int +begin + declare continue handler for not found return 0; + loop + fetch group next row; + insert into t2 (sal) values (x); + end loop; +end| + +delimiter ;| + +create table t1 (sal int(10),id int(10)); +INSERT INTO t1 (sal,id) VALUES (5000,1); +INSERT INTO t1 (sal,id) VALUES (2000,1); +INSERT INTO t1 (sal,id) VALUES (1000,1); +select f1(sal) from t1 where id>= 1; +select * from t2; +drop table t2; +drop function f1; + +delimiter |; +--error ER_INVALID_AGGREGATE_FUNCTION +create aggregate function f1(x INT) returns INT +begin + insert into t1(sal) values (x); + return x; +end| + +--error ER_NOT_AGGREGATE_FUNCTION +create function f1(x INT) returns INT +begin + set x=5; + fetch group next row; +return x+1; +end | + +create aggregate function f1(x INT) returns INT +begin + declare continue handler for not found return x; + loop + fetch group next row; + end loop; +end | +delimiter ;| + +select f1(1); +show create function f1; +--error ER_PARSE_ERROR +alter function f1 aggregate none; +show create function f1; +select f1(1); +drop function f1; + + +delimiter |; + + +create aggregate function f2(i int) returns int +begin + FEtCH GROUP NEXT ROW; + if i <= 0 then + return 0; + elseif i = 1 then + return (select count(*) from t1 where id = i); + else + return (select count(*) + f2( i - 1) from t1 where id = i); + end if; +end| +select f2(1)| +# Since currently recursive functions are disallowed ER_SP_NO_RECURSION +# error will be returned, once we will allow them error about +# insufficient number of locked tables will be returned instead. +--error ER_SP_NO_RECURSION +select f2(2)| +--error ER_SP_NO_RECURSION +select f2(3)| +drop function f2| + +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini+x; + fetch group next row; + end loop; +end| + + +delimiter ;| + +select f1(10); +select f1(sal) from t1; +select f1(sal) from t1 where 1=0; +drop function f1; +delimiter |; + + +#WITHOUT RETURN STATEMENT IN AGGREGATE FUNCTIONS +--error 1320 +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; +end| + +#without handler +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; + return -1; +end| + +--error 1329 +select f1(sal) from t1| +drop function f1| + +#without loop +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found return mini; + FETCH GROUP NEXT ROW; + set mini = mini + x; +end| + +--error 1321 +select f1(sal) from t1| +drop function f1| + + +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found set mini=-1; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; + return 0; +end| + +--error 1321 +select f1(sal) from t1| +drop function f1| +drop table t1| + +delimiter ;| + +# primary indexing + +create table t1 (sal int, id int, val int, counter int, primary key(id)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| + +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; + +#unique index + +create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val)); + +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); + +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; + +# compound indexing +create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter)); + +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; +drop function f1; + +# prepared statement with aggregate functions + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +create aggregate function f2() returns double +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z = z+1; + end loop; +end| + +delimiter ;| + +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); + +prepare test from "select f2() from t1 where id>= ?"; +set @param= 2; +execute test using @param; +execute test using @param; +execute test using @param; +execute test using @param; +set @param= 1; +execute test using @param; +set @param= 3; +execute test using @param; +set @param= 4; +execute test using @param; +deallocate prepare test; + +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +execute test using @param; +execute test using @param; +execute test using @param; +set @param= 1; +execute test using @param; +set @param= 3; +execute test using @param; +set @param= 4; +execute test using @param; +set @param= 5; +execute test using @param; +deallocate prepare test; + +drop function f2; + +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +drop function f1; + +create function f1(x int) returns int + return -1; + +execute test using @param; + +drop function f1; + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| + +execute test using @param; + +deallocate prepare test; + +drop table t1; +drop function f1; + +create table t1 (sal int, id int, val varchar(10), counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4); + +create table t2 (sal int, id int, val int, counter int); +INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +delimiter |; + +create aggregate function f1(x double) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +create aggregate function f2(x INT) returns CHAR(10) + begin + declare mini INT default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini + x; + end loop; +end| + +create aggregate function f3(x INT) returns CHAR(10) + begin + declare mini INT default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini + x; + fetch group next row; + set mini= mini - x; + end loop; +end| + +create aggregate function f4(x INT, y varchar(10)) returns varchar(1000) +begin + declare str varchar(1000) default ''; + declare continue handler for not found return str; + loop + fetch group next row; + set str= concat(str,y); + end loop; +end| + +create aggregate function f5(x INT) returns varchar(1000) +begin + declare z int default 0; + DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2; + declare continue handler for not found return 0; + loop + fetch group next row; + set z = z+x; + end loop; +end| + + + +create function f6(x int) returns int +return (select f1(sal) from t1)| + +delimiter ;| + +select f1(sal) from t1; + +# group by test + +--sorted_result +select f1(sal) from t1 where id>= 1 group by counter; + +# multiple fetch statements in the loop +--sorted_result +select f3(sal) from t1; + +# incorrect column type +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +select f2(val) from t1; + +#subquery +--sorted_result +select val, id, c from (select f1(sal) as c from t2) as t1, t2; + +#multiple calls to an aggregate function +--sorted_result +select f1(sal),f1(val), f1(id), f1(sal) from t2; + +#string type, also more than one areguments +--sorted_result +select f4(sal, val) from t1; + +#select f1((select sal from t2 where id= 1)) from t1; +--sorted_result +select c from (select f1(sal) as c from t2) as t1; + +# this fails as more than one row is returned +#select f1((select val from t2 where id > 1)) from t1; + +select f1((select val from t2 where 0 > 1)) from t1; +select f1((select val from t2 where id= 1)) from t1; + +select f5(sal) from t1; + +SELECT f1(sal)*f1(sal) FROM t1; + +--sorted_result +SELECT (SELECT f1(sal) FROM t1) FROM t2; +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select f1(sal), f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select f1(sal), f1(sal) from t1 where id>= 1 group by id ; +--sorted_result +select f1(sal) from t1 where id>= 1 group by id ; +select f1(sal) from t1 where id>= 1 order by counter; +select f1(sal) from t1 where id>= 1 group by id order by counter; +select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter; +select id, f1(sal) from t1 where id>= 1 group by id order by counter; +drop table t1; +drop table t2; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; + + +delimiter |; + +# aggregate AND function + +create aggregate function f1(x INT) returns INT +begin + declare z double default 1000; + declare continue handler for not found return z; + loop + fetch group next row; + set z= (z&x); + end loop; +end| + +delimiter ;| + +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0); +INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2); + +select f1(sal) from t1 where id>= 1; +drop function f1; + +delimiter |; + +# aggregate AVG function + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare count double default 0; + declare continue handler for not found return z/count; + loop + fetch group next row; + set z= z+x; + set count= count+1; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate MAX function + +create aggregate function f1(x INT) returns INT +begin + declare maxi INT default -1; + declare continue handler for not found return maxi; + loop + fetch group next row; + if maxi < x then + set maxi= x; + end if; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate MIN function + +create aggregate function f1(x INT) returns double +begin + declare mini INT default 100000; + declare continue handler for not found return mini; + loop + fetch group next row; + if mini > x then + set mini = x; + end if; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate XOR function + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z^x; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate SUM function + +create aggregate function f1(x INT) returns INT +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +delimiter |; + + +create aggregate function f2() returns INT +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+1; + end loop; +end| + +delimiter ;| + +# no parameters +select f2() from t1; + +create table t2 (sal int, id int); +INSERT INTO t2 (sal, id) VALUES (NULL, 1); +INSERT INTO t2 (sal, id) VALUES (2000, 1); +INSERT INTO t2 (sal, id) VALUES (3000, 1); + +# null values +select f1(sal) from t2; + +# no tables +select f1(1); + +# aggregate function called from regular functions +create function f3() returns int +return (select f1(sal) from t1); +select f3(); + +create function f4() returns INT +return 1; + +# regular functions called from aggregate functions +delimiter |; +create aggregate function f5() returns INT +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+f3(); + end loop; +end| + +delimiter ;| +select f5() from t2; +delimiter |; + +# aggregate functions called from aggregate functions +create aggregate function f6(x INT) returns INT +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + if x then + set z= z+(select f1(sal) from t1); + end if; + end loop; +end| + +delimiter ;| +select f6(sal) from t2; + +# GROUP BY AND ORDER BY +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select counter, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select val, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select counter, f1(sal) from t1 where id>= 1 group by id order by counter; +--sorted_result +select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter; +--sorted_result +select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc; + + +##### insert aggregate function value into a table ###### +create table t3 (i int); +INSERT INTO t3 (i) select f1(sal) from t1; +select * from t3; + +delimiter |; + +create aggregate function f7(x INT) returns INT +begin + declare z int default 0; + DECLARE done BOOLEAN DEFAULT FALSE; + DECLARE a,b,c INT; + DECLARE cur1 CURSOR FOR SELECT id FROM test.t2; + declare continue handler for not found return z; + + outer_loop: LOOP + FETCH GROUP NEXT ROW; + set z= z+x; + inner_block: begin + DECLARE cur2 CURSOR FOR SELECT id FROM test.t2; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cur2; + + read_loop: LOOP + FETCH cur2 INTO a; + IF done THEN + CLOSE cur2; + LEAVE read_loop; + END IF; + END LOOP read_loop; + + end inner_block; + END LOOP outer_loop; + +end| + +delimiter ;| +select f7(sal) from t1; + +drop table t1; +drop table t2; +drop table t3; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 1038fc0f6d0..5cbc6969e02 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -915,3 +915,76 @@ DROP TABLE t1; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +# +# MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT() +# +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); + + +select grp,group_concat(c) from t1 group by grp; +select grp,group_concat(c limit 1 ) from t1 group by grp; +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c limit 1000) from t1 group by grp; +select group_concat(grp limit 0) from t1; +--error ER_PARSE_ERROR +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c order by a) from t1 group by grp; +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp; +select grp,group_concat(c order by c) from t1 group by grp; +select grp,group_concat(c order by c limit 2) from t1 group by grp; +select grp,group_concat(c order by c desc) from t1 group by grp; +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; + +drop table t1; + +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; + +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +set @x=2; +execute STMT using @x; +set @x=1000; +execute STMT using @x; +set @x=0; +execute STMT using @x; +set @x="adasfa"; +--error ER_INVALID_VALUE_TO_LIMIT +execute STMT using @x; +set @x=-1; +--error ER_WRONG_ARGUMENTS +execute STMT using @x; +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +drop table t2; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 47ed0c3ca75..5a5d06d456d 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -9,6 +9,7 @@ select json_value('{"key1":123}', '$.key2'); select json_value('{"key1":123}', '$.key1'); select json_value('{"key1":[1,2,3]}', '$.key1'); select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); +select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z'); select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1'); @@ -377,6 +378,11 @@ SELECT JSON_OBJECT("user","Jožko MrkviÄká") as json_data; select json_contains_path('{"foo":"bar"}', 'one', '$[]'); +# +# MDEV-13971 crash in skip_num_constant. +# +select JSON_VALID(0x36f0c8dccd83c5eac156da); + --echo # --echo # Start of 10.3 tests --echo # diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test index 5e695fbca9c..b91ef235fd0 100644 --- a/mysql-test/t/gis-json.test +++ b/mysql-test/t/gis-json.test @@ -40,6 +40,10 @@ SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10); SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1); SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); +SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a; +SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; +SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 9c306de0e3f..dcd56c57650 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -867,7 +867,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE'); select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; delete from proc where name=''; use test; diff --git a/mysql-test/t/intersect.test b/mysql-test/t/intersect.test index 99a54606291..98b6d1eb1c6 100644 --- a/mysql-test/t/intersect.test +++ b/mysql-test/t/intersect.test @@ -190,4 +190,19 @@ show create view v1; drop view v1; drop tables t1,t2,t3; +--echo # +--echo # MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery +--echo # +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); +SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 ); + +select i from t where + exists ((select 6 as r from dual having t.i <> 6) + intersect + (select 3 from dual having t.i <> 3)); + +drop table t; + + --echo # End of 10.3 tests diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index e5bc36f6851..6988b2a8e9b 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -589,3 +589,9 @@ eval SET GLOBAL SERVER_ID = $old_server_id; --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id.binlog --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id_checksum.binlog --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_none.binlog + +# +# MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version +# +replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/; +exec $MYSQL_BINLOG --version; diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 1613f8e7a4f..f859d7dd9d6 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -19,7 +19,7 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help perl; # Variables which we don't want to display in the result file since # their paths may vary: - @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir + @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 8722401ccae..914911648b2 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2106,3 +2106,46 @@ INSERT INTO t1 VALUES (1),(2),(3); SELECT DISTINCT pk FROM t1 GROUP BY 'foo'; SELECT DISTINCT pk FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on +--echo # + +CREATE TABLE books ( + id int(16) NOT NULL AUTO_INCREMENT, + library_id int(16) NOT NULL DEFAULT 0, + wings_id int(12) NOT NULL DEFAULT 0, + scheduled_for_removal int(1) DEFAULT 0, + PRIMARY KEY (id), + KEY library_idx (library_id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1); + +CREATE TABLE wings ( + id int(11) NOT NULL AUTO_INCREMENT, + department_id int(11) DEFAULT NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT INTO wings VALUES (505,11745),(707,11768); + +let $q= +SELECT wings.id as wing_id, wings.department_id FROM wings + WHERE wings.id IN ( SELECT books.wings_id FROM books + WHERE books.library_id = 8663 AND + books.scheduled_for_removal=0 ) +ORDER BY wings.id; + +SET @save_optimizer_switch=@@optimizer_switch; + +SET optimizer_switch='orderby_uses_equalities=off'; +eval $q; + +SET optimizer_switch='orderby_uses_equalities=on'; +eval $q; +eval explain extended $q; + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE books, wings; diff --git a/mysql-test/t/order_by_innodb.test b/mysql-test/t/order_by_innodb.test index 097eddd24f1..0debb777749 100644 --- a/mysql-test/t/order_by_innodb.test +++ b/mysql-test/t/order_by_innodb.test @@ -61,3 +61,50 @@ from t1 where key1<3 or key2<3; drop table t0, t1; + +--echo # +--echo # MDEV-14071: wrong results with orderby_uses_equalities=on +--echo # (duplicate of MDEV-13994) +--echo # + +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), + (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); +INSERT INTO t1 VALUES + (77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0), + (106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0), + (268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0); + +INSERT INTO t2 VALUES + (127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5), + (375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8), + (498,9),(656,8),(656,9); +INSERT INTO t3 VALUES + (4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine'); + +let $q1= +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +let $q2= +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; + +SET @save_optimizer_switch=@@optimizer_switch; + +SET optimizer_switch='orderby_uses_equalities=off'; +eval $q1; +eval $q2; + +SET optimizer_switch='orderby_uses_equalities=on'; +eval $q1; +eval $q2; + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 608c8812e01..2357b806a18 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -445,6 +445,7 @@ INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5), (1,19,1); SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); ALTER TABLE t1 DROP INDEX b; SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); @@ -2812,6 +2813,7 @@ INSERT INTO t1 VALUES (123,123,'2001-04-14','address123','city123',40,51), (257,257,'2010-03-06','address257','city257',40,47); --enable_query_log +--sorted_result select * from t1 where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21'; select * from t1 IGNORE INDEX(dob, weeks_worked_last_year, hours_worked_per_week) where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21'; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index ec55b9c9d21..2a16a807542 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4476,3 +4476,94 @@ EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT; --error ER_SP_NOT_VAR_ARG EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +--echo # + +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; + +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; + +--echo # +--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +--echo # + +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +--echo # + +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +--echo # + +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 29b6764ebc6..1f2f5191f0a 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -758,3 +758,172 @@ DELIMITER ;$$ SHOW PROCEDURE CODE p1; DROP PROCEDURE p1; DROP TABLE t1; + +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + +--echo # Integer range FOR loop + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR i IN 1..3 + DO + SELECT i; + END FOR; +END; +$$ +DELIMITER ;$$ +CALL p1; +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Nested integer range FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + fori: + FOR i IN 1..3 + DO + forj: + FOR j IN 1..3 + DO + IF i = 3 THEN + LEAVE fori; + END IF; + IF j = 3 THEN + LEAVE forj; + END IF; + SELECT i,j; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ +CALL p1; +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Explicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + FOR rec1 IN cur1 + DO + SELECT rec1.a, rec1.b; + SET rec1.a= 11; + SET rec1.b= 'b1'; + SELECT rec1.a, rec1.b; + END FOR; + FOR rec0 IN cur0 + DO + SET rec0.a= 10; + SET rec0.b='b0'; + END FOR; + FOR rec2 IN cur2 + DO + SET rec2.a= 10; + SET rec2.b='b0'; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Nested explicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + FOR rec0 IN cur0 + DO + BEGIN + DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b; + SET rec0.a= 11; + SET rec0.b= 'b0'; + FOR rec1 IN cur1 + DO + SET rec1.a= 11; + SET rec1.b= 'b1'; + BEGIN + DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b; + FOR rec2 IN cur2 + DO + SET rec2.a=12; + SET rec2.b='b2'; + END FOR; + END; + END FOR; + END; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Implicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) + DO + SELECT rec1.a, rec1.b; + SET rec1.a= 11; + SET rec1.b= 'b1'; + SELECT rec1.a, rec1.b; + END FOR; + FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) + DO + SET rec0.a= 10; + SET rec0.b='b0'; + END FOR; + FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) + DO + SET rec2.a= 10; + SET rec2.b='b0'; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + +--echo # Nested implicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) + DO + SET rec0.a= 11; + SET rec0.b= 'b0'; + FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) + DO + SET rec1.a= 11; + SET rec1.b= 'b1'; + FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) + DO + SET rec2.a=12; + SET rec2.b='b2'; + END FOR; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; diff --git a/mysql-test/t/sp-cursor.test b/mysql-test/t/sp-cursor.test index 394dc56556a..2e7a72cf8d0 100644 --- a/mysql-test/t/sp-cursor.test +++ b/mysql-test/t/sp-cursor.test @@ -474,3 +474,136 @@ DROP PROCEDURE p1; --echo # --echo # End of MDEV-12457 Cursors with parameters --echo # + + +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + +--echo # Explicit cursor + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR FOR SELECT * FROM t1; + FOR rec IN cur + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor with parameters + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa; + FOR rec IN cur(2) + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor + label + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR FOR SELECT * FROM t1; + forrec: + FOR rec IN cur + DO + SELECT rec.a AS a, rec.b AS b; + IF rec.a = 2 THEN + LEAVE forrec; + END IF; + END FOR forrec; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND" + +DELIMITER $$; +--error ER_SP_FETCH_NO_DATA +BEGIN NOT ATOMIC + DECLARE x INT; + DECLARE cur CURSOR FOR SELECT 1 AS x; + FOR rec IN cur + DO + FETCH cur INTO x; + END FOR; +END; +$$ +DELIMITER ;$$ + + +--echo # Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND" + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE done INT DEFAULT 0; + DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION + SELECT 2,'y2' UNION + SELECT 3,'y3'; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + forrec: + FOR rec IN cur + DO + SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH'; + FETCH cur INTO rec; + IF done THEN + SELECT 'NO DATA' AS `Explicit FETCH`; + LEAVE forrec; + ELSE + SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH'; + END IF; + END FOR; +END; +$$ +DELIMITER ;$$ + + +--echo # Implicit cursor + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + FOR rec IN (SELECT * FROM t1) + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Implicit cursor + label + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + forrec: + FOR rec IN (SELECT * FROM t1) + DO + SELECT rec.a AS a, rec.b AS b; + IF rec.a = 2 THEN + LEAVE forrec; + END IF; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index 31da235d906..0cd80bd5427 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -10,7 +10,7 @@ -- source include/not_embedded.inc # Supress warnings written to the log file -call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); +call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted"); call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); # Backup proc table diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index aa537d3596b..0e16948f438 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1746,7 +1746,7 @@ drop procedure bug15091; drop function if exists bug16896; --enable_warnings ---error ER_PARSE_ERROR +--error ER_INVALID_AGGREGATE_FUNCTION create aggregate function bug16896() returns int return 1; # diff --git a/mysql-test/t/sp-for-loop.test b/mysql-test/t/sp-for-loop.test new file mode 100644 index 00000000000..6350e9fb9d3 --- /dev/null +++ b/mysql-test/t/sp-for-loop.test @@ -0,0 +1,212 @@ +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + + +CREATE TABLE t1 (a INT); +DELIMITER /; +FOR i IN 1..3 +DO + INSERT INTO t1 VALUES (i); +END FOR; +/ +DELIMITER ;/ +SELECT * FROM t1; +DROP TABLE t1; + + +# Dots must have no delimiters in between + +DELIMITER /; +--error ER_PARSE_ERROR +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + FOR i IN lower_bound . . upper_bound + DO + NULL + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + lab: + FOR i IN lower_bound .. upper_bound + DO + SET total= total + i; + IF i = lim THEN + LEAVE lab; + END IF; + -- Bounds are calculated only once. + -- The below assignments have no effect on the loop condition + SET lower_bound= 900; + SET upper_bound= 1000; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(1, 3, 100) FROM DUAL; +SELECT f1(1, 3, 2) FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1() RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + FOR i IN 1 .. 5 + DO + SET total= total + 1000; + forj: + FOR j IN 1 .. 5 + DO + SET total= total + 1; + IF j = 3 THEN + LEAVE forj; -- End the internal loop + END IF; + END FOR; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1() FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1 (a INT, b INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + fori: + FOR i IN REVERSE a..1 + DO + SET total= total + i; + IF i = b THEN + LEAVE fori; + END IF; + END FOR; + RETURN total; +END +/ +DELIMITER ;/ +SELECT f1(3, 100) FROM DUAL; +SELECT f1(3, 2) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing labeled FOR LOOP statement + +DELIMITER /; +CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + la: + FOR ia IN 1 .. a + DO + SET total= total + 1000; + lb: + FOR ib IN 1 .. b + DO + SET total= total + 1; + IF ib = limitb THEN + LEAVE lb; + END IF; + IF ia = limita THEN + LEAVE la; + END IF; + END FOR lb; + END FOR la; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(1, 1, 1, 1) FROM DUAL; +SELECT f1(1, 2, 1, 2) FROM DUAL; +SELECT f1(2, 1, 2, 1) FROM DUAL; +SELECT f1(2, 1, 2, 2) FROM DUAL; +SELECT f1(2, 2, 2, 2) FROM DUAL; +SELECT f1(2, 3, 2, 3) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing labeled ITERATE in a labeled FOR LOOP statement + +DELIMITER /; +CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + la: + FOR ia IN 1 .. a + DO + SET total= total + 1000; + BEGIN + DECLARE ib INT DEFAULT 1; + WHILE ib <= b + DO + IF ib > blim THEN + ITERATE la; + END IF; + SET ib= ib + 1; + SET total= total + 1; + END WHILE; + END; + END FOR la; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing INTERATE statement + +DELIMITER /; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + fori: + FOR i IN 1 .. a + DO + IF i=5 THEN + ITERATE fori; + END IF; + SET total= total + 1; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + lj: + FOR j IN 1 .. 2 + DO + FOR i IN 1 .. a + DO + IF i=5 THEN + ITERATE lj; + END IF; + SET total= total + 1; + END FOR; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3), f1(4), f1(5) FROM DUAL; +DROP FUNCTION f1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 3b615d29166..576512e78a4 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -6317,7 +6317,7 @@ set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| --enable_warnings create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')| --error ER_SP_PROC_TABLE_CORRUPT call това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго()| drop database това_е_дълго_име_за_база_данни_нали| @@ -9583,6 +9583,23 @@ drop procedure p; drop view v; drop table t, tmp_t; + +--echo # +--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +--echo # +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 ); + +--error ER_NON_INSERTABLE_TABLE +REPLACE INTO v1 VALUES (f1()); +SET @aux = f1(); + +# Cleanup +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; + --echo #End of 10.1 tests --echo # diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index aeab884670d..1557ef200e5 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2643,8 +2643,33 @@ DROP TABLE t1; SET TIMESTAMP=DEFAULT; set time_zone= @@global.time_zone; +--echo # +--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +--echo # + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE TABLE t2 (a int); +CREATE TABLE t3 (a int); + +create trigger trg after insert on t2 for each row + INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1; + +drop table t1; + +--error ER_NO_SUCH_TABLE +insert into t2 value (2); +CREATE TABLE t1 (i INT); +insert into t2 value (2); + +DROP VIEW v1; +DROP TABLE t1,t2,t3; + + +--echo End of 10.1 tests. + # -# MDEV-10915 Count number of exceuted triggers +# MDEV-10915 Count number of executed triggers # create table t1 (i int); diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 8c26d5a4366..637ad40c316 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -240,3 +240,11 @@ EXPLAIN SELECT * FROM t1 WHERE a='1x'; EXPLAIN SELECT * FROM t1 WHERE a='1.0'; EXPLAIN SELECT * FROM t1 WHERE a='1.1'; DROP TABLE t1; + +--echo # +--echo # MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters +--echo # + +SET NAMES utf8; +--error ER_ILLEGAL_VALUE_FOR_TYPE +CREATE TABLE t1 (a SET('a,bü')); diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index c353cd8b599..d74e94625e5 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2037,6 +2037,27 @@ EXECUTE stmt; DROP TABLE t1; +--echo # +--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one +--echo # +--echo # Currently we allow window as an identifier, except for table aliases. +--echo # + +CREATE TABLE door (id INT, window VARCHAR(10)); + +--error ER_PARSE_ERROR +SELECT id +FROM door as window; + +SELECT id, window +FROM door; + +--error ER_PARSE_ERROR +SELECT id, window +FROM door as window; + +DROP TABLE door; + --echo # --echo # Start of 10.3 tests --echo # diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index a0c1a23d63c..b6963739613 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -166,6 +166,9 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos) return MY_BIT_NONE; /* Impossible */ } +/* + Initialize a bitmap object. All bits will be set to zero +*/ my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, my_bool thread_safe) diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index dd4051e8169..445ed621e74 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -15,6 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include #include #include #include @@ -50,7 +51,9 @@ static int validate(MYSQL_CONST_LEX_STRING *username, others < min_others; } -static void fix_min_length(MYSQL_THD thd, struct st_mysql_sys_var *var, +static void fix_min_length(MYSQL_THD thd __attribute__((unused)), + struct st_mysql_sys_var *var + __attribute__((unused)), void *var_ptr, const void *save) { unsigned int new_min_length; diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm index 9f684ae6b0c..9268cb3e06b 100644 --- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm +++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 07565f7046d..1777946120d 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -24,6 +24,7 @@ builddir="" ldata="@localstatedir@" langdir="" srcdir="" +log_error="" args="" defaults="" @@ -136,6 +137,8 @@ parse_arguments() --builddir=*) builddir=`parse_arg "$arg"` ;; --srcdir=*) srcdir=`parse_arg "$arg"` ;; --ldata=*|--datadir=*|--data=*) ldata=`parse_arg "$arg"` ;; + --log-error=*) + log_error=`parse_arg "$arg"` ;; --user=*) # Note that the user will be passed to mysqld so that it runs # as 'user' (crucial e.g. if log-bin=/some_other_path/ @@ -147,7 +150,6 @@ parse_arguments() --help) usage ;; --no-defaults|--defaults-file=*|--defaults-extra-file=*) defaults="$arg" ;; - --cross-bootstrap|--windows) # Used when building the MariaDB system tables on a different host than # the target. The platform-independent files that are created in @@ -475,9 +477,14 @@ if { echo "use mysql;$install_params"; cat "$create_system_tables" "$create_syst then s_echo "OK" else + log_file_place=$ldata + if test -n "$log_error" + then + log_file_place="$log_error or $log_file_place" + fi echo echo "Installation of system tables failed! Examine the logs in" - echo "$ldata for more information." + echo "$log_file_place for more information." echo echo "The problem could be conflicting information in an external" echo "my.cnf files. You can ignore these by doing:" diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index a695e45d2fc..07d07d3f6d2 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; -CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; +CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 9b09935abbf..3cd2d0e2053 100755 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -124,9 +124,9 @@ readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BINLOG readonly WSREP_SST_OPT_CONF_SUFFIX -if [ -n "${WSREP_SST_OPT_ADDR_PORT:-}" ]; then +if [ -n "${WSREP_SST_OPT_ADDR:-}" ]; then if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then - if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then + if [ -n "$WSREP_SST_OPT_ADDR_PORT" -a "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then wsrep_log_error "port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR" exit 2 fi @@ -266,18 +266,18 @@ parse_cnf() # finally get the variable value (if variables has been specified multiple time use the last value only) # look in group+suffix - if [[ -n $WSREP_SST_OPT_CONF_SUFFIX ]]; then + if [ -n $WSREP_SST_OPT_CONF_SUFFIX ]; then reval=$($MY_PRINT_DEFAULTS "${group}${WSREP_SST_OPT_CONF_SUFFIX}" | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) fi # look in group - if [[ -z $reval ]]; then + if [ -z $reval ]; then reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) fi # use default if we haven't found a value - if [[ -z $reval ]]; then - [[ -n $3 ]] && reval=$3 + if [ -z $reval ]; then + [ -n $3 ] && reval=$3 fi echo $reval } diff --git a/sql/filesort.cc b/sql/filesort.cc index 3c33f06d6cf..b762773b11e 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -826,11 +826,11 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, MY_BITMAP *tmp_write_set= sort_form->write_set; MY_BITMAP *tmp_vcol_set= sort_form->vcol_set; - if (select->cond->with_subselect) + if (select->cond->with_subquery()) sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); write_record= (select->skip_record(thd) > 0); - if (select->cond->with_subselect) + if (select->cond->with_subquery()) sort_form->column_bitmaps_set(tmp_read_set, tmp_write_set, tmp_vcol_set); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 8d019ba69f3..454ff573624 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -35,7 +35,7 @@ Partitioning lays the foundation for more manageable databases that are extremely large. It does also lay the foundation for more parallelism in the execution of queries. This functionality will grow with later - versions of MySQL. + versions of MySQL/MariaDB. The partition is setup to use table locks. It implements an partition "SHARE" that is inserted into a hash by table name. You can use this to store @@ -58,6 +58,7 @@ #include "sql_plugin.h" #include "sql_show.h" // append_identifier #include "sql_admin.h" // SQL_ADMIN_MSG_TEXT_SIZE +#include "sql_select.h" #include "debug_sync.h" @@ -73,9 +74,7 @@ HA_REC_NOT_IN_SEQ | \ HA_CAN_REPAIR) #define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \ - HA_CAN_FULLTEXT | \ HA_DUPLICATE_POS | \ - HA_CAN_SQL_HANDLER | \ HA_CAN_INSERT_DELAYED | \ HA_READ_BEFORE_WRITE_REMOVAL |\ HA_CAN_TABLES_WITHOUT_ROLLBACK) @@ -92,9 +91,6 @@ static handler *partition_create_handler(handlerton *hton, static uint partition_flags(); static uint alter_table_flags(uint flags); -extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2); -extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2); - /* If frm_error() is called then we will use this to to find out what file extensions exist for the storage engine. This is also used by the default @@ -126,7 +122,6 @@ static void init_partition_psi_keys(void) static int partition_initialize(void *p) { - handlerton *partition_hton; partition_hton= (handlerton *)p; @@ -182,7 +177,7 @@ bool Partition_share::init(uint num_parts) New partition object */ -static handler *partition_create_handler(handlerton *hton, +static handler *partition_create_handler(handlerton *hton, TABLE_SHARE *share, MEM_ROOT *mem_root) { @@ -225,8 +220,6 @@ static uint alter_table_flags(uint flags __attribute__((unused))) HA_FAST_CHANGE_PARTITION); } -const uint32 ha_partition::NO_CURRENT_PART_ID= NOT_A_PARTITION_ID; - /* Constructor method @@ -242,12 +235,19 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share) :handler(hton, share) { DBUG_ENTER("ha_partition::ha_partition(table)"); - init_alloc_root(&m_mem_root, 512, 512, MYF(0)); - init_handler_variables(); + ha_partition_init(); DBUG_VOID_RETURN; } +/* Initialize all partition variables */ + +void ha_partition::ha_partition_init() +{ + init_alloc_root(&m_mem_root, 512, 512, MYF(0)); + init_handler_variables(); +} + /* Constructor method @@ -264,8 +264,7 @@ ha_partition::ha_partition(handlerton *hton, partition_info *part_info) { DBUG_ENTER("ha_partition::ha_partition(part_info)"); DBUG_ASSERT(part_info); - init_alloc_root(&m_mem_root, 512, 512, MYF(0)); - init_handler_variables(); + ha_partition_init(); m_part_info= part_info; m_create_handler= TRUE; m_is_sub_partitioned= m_part_info->is_sub_partitioned(); @@ -291,8 +290,7 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share, :handler(hton, share) { DBUG_ENTER("ha_partition::ha_partition(clone)"); - init_alloc_root(&m_mem_root, 512, 512, MYF(0)); - init_handler_variables(); + ha_partition_init(); m_part_info= part_info_arg; m_create_handler= TRUE; m_is_sub_partitioned= m_part_info->is_sub_partitioned(); @@ -355,6 +353,7 @@ void ha_partition::init_handler_variables() m_curr_key_info[0]= NULL; m_curr_key_info[1]= NULL; m_part_func_monotonicity_info= NON_MONOTONIC; + m_key_not_found= FALSE; auto_increment_lock= FALSE; auto_increment_safe_stmt_log_lock= FALSE; /* @@ -370,6 +369,27 @@ void ha_partition::init_handler_variables() m_new_partitions_share_refs.empty(); m_part_ids_sorted_by_num_of_records= NULL; + m_range_info= NULL; + m_mrr_full_buffer_size= 0; + m_mrr_new_full_buffer_size= 0; + m_mrr_full_buffer= NULL; + m_mrr_range_first= NULL; + + m_pre_calling= FALSE; + m_pre_call_use_parallel= FALSE; + + ft_first= ft_current= NULL; + bulk_access_executing= FALSE; // For future + + /* + Clear bitmaps to allow on one to call my_bitmap_free() on them at any time + */ + my_bitmap_clear(&m_bulk_insert_started); + my_bitmap_clear(&m_locked_partitions); + my_bitmap_clear(&m_partitions_to_reset); + my_bitmap_clear(&m_key_not_found_partitions); + my_bitmap_clear(&m_mrr_used_partitions); + #ifdef DONT_HAVE_TO_BE_INITALIZED m_start_key.flag= 0; m_ordered= TRUE; @@ -378,9 +398,9 @@ void ha_partition::init_handler_variables() const char *ha_partition::table_type() const -{ +{ // we can do this since we only support a single engine type - return m_file[0]->table_type(); + return m_file[0]->table_type(); } @@ -681,6 +701,7 @@ int ha_partition::create(const char *name, TABLE *table_arg, partition_element *part_elem; handler **file, **abort_file; DBUG_ENTER("ha_partition::create"); + DBUG_PRINT("enter", ("name: '%s'", name)); DBUG_ASSERT(!fn_frm_ext(name)); @@ -694,7 +715,6 @@ int ha_partition::create(const char *name, TABLE *table_arg, if (get_from_handler_file(name, ha_thd()->mem_root, false)) DBUG_RETURN(TRUE); DBUG_ASSERT(m_file_buffer); - DBUG_PRINT("enter", ("name: (%s)", name)); name_buffer_ptr= m_name_buffer_ptr; file= m_file; /* @@ -957,7 +977,7 @@ int ha_partition::rename_partitions(const char *path) When state is PART_IS_CHANGED it means that we have created a new TEMP partition that is to be renamed to normal partition name and we are to delete the old partition with currently the normal name. - + We perform this operation by 1) Delete old partition with normal partition name 2) Signal this in table log entry @@ -1192,7 +1212,7 @@ int ha_partition::preload_keys(THD *thd, HA_CHECK_OPT *check_opt) DBUG_RETURN(handle_opt_partitions(thd, check_opt, PRELOAD_KEYS_PARTS)); } - + /* Handle optimize/analyze/check/repair of one partition @@ -1214,7 +1234,7 @@ int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, int error; handler *file= m_file[part_id]; DBUG_ENTER("handle_opt_part"); - DBUG_PRINT("enter", ("flag = %u", flag)); + DBUG_PRINT("enter", ("flag: %u", flag)); if (flag == OPTIMIZE_PARTS) error= file->ha_optimize(thd, check_opt); @@ -1258,7 +1278,7 @@ int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, /* - print a message row formatted for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE + print a message row formatted for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE (modelled after mi_check_print_msg) TODO: move this into the handler, or rewrite mysql_admin_table. */ @@ -1287,7 +1307,7 @@ bool print_admin_msg(THD* thd, uint len, va_end(args); if (msg_length >= (len - 1)) goto err; - msgbuf[len - 1] = 0; // healthy paranoia + msgbuf[len - 1]= 0; // healthy paranoia if (!thd->vio_ok()) @@ -1381,7 +1401,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, print_admin_msg(thd, MYSQL_ERRMSG_SIZE, "error", table_share->db.str, table->alias, opt_op_name[flag], - "Subpartition %s returned error", + "Subpartition %s returned error", sub_elem->partition_name); } /* reset part_state for the remaining partitions */ @@ -1407,7 +1427,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, { print_admin_msg(thd, MYSQL_ERRMSG_SIZE, "error", table_share->db.str, table->alias, - opt_op_name[flag], "Partition %s returned error", + opt_op_name[flag], "Partition %s returned error", part_elem->partition_name); } /* reset part_state for the remaining partitions */ @@ -1449,7 +1469,7 @@ bool ha_partition::check_and_repair(THD *thd) } while (*(++file)); DBUG_RETURN(FALSE); } - + /** @breif Check if the table can be automatically repaired @@ -1489,7 +1509,7 @@ bool ha_partition::is_crashed() const } while (*(++file)); DBUG_RETURN(FALSE); } - + /* Prepare by creating a new partition @@ -1534,7 +1554,8 @@ int ha_partition::prepare_new_partition(TABLE *tbl, if ((error= set_up_table_before_create(tbl, part_name, create_info, p_elem))) goto error_create; - tbl->s->connect_string = p_elem->connect_string; + if (!(file->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION)) + tbl->s->connect_string= p_elem->connect_string; if ((error= file->ha_create(part_name, tbl, create_info))) { /* @@ -1869,7 +1890,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, in the partitions. */ - uint disable_non_uniq_indexes = indexes_are_disabled(); + uint disable_non_uniq_indexes= indexes_are_disabled(); i= 0; part_count= 0; @@ -2108,10 +2129,11 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) DATA DIRECTORY and INDEX DIRECTORY are never applied to the whole partitioned table, only its parts. */ - my_bool from_alter = (create_info->data_file_name == (const char*) -1); - create_info->data_file_name= create_info->index_file_name = NULL; + my_bool from_alter= (create_info->data_file_name == (const char*) -1); + create_info->data_file_name= create_info->index_file_name= NULL; - create_info->connect_string= null_clex_str; + if (!(m_file[0]->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION)) + create_info->connect_string= null_clex_str; /* We do not need to update the individual partition DATA DIRECTORY settings @@ -2129,8 +2151,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) List_iterator part_it(m_part_info->partitions); partition_element *part_elem, *sub_elem; uint num_subparts= m_part_info->num_subparts; - uint num_parts = num_subparts ? m_file_tot_parts / num_subparts - : m_file_tot_parts; + uint num_parts= (num_subparts ? m_file_tot_parts / num_subparts : + m_file_tot_parts); HA_CREATE_INFO dummy_info; memset(&dummy_info, 0, sizeof(dummy_info)); @@ -2181,16 +2203,16 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) DBUG_ASSERT(part < m_file_tot_parts && m_file[part]); if (ha_legacy_type(m_file[part]->ht) == DB_TYPE_INNODB) { - dummy_info.data_file_name= dummy_info.index_file_name = NULL; + dummy_info.data_file_name= dummy_info.index_file_name= NULL; m_file[part]->update_create_info(&dummy_info); if (dummy_info.data_file_name || sub_elem->data_file_name) { - sub_elem->data_file_name = (char*) dummy_info.data_file_name; + sub_elem->data_file_name= (char*) dummy_info.data_file_name; } if (dummy_info.index_file_name || sub_elem->index_file_name) { - sub_elem->index_file_name = (char*) dummy_info.index_file_name; + sub_elem->index_file_name= (char*) dummy_info.index_file_name; } } } @@ -2204,11 +2226,11 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) m_file[i]->update_create_info(&dummy_info); if (dummy_info.data_file_name || part_elem->data_file_name) { - part_elem->data_file_name = (char*) dummy_info.data_file_name; + part_elem->data_file_name= (char*) dummy_info.data_file_name; } if (dummy_info.index_file_name || part_elem->index_file_name) { - part_elem->index_file_name = (char*) dummy_info.index_file_name; + part_elem->index_file_name= (char*) dummy_info.index_file_name; } } } @@ -2265,7 +2287,7 @@ void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) comment Original comment RETURN VALUE - new comment + new comment DESCRIPTION No comment changes so far @@ -2392,7 +2414,7 @@ uint ha_partition::count_query_cache_dependant_tables(uint8 *tables_type) /* Here we rely on the fact that all tables are of the same type */ uint8 type= m_file[0]->table_cache_type(); (*tables_type)|= type; - DBUG_PRINT("info", ("cnt: %u", (uint)m_tot_parts)); + DBUG_PRINT("enter", ("cnt: %u", (uint) m_tot_parts)); /* We need save underlying tables only for HA_CACHE_TBL_ASKTRANSACT: HA_CACHE_TBL_NONTRANSACT - because all changes goes through partition table @@ -2547,7 +2569,7 @@ register_query_cache_dependant_tables(THD *thd, @return status @retval TRUE Error @retval FALSE Success - + @details Set up 1) Comment on partition @@ -2557,7 +2579,7 @@ register_query_cache_dependant_tables(THD *thd, */ int ha_partition::set_up_table_before_create(TABLE *tbl, - const char *partition_name_with_path, + const char *partition_name_with_path, HA_CREATE_INFO *info, partition_element *part_elem) { @@ -2652,8 +2674,7 @@ bool ha_partition::create_handler_file(const char *name) DBUG_ENTER("create_handler_file"); num_parts= m_part_info->partitions.elements; - DBUG_PRINT("info", ("table name = %s, num_parts = %u", name, - num_parts)); + DBUG_PRINT("enter", ("table name: %s num_parts: %u", name, num_parts)); tot_name_len= 0; for (i= 0; i < num_parts; i++) { @@ -2772,7 +2793,7 @@ bool ha_partition::create_handler_file(const char *name) { uchar buffer[4]; part_elem= part_it++; - uint length = part_elem->connect_string.length; + uint length= part_elem->connect_string.length; int4store(buffer, length); if (my_write(file, buffer, 4, MYF(MY_WME | MY_NABP)) || my_write(file, (uchar *) part_elem->connect_string.str, length, @@ -2970,7 +2991,7 @@ bool ha_partition::read_par_file(const char *name) if (chksum) goto err2; m_tot_parts= uint4korr((file_buffer) + PAR_NUM_PARTS_OFFSET); - DBUG_PRINT("info", ("No of parts = %u", m_tot_parts)); + DBUG_PRINT("info", ("No of parts: %u", m_tot_parts)); tot_partition_words= (m_tot_parts + PAR_WORD_SIZE - 1) / PAR_WORD_SIZE; tot_name_len_offset= file_buffer + PAR_ENGINES_OFFSET + @@ -3076,7 +3097,7 @@ bool ha_partition::setup_engine_array(MEM_ROOT *mem_root) } my_afree(engine_array); - + if (create_handlers(mem_root)) { clear_handler_file(); @@ -3358,63 +3379,53 @@ void ha_partition::free_partition_bitmaps() my_bitmap_free(&m_locked_partitions); my_bitmap_free(&m_partitions_to_reset); my_bitmap_free(&m_key_not_found_partitions); + my_bitmap_free(&m_mrr_used_partitions); } /** Helper function for initializing all internal bitmaps. + + Note: + All bitmaps, including partially allocated, are freed in + free_partion_bitmaps() */ bool ha_partition::init_partition_bitmaps() { DBUG_ENTER("ha_partition::init_partition_bitmaps"); + /* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */ if (my_bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE)) DBUG_RETURN(true); - bitmap_clear_all(&m_bulk_insert_started); /* Initialize the bitmap we use to keep track of locked partitions */ if (my_bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE)) - { - my_bitmap_free(&m_bulk_insert_started); DBUG_RETURN(true); - } - bitmap_clear_all(&m_locked_partitions); /* Initialize the bitmap we use to keep track of partitions which may have something to reset in ha_reset(). */ if (my_bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE)) - { - my_bitmap_free(&m_bulk_insert_started); - my_bitmap_free(&m_locked_partitions); DBUG_RETURN(true); - } - bitmap_clear_all(&m_partitions_to_reset); /* Initialize the bitmap we use to keep track of partitions which returned HA_ERR_KEY_NOT_FOUND from index_read_map. */ if (my_bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE)) - { - my_bitmap_free(&m_bulk_insert_started); - my_bitmap_free(&m_locked_partitions); - my_bitmap_free(&m_partitions_to_reset); DBUG_RETURN(true); - } - bitmap_clear_all(&m_key_not_found_partitions); - m_key_not_found= false; + + if (bitmap_init(&m_mrr_used_partitions, NULL, m_tot_parts, TRUE)) + DBUG_RETURN(true); + /* Initialize the bitmap for read/lock_partitions */ if (!m_is_clone_of) { DBUG_ASSERT(!m_clone_mem_root); if (m_part_info->set_partition_bitmaps(NULL)) - { - free_partition_bitmaps(); DBUG_RETURN(true); - } } DBUG_RETURN(false); } @@ -3479,9 +3490,29 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) } if (init_partition_bitmaps()) - DBUG_RETURN(error); + goto err_alloc; - DBUG_ASSERT(m_part_info); + /* Allocate memory used with MMR */ + if (!(m_range_info= (void **) + my_multi_malloc(MYF(MY_WME), + &m_range_info, sizeof(range_id_t) * m_tot_parts, + &m_stock_range_seq, sizeof(uint) * m_tot_parts, + &m_mrr_buffer, sizeof(HANDLER_BUFFER) * m_tot_parts, + &m_mrr_buffer_size, sizeof(uint) * m_tot_parts, + &m_part_mrr_range_length, sizeof(uint) * m_tot_parts, + &m_part_mrr_range_first, + sizeof(PARTITION_PART_KEY_MULTI_RANGE *) * m_tot_parts, + &m_part_mrr_range_current, + sizeof(PARTITION_PART_KEY_MULTI_RANGE *) * m_tot_parts, + &m_partition_part_key_multi_range_hld, + sizeof(PARTITION_PART_KEY_MULTI_RANGE_HLD) * + m_tot_parts, + NullS))) + goto err_alloc; + + bzero(m_mrr_buffer, m_tot_parts * sizeof(HANDLER_BUFFER)); + bzero(m_part_mrr_range_first, + sizeof(PARTITION_PART_KEY_MULTI_RANGE *) * m_tot_parts); if (m_is_clone_of) { @@ -3520,21 +3551,31 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) file= m_file; do { + LEX_CSTRING save_connect_string= table->s->connect_string; if ((error= create_partition_name(name_buff, sizeof(name_buff), name, name_buffer_ptr, NORMAL_PART_NAME, FALSE))) goto err_handler; - table->s->connect_string = m_connect_string[(uint)(file-m_file)]; - if ((error= (*file)->ha_open(table, name_buff, mode, - test_if_locked | HA_OPEN_NO_PSI_CALL))) + if (!((*file)->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION)) + table->s->connect_string= m_connect_string[(uint)(file-m_file)]; + error= (*file)->ha_open(table, name_buff, mode, + test_if_locked | HA_OPEN_NO_PSI_CALL); + table->s->connect_string= save_connect_string; + if (error) goto err_handler; - bzero(&table->s->connect_string, sizeof(LEX_STRING)); if (m_file == file) m_num_locks= (*file)->lock_count(); DBUG_ASSERT(m_num_locks == (*file)->lock_count()); name_buffer_ptr+= strlen(name_buffer_ptr) + 1; } while (*(++file)); } - + /* + We want to know the upper bound for locks, to allocate enough memory. + There is no performance lost if we simply return in lock_count() the + maximum number locks needed, only some minor over allocation of memory + in get_lock_data(). + */ + m_num_locks*= m_tot_parts; + file= m_file; ref_length= (*file)->ref_length; check_table_flags= (((*file)->ha_table_flags() & @@ -3554,7 +3595,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) { error= HA_ERR_INITIALIZATION; /* set file to last handler, so all of them are closed */ - file = &m_file[m_tot_parts - 1]; + file= &m_file[m_tot_parts - 1]; goto err_handler; } } @@ -3594,6 +3635,8 @@ err_handler: (*file)->ha_close(); err_alloc: free_partition_bitmaps(); + my_free(m_range_info); + m_range_info= 0; DBUG_RETURN(error); } @@ -3671,7 +3714,7 @@ handler *ha_partition::clone(const char *name, MEM_ROOT *mem_root) /* Allocate new_handler->ref here because otherwise ha_open will allocate it - on this->table->mem_root and we will not be able to reclaim that memory + on this->table->mem_root and we will not be able to reclaim that memory when the clone handler object is destroyed. */ if (!(new_handler->ref= (uchar*) alloc_root(mem_root, @@ -3713,12 +3756,59 @@ int ha_partition::close(void) { bool first= TRUE; handler **file; + uint i; + st_partition_ft_info *tmp_ft_info; DBUG_ENTER("ha_partition::close"); - DBUG_ASSERT(table->s == table_share); + DBUG_ASSERT(m_part_info); + destroy_record_priority_queue(); free_partition_bitmaps(); - DBUG_ASSERT(m_part_info); + + for (; ft_first ; ft_first= tmp_ft_info) + { + tmp_ft_info= ft_first->next; + my_free(ft_first); + } + + /* Free active mrr_ranges */ + for (i= 0; i < m_tot_parts; i++) + { + if (m_part_mrr_range_first[i]) + { + PARTITION_PART_KEY_MULTI_RANGE *tmp_mrr_range_first= + m_part_mrr_range_first[i]; + do + { + PARTITION_PART_KEY_MULTI_RANGE *tmp_mrr_range_current; + tmp_mrr_range_current= tmp_mrr_range_first; + tmp_mrr_range_first= tmp_mrr_range_first->next; + my_free(tmp_mrr_range_current); + } while (tmp_mrr_range_first); + } + } + if (m_mrr_range_first) + { + do + { + m_mrr_range_current= m_mrr_range_first; + m_mrr_range_first= m_mrr_range_first->next; + if (m_mrr_range_current->key[0]) + my_free(m_mrr_range_current->key[0]); + if (m_mrr_range_current->key[1]) + my_free(m_mrr_range_current->key[1]); + my_free(m_mrr_range_current); + } while (m_mrr_range_first); + } + my_free(m_range_info); + m_range_info= NULL; // Safety + + if (m_mrr_full_buffer) + { + my_free(m_mrr_full_buffer); + m_mrr_full_buffer= NULL; + m_mrr_full_buffer_size= 0; + } file= m_file; repeat: @@ -3780,7 +3870,7 @@ repeat: int ha_partition::external_lock(THD *thd, int lock_type) { - uint error; + int error; uint i, first_used_partition; MY_BITMAP *used_partitions; DBUG_ENTER("ha_partition::external_lock"); @@ -3798,7 +3888,7 @@ int ha_partition::external_lock(THD *thd, int lock_type) i < m_tot_parts; i= bitmap_get_next_set(used_partitions, i)) { - DBUG_PRINT("info", ("external_lock(thd, %d) part %d", lock_type, i)); + DBUG_PRINT("info", ("external_lock(thd, %d) part %u", lock_type, i)); if ((error= m_file[i]->ha_external_lock(thd, lock_type))) { if (lock_type != F_UNLCK) @@ -3914,7 +4004,7 @@ THR_LOCK_DATA **ha_partition::store_lock(THD *thd, i < m_tot_parts; i= bitmap_get_next_set(&m_part_info->lock_partitions, i)) { - DBUG_PRINT("info", ("store lock %d iteration", i)); + DBUG_PRINT("info", ("store lock %u iteration", i)); to= m_file[i]->store_lock(thd, to, lock_type); } } @@ -3975,25 +4065,14 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type) @returns Number of locks returned in call to store_lock @desc - Returns the number of store locks needed in call to store lock. - We return number of partitions we will lock multiplied with number of - locks needed by each partition. Assists the above functions in allocating - sufficient space for lock structures. + Returns the maxinum possible number of store locks needed in call to + store lock. */ uint ha_partition::lock_count() const { DBUG_ENTER("ha_partition::lock_count"); - /* - The caller want to know the upper bound, to allocate enough memory. - There is no performance lost if we simply return maximum number locks - needed, only some minor over allocation of memory in get_lock_data(). - - Also notice that this may be called for another thread != table->in_use, - when mysql_lock_abort_for_thread() is called. So this is more safe, then - using number of partitions after pruning. - */ - DBUG_RETURN(m_tot_parts * m_num_locks); + DBUG_RETURN(m_num_locks); } @@ -4072,7 +4151,7 @@ void ha_partition::try_semi_consistent_read(bool yes) { uint i; DBUG_ENTER("ha_partition::try_semi_consistent_read"); - + i= bitmap_get_first_set(&(m_part_info->read_partitions)); DBUG_ASSERT(i != MY_BIT_NONE); for (; @@ -4137,7 +4216,7 @@ int ha_partition::write_row(uchar * buf) sql_mode_t saved_sql_mode= thd->variables.sql_mode; bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null; DBUG_ENTER("ha_partition::write_row"); - DBUG_ASSERT(buf == m_rec0); + DBUG_PRINT("enter", ("partition this: %p", this)); /* If we have an auto_increment column and we are writing a changed row @@ -4145,15 +4224,8 @@ int ha_partition::write_row(uchar * buf) */ if (have_auto_increment) { - if (!part_share->auto_inc_initialized && - !table_share->next_number_keypart) - { - /* - If auto_increment in table_share is not initialized, start by - initializing it. - */ - info(HA_STATUS_AUTO); - } + if (!table_share->next_number_keypart) + update_next_auto_inc_val(); error= update_auto_increment(); /* @@ -4197,7 +4269,7 @@ int ha_partition::write_row(uchar * buf) goto exit; } m_last_part= part_id; - DBUG_PRINT("info", ("Insert in partition %d", part_id)); + DBUG_PRINT("info", ("Insert in partition %u", part_id)); start_part_bulk_insert(thd, part_id); tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ @@ -4289,7 +4361,7 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) start_part_bulk_insert(thd, new_part_id); if (new_part_id == old_part_id) { - DBUG_PRINT("info", ("Update in partition %d", new_part_id)); + DBUG_PRINT("info", ("Update in partition %u", (uint) new_part_id)); tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ error= m_file[new_part_id]->ha_update_row(old_data, new_data); reenable_binlog(thd); @@ -4309,8 +4381,8 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) This gives the same behavior for partitioned vs non partitioned tables. */ table->next_number_field= NULL; - DBUG_PRINT("info", ("Update from partition %d to partition %d", - old_part_id, new_part_id)); + DBUG_PRINT("info", ("Update from partition %u to partition %u", + (uint) old_part_id, (uint) new_part_id)); tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ error= m_file[new_part_id]->ha_write_row((uchar*) new_data); reenable_binlog(thd); @@ -4355,8 +4427,11 @@ exit: bitmap_is_set(table->write_set, table->found_next_number_field->field_index)) { - if (!part_share->auto_inc_initialized) - info(HA_STATUS_AUTO); + update_next_auto_inc_val(); + /* + The following call is safe as part_share->auto_inc_initialized + (tested in the call) is guaranteed to be set for update statements. + */ set_auto_increment_if_higher(table->found_next_number_field); } DBUG_RETURN(error); @@ -4643,9 +4718,9 @@ void ha_partition::start_part_bulk_insert(THD *thd, uint part_id) DESCRIPTION If the estimated number of rows to insert is less than 10 (but not 0) the new buffer size is same as original buffer size. - In case of first partition of when partition function is monotonic + In case of first partition of when partition function is monotonic new buffer size is same as the original buffer size. - For rest of the partition total buffer of 10*original_size is divided + For rest of the partition total buffer of 10*original_size is divided equally if number of partition is more than 10 other wise each partition will be allowed to use original buffer size. */ @@ -4683,7 +4758,7 @@ long ha_partition::estimate_read_buffer_size(long original_size) If monotonic partitioning function was used guess that 50 % of the inserts goes to the first partition For all other cases, guess on equal distribution between the partitions -*/ +*/ ha_rows ha_partition::guess_bulk_insert_rows() { DBUG_ENTER("guess_bulk_insert_rows"); @@ -4692,7 +4767,7 @@ ha_rows ha_partition::guess_bulk_insert_rows() DBUG_RETURN(estimation_rows_to_insert); /* If first insert/partition and monotonic partition function, guess 50%. */ - if (!m_bulk_inserted_rows && + if (!m_bulk_inserted_rows && m_part_func_monotonicity_info != NON_MONOTONIC && m_tot_parts > 1) DBUG_RETURN(estimation_rows_to_insert / 2); @@ -4758,7 +4833,7 @@ int ha_partition::end_bulk_insert() >0 Error code 0 Success - DESCRIPTION + DESCRIPTION rnd_init() is called when the server wants the storage engine to do a table scan or when the server wants to access data through rnd_pos. @@ -4794,7 +4869,10 @@ int ha_partition::rnd_init(bool scan) */ if (bitmap_is_overlapping(&m_part_info->full_part_field_set, table->write_set)) + { + DBUG_PRINT("info", ("partition set full bitmap")); bitmap_set_all(table->read_set); + } else { /* @@ -4803,6 +4881,7 @@ int ha_partition::rnd_init(bool scan) fields of the partition functions are read such that we can calculate the partition id to place updated and deleted records. */ + DBUG_PRINT("info", ("partition set part_field bitmap")); bitmap_union(table->read_set, &m_part_info->full_part_field_set); } } @@ -4811,9 +4890,9 @@ int ha_partition::rnd_init(bool scan) DBUG_PRINT("info", ("m_part_info->read_partitions: %p", m_part_info->read_partitions.bitmap)); part_id= bitmap_get_first_set(&(m_part_info->read_partitions)); - DBUG_PRINT("info", ("m_part_spec.start_part %d", part_id)); + DBUG_PRINT("info", ("m_part_spec.start_part: %u", (uint) part_id)); - if (MY_BIT_NONE == part_id) + if (part_id == MY_BIT_NONE) { error= 0; goto err1; @@ -4823,7 +4902,7 @@ int ha_partition::rnd_init(bool scan) We have a partition and we are scanning with rnd_next so we bump our cache */ - DBUG_PRINT("info", ("rnd_init on partition %d", part_id)); + DBUG_PRINT("info", ("rnd_init on partition: %u", (uint) part_id)); if (scan) { /* @@ -4832,26 +4911,29 @@ int ha_partition::rnd_init(bool scan) */ rnd_end(); late_extra_cache(part_id); - if ((error= m_file[part_id]->ha_rnd_init(scan))) + + m_index_scan_type= partition_no_index_scan; + } + + for (i= part_id; + i < m_tot_parts; + i= bitmap_get_next_set(&m_part_info->read_partitions, i)) + { + if ((error= m_file[i]->ha_rnd_init(scan))) goto err; } - else - { - for (i= part_id; - i < m_tot_parts; - i= bitmap_get_next_set(&m_part_info->read_partitions, i)) - { - if ((error= m_file[i]->ha_rnd_init(scan))) - goto err; - } - } + m_scan_value= scan; m_part_spec.start_part= part_id; m_part_spec.end_part= m_tot_parts - 1; - DBUG_PRINT("info", ("m_scan_value=%d", m_scan_value)); + m_rnd_init_and_first= TRUE; + DBUG_PRINT("info", ("m_scan_value: %u", m_scan_value)); DBUG_RETURN(0); err: + if (scan) + late_extra_no_cache(part_id); + /* Call rnd_end for all previously inited partitions. */ for (; part_id < i; @@ -4883,13 +4965,10 @@ int ha_partition::rnd_end() switch (m_scan_value) { case 2: // Error break; - case 1: - if (NO_CURRENT_PART_ID != m_part_spec.start_part) // Table scan - { + case 1: // Table scan + if (m_part_spec.start_part != NO_CURRENT_PART_ID) late_extra_no_cache(m_part_spec.start_part); - m_file[m_part_spec.start_part]->ha_rnd_end(); - } - break; + /* fall through */ case 0: uint i; for (i= bitmap_get_first_set(&m_part_info->read_partitions); @@ -4905,6 +4984,7 @@ int ha_partition::rnd_end() DBUG_RETURN(0); } + /* read next row during full table scan (scan in random row order) @@ -4929,14 +5009,15 @@ int ha_partition::rnd_end() int ha_partition::rnd_next(uchar *buf) { handler *file; - int result= HA_ERR_END_OF_FILE; + int result= HA_ERR_END_OF_FILE, error; uint part_id= m_part_spec.start_part; DBUG_ENTER("ha_partition::rnd_next"); + DBUG_PRINT("enter", ("partition this: %p", this)); /* upper level will increment this once again at end of call */ decrement_statistics(&SSV::ha_read_rnd_next_count); - if (NO_CURRENT_PART_ID == part_id) + if (part_id == NO_CURRENT_PART_ID) { /* The original set of partitions to scan was empty and thus we report @@ -4944,16 +5025,26 @@ int ha_partition::rnd_next(uchar *buf) */ goto end; } - + DBUG_ASSERT(m_scan_value == 1); + + if (m_rnd_init_and_first) + { + m_rnd_init_and_first= FALSE; + error= handle_pre_scan(FALSE, check_parallel_search()); + if (m_pre_calling || error) + DBUG_RETURN(error); + } + file= m_file[part_id]; - + while (TRUE) { result= file->ha_rnd_next(buf); if (!result) { m_last_part= part_id; + DBUG_PRINT("info", ("partition m_last_part: %u", (uint) m_last_part)); m_part_spec.start_part= part_id; table->status= 0; DBUG_RETURN(0); @@ -4970,10 +5061,6 @@ int ha_partition::rnd_next(uchar *buf) /* End current partition */ late_extra_no_cache(part_id); - DBUG_PRINT("info", ("rnd_end on partition %d", part_id)); - if ((result= file->ha_rnd_end())) - break; - /* Shift to next partition */ part_id= bitmap_get_next_set(&m_part_info->read_partitions, part_id); if (part_id >= m_tot_parts) @@ -4982,11 +5069,9 @@ int ha_partition::rnd_next(uchar *buf) break; } m_last_part= part_id; + DBUG_PRINT("info", ("partition m_last_part: %u", (uint) m_last_part)); m_part_spec.start_part= part_id; file= m_file[part_id]; - DBUG_PRINT("info", ("rnd_init on partition %d", part_id)); - if ((result= file->ha_rnd_init(1))) - break; late_extra_cache(part_id); } @@ -5142,6 +5227,7 @@ bool ha_partition::init_record_priority_queue() { uint alloc_len; uint used_parts= bitmap_bits_set(&m_part_info->read_partitions); + DBUG_ASSERT(used_parts > 0); /* Allocate record buffer for each used partition. */ m_priority_queue_rec_len= m_rec_length + PARTITION_BYTES_IN_POS; if (!m_using_extended_keys) @@ -5171,20 +5257,15 @@ bool ha_partition::init_record_priority_queue() ptr+= m_priority_queue_rec_len; } m_start_key.key= (const uchar*)ptr; - + /* Initialize priority queue, initialized to reading forward. */ int (*cmp_func)(void *, uchar *, uchar *); - void *cmp_arg; - if (!m_using_extended_keys) - { + void *cmp_arg= (void*) this; + if (!m_using_extended_keys && !(table_flags() & HA_CMP_REF_IS_EXPENSIVE)) cmp_func= cmp_key_rowid_part_id; - cmp_arg= (void*)this; - } else - { cmp_func= cmp_key_part_id; - cmp_arg= (void*)m_curr_key_info; - } + DBUG_PRINT("info", ("partition queue_init(1) used_parts: %u", used_parts)); if (init_queue(&m_queue, used_parts, 0, 0, cmp_func, cmp_arg, 0, 0)) { my_free(m_ordered_rec_buffer); @@ -5235,8 +5316,8 @@ int ha_partition::index_init(uint inx, bool sorted) int error= 0; uint i; DBUG_ENTER("ha_partition::index_init"); + DBUG_PRINT("enter", ("partition this: %p inx: %u sorted: %u", this, inx, sorted)); - DBUG_PRINT("info", ("inx %u sorted %u", inx, sorted)); active_index= inx; m_part_spec.start_part= NO_CURRENT_PART_ID; m_start_key.length= 0; @@ -5271,11 +5352,14 @@ int ha_partition::index_init(uint inx, bool sorted) But this is required for operations that may need to change data only. */ if (get_lock_type() == F_WRLCK) + { + DBUG_PRINT("info", ("partition set part_field bitmap")); bitmap_union(table->read_set, &m_part_info->full_part_field_set); + } if (sorted) { /* - An ordered scan is requested. We must make sure all fields of the + An ordered scan is requested. We must make sure all fields of the used index are in the read set, as partitioning requires them for sorting (see ha_partition::handle_ordered_index_scan). @@ -5342,19 +5426,21 @@ err: int ha_partition::index_end() { int error= 0; - uint i; + handler **file; DBUG_ENTER("ha_partition::index_end"); active_index= MAX_KEY; m_part_spec.start_part= NO_CURRENT_PART_ID; - for (i= bitmap_get_first_set(&m_part_info->read_partitions); - i < m_tot_parts; - i= bitmap_get_next_set(&m_part_info->read_partitions, i)) + file= m_file; + do { - int tmp; - if ((tmp= m_file[i]->ha_index_end())) - error= tmp; - } + if ((*file)->inited == INDEX) + { + int tmp; + if ((tmp= (*file)->ha_index_end())) + error= tmp; + } + } while (*(++file)); destroy_record_priority_queue(); DBUG_RETURN(error); } @@ -5403,34 +5489,26 @@ int ha_partition::index_read_map(uchar *buf, const uchar *key, /* Compare two part_no partition numbers */ static int cmp_part_ids(uchar *ref1, uchar *ref2) { - /* The following was taken from ha_partition::cmp_ref */ - my_ptrdiff_t diff1= ref2[1] - ref1[1]; - my_ptrdiff_t diff2= ref2[0] - ref1[0]; - if (!diff1 && !diff2) - return 0; - - if (diff1 > 0) - return(-1); - - if (diff1 < 0) - return(+1); - - if (diff2 > 0) - return(-1); - - return(+1); + uint32 diff2= uint2korr(ref2); + uint32 diff1= uint2korr(ref1); + if (diff2 > diff1) + return -1; + if (diff2 < diff1) + return 1; + return 0; } /* @brief - Provide ordering by (key_value, part_no). + Provide ordering by (key_value, part_no). */ -extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2) +extern "C" int cmp_key_part_id(void *ptr, uchar *ref1, uchar *ref2) { + ha_partition *file= (ha_partition*)ptr; int res; - if ((res= key_rec_cmp(key_p, ref1 + PARTITION_BYTES_IN_POS, + if ((res= key_rec_cmp(file->m_curr_key_info, ref1 + PARTITION_BYTES_IN_POS, ref2 + PARTITION_BYTES_IN_POS))) { return res; @@ -5440,7 +5518,7 @@ extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2) /* @brief - Provide ordering by (key_value, underying_table_rowid, part_no). + Provide ordering by (key_value, underying_table_rowid, part_no). */ extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2) { @@ -5465,26 +5543,26 @@ extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2) Common routine for a number of index_read variants @param buf Buffer where the record should be returned. - @param have_start_key TRUE <=> the left endpoint is available, i.e. + @param have_start_key TRUE <=> the left endpoint is available, i.e. we're in index_read call or in read_range_first call and the range has left endpoint. FALSE <=> there is no left endpoint (we're in read_range_first() call and the range has no left endpoint). - + @return Operation status - @retval 0 OK + @retval 0 OK @retval HA_ERR_END_OF_FILE Whole index scanned, without finding the record. @retval HA_ERR_KEY_NOT_FOUND Record not found, but index cursor positioned. @retval other error code. @details - Start scanning the range (when invoked from read_range_first()) or doing + Start scanning the range (when invoked from read_range_first()) or doing an index lookup (when invoked from index_read_XXX): - If possible, perform partition selection - Find the set of partitions we're going to use - Depending on whether we need ordering: - NO: Get the first record from first used partition (see + NO: Get the first record from first used partition (see handle_unordered_scan_next_partition) YES: Fill the priority queue and get the record that is the first in the ordering @@ -5502,7 +5580,7 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) if (have_start_key) { - m_start_key.length= key_len= calculate_key_len(table, active_index, + m_start_key.length= key_len= calculate_key_len(table, active_index, m_start_key.key, m_start_key.keypart_map); DBUG_PRINT("info", ("have_start_key map %lu find_flag %u len %u", @@ -5514,7 +5592,7 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) DBUG_RETURN(error); } - if (have_start_key && + if (have_start_key && (m_start_key.flag == HA_READ_PREFIX_LAST || m_start_key.flag == HA_READ_PREFIX_LAST_OR_PREV || m_start_key.flag == HA_READ_BEFORE_KEY)) @@ -5534,7 +5612,9 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key) The unordered index scan will use the partition set created. */ DBUG_PRINT("info", ("doing unordered scan")); - error= handle_unordered_scan_next_partition(buf); + error= handle_pre_scan(FALSE, FALSE); + if (!error) + error= handle_unordered_scan_next_partition(buf); } else { @@ -5582,7 +5662,7 @@ int ha_partition::index_first(uchar * buf) /* Start an index scan from rightmost record and return first record - + SYNOPSIS index_last() buf Read row in MySQL Row Format @@ -5615,7 +5695,7 @@ int ha_partition::index_last(uchar * buf) SYNOPSIS ha_partition::common_first_last() - + see index_first for rest */ @@ -5627,7 +5707,11 @@ int ha_partition::common_first_last(uchar *buf) return error; if (!m_ordered_scan_ongoing && m_index_scan_type != partition_index_last) - return handle_unordered_scan_next_partition(buf); + { + if ((error= handle_pre_scan(FALSE, check_parallel_search()))) + return error; + return handle_unordered_scan_next_partition(buf); + } return handle_ordered_index_scan(buf, FALSE); } @@ -5655,7 +5739,7 @@ int ha_partition::index_read_idx_map(uchar *buf, uint index, get_partition_set(table, buf, index, &m_start_key, &m_part_spec); - /* + /* We have either found exactly 1 partition (in which case start_part == end_part) or no matching partitions (start_part > end_part) @@ -5720,7 +5804,8 @@ int ha_partition::index_next(uchar * buf) and if direction changes, we must step back those partitions in the record queue so we don't return a value from the wrong direction. */ - DBUG_ASSERT(m_index_scan_type != partition_index_last); + if (m_index_scan_type == partition_index_last) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); if (!m_ordered_scan_ongoing) { DBUG_RETURN(handle_unordered_next(buf, FALSE)); @@ -5753,7 +5838,8 @@ int ha_partition::index_next_same(uchar *buf, const uchar *key, uint keylen) decrement_statistics(&SSV::ha_read_next_count); DBUG_ASSERT(keylen == m_start_key.length); - DBUG_ASSERT(m_index_scan_type != partition_index_last); + if (m_index_scan_type == partition_index_last) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); if (!m_ordered_scan_ongoing) DBUG_RETURN(handle_unordered_next(buf, TRUE)); DBUG_RETURN(handle_ordered_next(buf, TRUE)); @@ -5797,7 +5883,8 @@ int ha_partition::index_prev(uchar * buf) decrement_statistics(&SSV::ha_read_prev_count); /* TODO: read comment in index_next */ - DBUG_ASSERT(m_index_scan_type != partition_index_first); + if (m_index_scan_type == partition_index_first) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); DBUG_RETURN(handle_ordered_prev(buf)); } @@ -5868,6 +5955,980 @@ int ha_partition::read_range_next() DBUG_RETURN(handle_unordered_next(table->record[0], eq_range)); } +/** + Create a copy of all keys used by multi_range_read() + + @retval 0 ok + @retval HA_ERR_END_OF_FILE no keys in range + @retval other value: error + + TODO to save memory: + - If (mrr_mode & HA_MRR_MATERIALIZED_KEYS) is set then the keys data is + stable and we don't have to copy the keys, only store a pointer to the + key. + - When allocating key data, store things in a MEM_ROOT buffer instead of + a malloc() per key. This will simplify and speed up the current code + and use less memory. +*/ + +int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq, + range_seq_t seq_it) +{ + uint i, length; + key_range *start_key, *end_key; + KEY_MULTI_RANGE *range; + DBUG_ENTER("ha_partition::multi_range_key_create_key"); + + bitmap_clear_all(&m_mrr_used_partitions); + m_mrr_range_length= 0; + bzero(m_part_mrr_range_length, + sizeof(*m_part_mrr_range_length) * m_tot_parts); + if (!m_mrr_range_first) + { + if (!(m_mrr_range_first= (PARTITION_KEY_MULTI_RANGE *) + my_multi_malloc(MYF(MY_WME), + &m_mrr_range_current, + sizeof(PARTITION_KEY_MULTI_RANGE), + NullS))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + + m_mrr_range_first->id= 1; + m_mrr_range_first->key[0]= NULL; + m_mrr_range_first->key[1]= NULL; + m_mrr_range_first->next= NULL; + } + else + m_mrr_range_current= m_mrr_range_first; + + for (i= 0; i < m_tot_parts; i++) + { + if (!m_part_mrr_range_first[i]) + { + if (!(m_part_mrr_range_first[i]= (PARTITION_PART_KEY_MULTI_RANGE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &m_part_mrr_range_current[i], + sizeof(PARTITION_PART_KEY_MULTI_RANGE), + NullS))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + else + { + m_part_mrr_range_current[i]= m_part_mrr_range_first[i]; + m_part_mrr_range_current[i]->partition_key_multi_range= NULL; + } + } + m_mrr_range_current->key_multi_range.start_key.key= NULL; + m_mrr_range_current->key_multi_range.end_key.key= NULL; + + while (!seq->next(seq_it, &m_mrr_range_current->key_multi_range)) + { + m_mrr_range_length++; + range= &m_mrr_range_current->key_multi_range; + + /* Copy start key */ + start_key= &range->start_key; + DBUG_PRINT("info",("partition range->range_flag: %u", range->range_flag)); + DBUG_PRINT("info",("partition start_key->key: %p", start_key->key)); + DBUG_PRINT("info",("partition start_key->length: %u", start_key->length)); + DBUG_PRINT("info",("partition start_key->keypart_map: %lu", + start_key->keypart_map)); + DBUG_PRINT("info",("partition start_key->flag: %u", start_key->flag)); + + if (start_key->key) + { + length= start_key->length; + if (!m_mrr_range_current->key[0] || + m_mrr_range_current->length[0] < length) + { + if (m_mrr_range_current->key[0]) + my_free(m_mrr_range_current->key[0]); + if (!(m_mrr_range_current->key[0]= + (uchar *) my_malloc(length, MYF(MY_WME)))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + m_mrr_range_current->length[0]= length; + } + memcpy(m_mrr_range_current->key[0], start_key->key, length); + start_key->key= m_mrr_range_current->key[0]; + } + + /* Copy end key */ + end_key= &range->end_key; + DBUG_PRINT("info",("partition end_key->key: %p", end_key->key)); + DBUG_PRINT("info",("partition end_key->length: %u", end_key->length)); + DBUG_PRINT("info",("partition end_key->keypart_map: %lu", + end_key->keypart_map)); + DBUG_PRINT("info",("partition end_key->flag: %u", end_key->flag)); + if (end_key->key) + { + length= end_key->length; + if (!m_mrr_range_current->key[1] || + m_mrr_range_current->length[1] < length) + { + if (m_mrr_range_current->key[1]) + my_free(m_mrr_range_current->key[1]); + if (!(m_mrr_range_current->key[1]= + (uchar *) my_malloc(length, MYF(MY_WME)))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + m_mrr_range_current->length[1]= length; + } + memcpy(m_mrr_range_current->key[1], end_key->key, length); + end_key->key= m_mrr_range_current->key[1]; + } + + m_mrr_range_current->ptr= m_mrr_range_current->key_multi_range.ptr; + m_mrr_range_current->key_multi_range.ptr= m_mrr_range_current; + + if (start_key->key && (start_key->flag & HA_READ_KEY_EXACT)) + get_partition_set(table, table->record[0], active_index, + start_key, &m_part_spec); + else + { + m_part_spec.start_part= 0; + m_part_spec.end_part= m_tot_parts - 1; + } + + /* Copy key to those partitions that needs it */ + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + if (bitmap_is_set(&(m_part_info->read_partitions), i)) + { + bitmap_set_bit(&m_mrr_used_partitions, i); + m_part_mrr_range_length[i]++; + m_part_mrr_range_current[i]->partition_key_multi_range= + m_mrr_range_current; + + if (!m_part_mrr_range_current[i]->next) + { + PARTITION_PART_KEY_MULTI_RANGE *tmp_part_mrr_range; + if (!(tmp_part_mrr_range= (PARTITION_PART_KEY_MULTI_RANGE *) + my_malloc(sizeof(PARTITION_PART_KEY_MULTI_RANGE), + MYF(MY_WME | MY_ZEROFILL)))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + + m_part_mrr_range_current[i]->next= tmp_part_mrr_range; + m_part_mrr_range_current[i]= tmp_part_mrr_range; + } + else + { + m_part_mrr_range_current[i]= m_part_mrr_range_current[i]->next; + m_part_mrr_range_current[i]->partition_key_multi_range= NULL; + } + } + } + + if (!m_mrr_range_current->next) + { + /* Add end of range sentinel */ + PARTITION_KEY_MULTI_RANGE *tmp_mrr_range; + if (!(tmp_mrr_range= (PARTITION_KEY_MULTI_RANGE *) + my_malloc(sizeof(PARTITION_KEY_MULTI_RANGE), MYF(MY_WME)))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + + tmp_mrr_range->id= m_mrr_range_current->id + 1; + tmp_mrr_range->key[0]= NULL; + tmp_mrr_range->key[1]= NULL; + tmp_mrr_range->next= NULL; + m_mrr_range_current->next= tmp_mrr_range; + } + m_mrr_range_current= m_mrr_range_current->next; + } + + if (!m_mrr_range_length) + { + DBUG_PRINT("Warning",("No keys to use for mrr")); + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + + /* set start and end part */ + m_part_spec.start_part= bitmap_get_first_set(&m_mrr_used_partitions); + + for (i= m_tot_parts; i-- > 0;) + { + if (bitmap_is_set(&m_mrr_used_partitions, i)) + { + m_part_spec.end_part= i; + break; + } + } + for (i= 0; i < m_tot_parts; i++) + { + m_partition_part_key_multi_range_hld[i].partition= this; + m_partition_part_key_multi_range_hld[i].part_id= i; + m_partition_part_key_multi_range_hld[i].partition_part_key_multi_range= + m_part_mrr_range_first[i]; + } + DBUG_PRINT("return",("OK")); + DBUG_RETURN(0); +} + + +static void partition_multi_range_key_get_key_info(void *init_params, + uint *length, + key_part_map *map) +{ + PARTITION_PART_KEY_MULTI_RANGE_HLD *hld= + (PARTITION_PART_KEY_MULTI_RANGE_HLD *)init_params; + ha_partition *partition= hld->partition; + key_range *start_key= (&partition->m_mrr_range_first-> + key_multi_range.start_key); + DBUG_ENTER("partition_multi_range_key_get_key_info"); + *length= start_key->length; + *map= start_key->keypart_map; + DBUG_VOID_RETURN; +} + + +static range_seq_t partition_multi_range_key_init(void *init_params, + uint n_ranges, + uint flags) +{ + PARTITION_PART_KEY_MULTI_RANGE_HLD *hld= + (PARTITION_PART_KEY_MULTI_RANGE_HLD *)init_params; + ha_partition *partition= hld->partition; + uint i= hld->part_id; + DBUG_ENTER("partition_multi_range_key_init"); + partition->m_mrr_range_init_flags= flags; + hld->partition_part_key_multi_range= partition->m_part_mrr_range_first[i]; + DBUG_RETURN(init_params); +} + + +static bool partition_multi_range_key_next(range_seq_t seq, + KEY_MULTI_RANGE *range) +{ + PARTITION_PART_KEY_MULTI_RANGE_HLD *hld= + (PARTITION_PART_KEY_MULTI_RANGE_HLD *)seq; + PARTITION_KEY_MULTI_RANGE *partition_key_multi_range= + hld->partition_part_key_multi_range->partition_key_multi_range; + DBUG_ENTER("partition_multi_range_key_next"); + if (!partition_key_multi_range) + DBUG_RETURN(TRUE); + *range= partition_key_multi_range->key_multi_range; + hld->partition_part_key_multi_range= + hld->partition_part_key_multi_range->next; + DBUG_RETURN(FALSE); +} + + +static bool partition_multi_range_key_skip_record(range_seq_t seq, + range_id_t range_info, + uchar *rowid) +{ + PARTITION_PART_KEY_MULTI_RANGE_HLD *hld= + (PARTITION_PART_KEY_MULTI_RANGE_HLD *)seq; + DBUG_ENTER("partition_multi_range_key_skip_record"); + DBUG_RETURN(hld->partition->m_seq_if->skip_record(hld->partition->m_seq, + range_info, rowid)); +} + + +static bool partition_multi_range_key_skip_index_tuple(range_seq_t seq, + range_id_t range_info) +{ + PARTITION_PART_KEY_MULTI_RANGE_HLD *hld= + (PARTITION_PART_KEY_MULTI_RANGE_HLD *)seq; + DBUG_ENTER("partition_multi_range_key_skip_index_tuple"); + DBUG_RETURN(hld->partition->m_seq_if->skip_index_tuple(hld->partition->m_seq, + range_info)); +} + +ha_rows ha_partition::multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *mrr_mode, + Cost_estimate *cost) +{ + int error; + uint i; + handler **file; + ha_rows rows= 0; + uint ret_mrr_mode= 0; + range_seq_t seq_it; + DBUG_ENTER("ha_partition::multi_range_read_info_const"); + DBUG_PRINT("enter", ("partition this: %p", this)); + + m_mrr_new_full_buffer_size= 0; + seq_it= seq->init(seq_init_param, n_ranges, *mrr_mode); + if ((error= multi_range_key_create_key(seq, seq_it))) + { + if (error == HA_ERR_END_OF_FILE) // No keys in range + { + rows= 0; + goto calc_cost; + } + /* + This error means that we can't do multi_range_read for the moment + (probably running out of memory) and we need to fallback to + normal reads + */ + DBUG_RETURN(HA_POS_ERROR); + } + m_part_seq_if.get_key_info= + seq->get_key_info ? partition_multi_range_key_get_key_info : NULL; + m_part_seq_if.init= partition_multi_range_key_init; + m_part_seq_if.next= partition_multi_range_key_next; + m_part_seq_if.skip_record= (seq->skip_record ? + partition_multi_range_key_skip_record : NULL); + m_part_seq_if.skip_index_tuple= (seq->skip_index_tuple ? + partition_multi_range_key_skip_index_tuple : + NULL); + file= m_file; + do + { + i= (uint)(file - m_file); + DBUG_PRINT("info",("partition part_id: %u", i)); + if (bitmap_is_set(&m_mrr_used_partitions, i)) + { + ha_rows tmp_rows; + uint tmp_mrr_mode; + m_mrr_buffer_size[i]= 0; + tmp_mrr_mode= *mrr_mode; + tmp_rows= (*file)-> + multi_range_read_info_const(keyno, &m_part_seq_if, + &m_partition_part_key_multi_range_hld[i], + m_part_mrr_range_length[i], + &m_mrr_buffer_size[i], + &tmp_mrr_mode, cost); + if (tmp_rows == HA_POS_ERROR) + DBUG_RETURN(HA_POS_ERROR); + rows+= tmp_rows; + ret_mrr_mode|= tmp_mrr_mode; + m_mrr_new_full_buffer_size+= m_mrr_buffer_size[i]; + } + } while (*(++file)); + *mrr_mode= ret_mrr_mode; + +calc_cost: + cost->reset(); + cost->avg_io_cost= 1; + if ((*mrr_mode & HA_MRR_INDEX_ONLY) && rows > 2) + cost->io_count= keyread_time(keyno, n_ranges, (uint) rows); + else + cost->io_count= read_time(keyno, n_ranges, rows); + cost->cpu_cost= (double) rows / TIME_FOR_COMPARE + 0.01; + DBUG_RETURN(rows); +} + + +ha_rows ha_partition::multi_range_read_info(uint keyno, uint n_ranges, + uint keys, + uint key_parts, uint *bufsz, + uint *mrr_mode, + Cost_estimate *cost) +{ + uint i; + handler **file; + ha_rows rows; + DBUG_ENTER("ha_partition::multi_range_read_info"); + DBUG_PRINT("enter", ("partition this: %p", this)); + + m_mrr_new_full_buffer_size= 0; + file= m_file; + do + { + i= (uint)(file - m_file); + if (bitmap_is_set(&(m_part_info->read_partitions), (i))) + { + m_mrr_buffer_size[i]= 0; + if ((rows= (*file)->multi_range_read_info(keyno, n_ranges, keys, + key_parts, + &m_mrr_buffer_size[i], + mrr_mode, cost))) + DBUG_RETURN(rows); + m_mrr_new_full_buffer_size+= m_mrr_buffer_size[i]; + } + } while (*(++file)); + + cost->reset(); + cost->avg_io_cost= 1; + if (*mrr_mode & HA_MRR_INDEX_ONLY) + cost->io_count= keyread_time(keyno, n_ranges, (uint) rows); + else + cost->io_count= read_time(keyno, n_ranges, rows); + DBUG_RETURN(0); +} + + +int ha_partition::multi_range_read_init(RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint mrr_mode, + HANDLER_BUFFER *buf) +{ + int error; + uint i; + handler **file; + uchar *tmp_buffer; + DBUG_ENTER("ha_partition::multi_range_read_init"); + DBUG_PRINT("enter", ("partition this: %p", this)); + + m_seq_if= seq; + m_seq= seq->init(seq_init_param, n_ranges, mrr_mode); + if ((error= multi_range_key_create_key(seq, m_seq))) + DBUG_RETURN(0); + + m_part_seq_if.get_key_info= (seq->get_key_info ? + partition_multi_range_key_get_key_info : + NULL); + m_part_seq_if.init= partition_multi_range_key_init; + m_part_seq_if.next= partition_multi_range_key_next; + m_part_seq_if.skip_record= (seq->skip_record ? + partition_multi_range_key_skip_record : + NULL); + m_part_seq_if.skip_index_tuple= (seq->skip_index_tuple ? + partition_multi_range_key_skip_index_tuple : + NULL); + + /* m_mrr_new_full_buffer_size was calculated in multi_range_read_info */ + if (m_mrr_full_buffer_size < m_mrr_new_full_buffer_size) + { + if (m_mrr_full_buffer) + my_free(m_mrr_full_buffer); + if (!(m_mrr_full_buffer= + (uchar *) my_malloc(m_mrr_new_full_buffer_size, MYF(MY_WME)))) + { + m_mrr_full_buffer_size= 0; + error= HA_ERR_OUT_OF_MEM; + goto error; + } + m_mrr_full_buffer_size= m_mrr_new_full_buffer_size; + } + + tmp_buffer= m_mrr_full_buffer; + file= m_file; + do + { + i= (uint)(file - m_file); + DBUG_PRINT("info",("partition part_id: %u", i)); + if (bitmap_is_set(&m_mrr_used_partitions, i)) + { + if (m_mrr_new_full_buffer_size) + { + if (m_mrr_buffer_size[i]) + { + m_mrr_buffer[i].buffer= tmp_buffer; + m_mrr_buffer[i].end_of_used_area= tmp_buffer; + tmp_buffer+= m_mrr_buffer_size[i]; + m_mrr_buffer[i].buffer_end= tmp_buffer; + } + } + else + m_mrr_buffer[i]= *buf; + + if ((error= (*file)-> + multi_range_read_init(&m_part_seq_if, + &m_partition_part_key_multi_range_hld[i], + m_part_mrr_range_length[i], + mrr_mode, + &m_mrr_buffer[i]))) + goto error; + m_stock_range_seq[i]= 0; + } + } while (*(++file)); + + m_multi_range_read_first= TRUE; + m_mrr_range_current= m_mrr_range_first; + m_index_scan_type= partition_read_multi_range; + m_mrr_mode= mrr_mode; + m_mrr_n_ranges= n_ranges; + DBUG_RETURN(0); + +error: + DBUG_RETURN(error); +} + + +int ha_partition::multi_range_read_next(range_id_t *range_info) +{ + int error; + DBUG_ENTER("ha_partition::multi_range_read_next"); + DBUG_PRINT("enter", ("partition this: %p partition m_mrr_mode: %u", + this, m_mrr_mode)); + + if ((m_mrr_mode & HA_MRR_SORTED)) + { + if (m_multi_range_read_first) + { + if ((error= handle_ordered_index_scan(table->record[0], FALSE))) + DBUG_RETURN(error); + if (!m_pre_calling) + m_multi_range_read_first= FALSE; + } + else if ((error= handle_ordered_next(table->record[0], eq_range))) + DBUG_RETURN(error); + *range_info= m_mrr_range_current->ptr; + } + else + { + if (m_multi_range_read_first) + { + if ((error= handle_unordered_scan_next_partition(table->record[0]))) + DBUG_RETURN(error); + if (!m_pre_calling) + m_multi_range_read_first= FALSE; + } + else if ((error= handle_unordered_next(table->record[0], FALSE))) + DBUG_RETURN(error); + + *range_info= + ((PARTITION_KEY_MULTI_RANGE *) m_range_info[m_last_part])->ptr; + } + DBUG_RETURN(0); +} + + +int ha_partition::multi_range_read_explain_info(uint mrr_mode, char *str, + size_t size) +{ + DBUG_ENTER("ha_partition::multi_range_read_explain_info"); + DBUG_RETURN(m_file[0]->multi_range_read_explain_info(mrr_mode, str, size)); +} + + +/** + Find and retrieve the Full Text Search relevance ranking for a search string + in a full text index. + + @param handler Full Text Search handler + @param record Search string + @param length Length of the search string + + @retval Relevance value +*/ + +float partition_ft_find_relevance(FT_INFO *handler, + uchar *record, uint length) +{ + st_partition_ft_info *info= (st_partition_ft_info *)handler; + uint m_last_part= ((ha_partition*) info->file)->last_part(); + FT_INFO *m_handler= info->part_ft_info[m_last_part]; + DBUG_ENTER("partition_ft_find_relevance"); + if (!m_handler) + DBUG_RETURN((float)-1.0); + DBUG_RETURN(m_handler->please->find_relevance(m_handler, record, length)); +} + + +/** + Retrieve the Full Text Search relevance ranking for the current + full text search. + + @param handler Full Text Search handler + + @retval Relevance value +*/ + +float partition_ft_get_relevance(FT_INFO *handler) +{ + st_partition_ft_info *info= (st_partition_ft_info *)handler; + uint m_last_part= ((ha_partition*) info->file)->last_part(); + FT_INFO *m_handler= info->part_ft_info[m_last_part]; + DBUG_ENTER("partition_ft_get_relevance"); + if (!m_handler) + DBUG_RETURN((float)-1.0); + DBUG_RETURN(m_handler->please->get_relevance(m_handler)); +} + + +/** + Free the memory for a full text search handler. + + @param handler Full Text Search handler +*/ + +void partition_ft_close_search(FT_INFO *handler) +{ + st_partition_ft_info *info= (st_partition_ft_info *)handler; + info->file->ft_close_search(handler); +} + + +/** + Free the memory for a full text search handler. + + @param handler Full Text Search handler +*/ + +void ha_partition::ft_close_search(FT_INFO *handler) +{ + uint i; + st_partition_ft_info *info= (st_partition_ft_info *)handler; + DBUG_ENTER("ha_partition::ft_close_search"); + + for (i= 0; i < m_tot_parts; i++) + { + FT_INFO *m_handler= info->part_ft_info[i]; + DBUG_ASSERT(!m_handler || + (m_handler->please && m_handler->please->close_search)); + if (m_handler && + m_handler->please && + m_handler->please->close_search) + m_handler->please->close_search(m_handler); + } + DBUG_VOID_RETURN; +} + + +/* Partition Full Text search function table */ +_ft_vft partition_ft_vft = +{ + NULL, // partition_ft_read_next + partition_ft_find_relevance, + partition_ft_close_search, + partition_ft_get_relevance, + NULL // partition_ft_reinit_search +}; + + +/** + Initialize a full text search. +*/ + +int ha_partition::ft_init() +{ + int error; + uint i= 0; + uint32 part_id; + DBUG_ENTER("ha_partition::ft_init"); + DBUG_PRINT("info", ("partition this: %p", this)); + + /* + For operations that may need to change data, we may need to extend + read_set. + */ + if (get_lock_type() == F_WRLCK) + { + /* + If write_set contains any of the fields used in partition and + subpartition expression, we need to set all bits in read_set because + the row may need to be inserted in a different [sub]partition. In + other words update_row() can be converted into write_row(), which + requires a complete record. + */ + if (bitmap_is_overlapping(&m_part_info->full_part_field_set, + table->write_set)) + bitmap_set_all(table->read_set); + else + { + /* + Some handlers only read fields as specified by the bitmap for the + read set. For partitioned handlers we always require that the + fields of the partition functions are read such that we can + calculate the partition id to place updated and deleted records. + */ + bitmap_union(table->read_set, &m_part_info->full_part_field_set); + } + } + + /* Now we see what the index of our first important partition is */ + DBUG_PRINT("info", ("m_part_info->read_partitions: %p", + (void *) m_part_info->read_partitions.bitmap)); + part_id= bitmap_get_first_set(&(m_part_info->read_partitions)); + DBUG_PRINT("info", ("m_part_spec.start_part %u", (uint) part_id)); + + if (part_id == MY_BIT_NONE) + { + error= 0; + goto err1; + } + + DBUG_PRINT("info", ("ft_init on partition %u", (uint) part_id)); + /* + ft_end() is needed for partitioning to reset internal data if scan + is already in use + */ + if (m_pre_calling) + { + if ((error= pre_ft_end())) + goto err1; + } + else + ft_end(); + m_index_scan_type= partition_ft_read; + for (i= part_id; i < m_tot_parts; i++) + { + if (bitmap_is_set(&(m_part_info->read_partitions), i)) + { + error= m_pre_calling ? m_file[i]->pre_ft_init() : m_file[i]->ft_init(); + if (error) + goto err2; + } + } + m_scan_value= 1; + m_part_spec.start_part= part_id; + m_part_spec.end_part= m_tot_parts - 1; + m_ft_init_and_first= TRUE; + DBUG_PRINT("info", ("m_scan_value: %u", m_scan_value)); + DBUG_RETURN(0); + +err2: + late_extra_no_cache(part_id); + while ((int)--i >= (int)part_id) + { + if (bitmap_is_set(&(m_part_info->read_partitions), i)) + { + if (m_pre_calling) + m_file[i]->pre_ft_end(); + else + m_file[i]->ft_end(); + } + } +err1: + m_scan_value= 2; + m_part_spec.start_part= NO_CURRENT_PART_ID; + DBUG_RETURN(error); +} + + +/** + Initialize a full text search during a bulk access request. +*/ + +int ha_partition::pre_ft_init() +{ + bool save_m_pre_calling; + int error; + DBUG_ENTER("ha_partition::pre_ft_init"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + error= ft_init(); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + + +/** + Terminate a full text search. +*/ + +void ha_partition::ft_end() +{ + handler **file; + DBUG_ENTER("ha_partition::ft_end"); + DBUG_PRINT("info", ("partition this: %p", this)); + + switch (m_scan_value) { + case 2: // Error + break; + case 1: // Table scan + if (NO_CURRENT_PART_ID != m_part_spec.start_part) + late_extra_no_cache(m_part_spec.start_part); + file= m_file; + do + { + if (bitmap_is_set(&(m_part_info->read_partitions), (uint)(file - m_file))) + { + if (m_pre_calling) + (*file)->pre_ft_end(); + else + (*file)->ft_end(); + } + } while (*(++file)); + break; + } + m_scan_value= 2; + m_part_spec.start_part= NO_CURRENT_PART_ID; + ft_current= 0; + DBUG_VOID_RETURN; +} + + +/** + Terminate a full text search during a bulk access request. +*/ + +int ha_partition::pre_ft_end() +{ + bool save_m_pre_calling; + DBUG_ENTER("ha_partition::pre_ft_end"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + ft_end(); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(0); +} + + +/** + Initialize a full text search using the extended API. + + @param flags Search flags + @param inx Key number + @param key Key value + + @return FT_INFO structure if successful + NULL otherwise +*/ + +FT_INFO *ha_partition::ft_init_ext(uint flags, uint inx, String *key) +{ + FT_INFO *ft_handler; + handler **file; + st_partition_ft_info *ft_target, **parent; + DBUG_ENTER("ha_partition::ft_init_ext"); + + if (ft_current) + parent= &ft_current->next; + else + parent= &ft_first; + + if (!(ft_target= *parent)) + { + FT_INFO **tmp_ft_info; + if (!(ft_target= (st_partition_ft_info *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &ft_target, + sizeof(st_partition_ft_info), + &tmp_ft_info, + sizeof(FT_INFO *) * m_tot_parts, + NullS))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR)); + DBUG_RETURN(NULL); + } + ft_target->part_ft_info= tmp_ft_info; + (*parent)= ft_target; + } + + ft_current= ft_target; + file= m_file; + do + { + if (bitmap_is_set(&(m_part_info->read_partitions), (uint)(file - m_file))) + { + if ((ft_handler= (*file)->ft_init_ext(flags, inx, key))) + (*file)->ft_handler= ft_handler; + else + (*file)->ft_handler= NULL; + ft_target->part_ft_info[file - m_file]= ft_handler; + } + else + { + (*file)->ft_handler= NULL; + ft_target->part_ft_info[file - m_file]= NULL; + } + } while (*(++file)); + + ft_target->please= &partition_ft_vft; + ft_target->file= this; + DBUG_RETURN((FT_INFO*)ft_target); +} + + +/** + Return the next record from the FT result set during an ordered index + pre-scan + + @param use_parallel Is it a parallel search + + @return >0 Error code + 0 Success +*/ + +int ha_partition::pre_ft_read(bool use_parallel) +{ + bool save_m_pre_calling; + int error; + DBUG_ENTER("ha_partition::pre_ft_read"); + DBUG_PRINT("info", ("partition this: %p", this)); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + m_pre_call_use_parallel= use_parallel; + error= ft_read(table->record[0]); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + + +/** + Return the first or next record in a full text search. + + @param buf Buffer where the record should be returned + + @return >0 Error code + 0 Success +*/ + +int ha_partition::ft_read(uchar *buf) +{ + handler *file; + int result= HA_ERR_END_OF_FILE, error; + uint part_id= m_part_spec.start_part; + DBUG_ENTER("ha_partition::ft_read"); + DBUG_PRINT("info", ("partition this: %p", this)); + DBUG_PRINT("info", ("part_id: %u", part_id)); + + if (part_id == NO_CURRENT_PART_ID) + { + /* + The original set of partitions to scan was empty and thus we report + the result here. + */ + DBUG_PRINT("info", ("NO_CURRENT_PART_ID")); + goto end; + } + + DBUG_ASSERT(m_scan_value == 1); + + if (m_ft_init_and_first) // First call to ft_read() + { + m_ft_init_and_first= FALSE; + if (!bulk_access_executing) + { + error= handle_pre_scan(FALSE, check_parallel_search()); + if (m_pre_calling || error) + DBUG_RETURN(error); + } + late_extra_cache(part_id); + } + + file= m_file[part_id]; + + while (TRUE) + { + if (!(result= file->ft_read(buf))) + { + /* Found row: remember position and return it. */ + m_part_spec.start_part= m_last_part= part_id; + table->status= 0; + DBUG_RETURN(0); + } + + /* + if we get here, then the current partition ft_next returned failure + */ + if (result == HA_ERR_RECORD_DELETED) + continue; // Probably MyISAM + + if (result != HA_ERR_END_OF_FILE) + goto end_dont_reset_start_part; // Return error + + /* End current partition */ + late_extra_no_cache(part_id); + DBUG_PRINT("info", ("stopping using partition %u", (uint) part_id)); + + /* Shift to next partition */ + while (++part_id < m_tot_parts && + !bitmap_is_set(&(m_part_info->read_partitions), part_id)) + ; + if (part_id >= m_tot_parts) + { + result= HA_ERR_END_OF_FILE; + break; + } + m_part_spec.start_part= m_last_part= part_id; + file= m_file[part_id]; + DBUG_PRINT("info", ("now using partition %u", (uint) part_id)); + late_extra_cache(part_id); + } + +end: + m_part_spec.start_part= NO_CURRENT_PART_ID; +end_dont_reset_start_part: + table->status= STATUS_NOT_FOUND; + DBUG_RETURN(result); +} + /* Common routine to set up index scans @@ -5878,7 +6939,7 @@ int ha_partition::read_range_next() needs it to calculcate partitioning function values) - idx_read_flag TRUE <=> m_start_key has range start endpoint which + idx_read_flag TRUE <=> m_start_key has range start endpoint which probably can be used to determine the set of partitions to scan. FALSE <=> there is no start endpoint. @@ -5900,7 +6961,7 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) DBUG_ENTER("ha_partition::partition_scan_set_up"); if (idx_read_flag) - get_partition_set(table,buf,active_index,&m_start_key,&m_part_spec); + get_partition_set(table, buf, active_index, &m_start_key, &m_part_spec); else { m_part_spec.start_part= 0; @@ -5921,8 +6982,8 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) We discovered a single partition to scan, this never needs to be performed using the ordered index scan. */ - DBUG_PRINT("info", ("index scan using the single partition %d", - m_part_spec.start_part)); + DBUG_PRINT("info", ("index scan using the single partition %u", + (uint) m_part_spec.start_part)); m_ordered_scan_ongoing= FALSE; } else @@ -5949,6 +7010,206 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) DBUG_RETURN(0); } +/** + Check if we can search partitions in parallel + + @retval TRUE yes + @retval FALSE no +*/ + +bool ha_partition::check_parallel_search() +{ + TABLE_LIST *table_list= table->pos_in_table_list; + st_select_lex *select_lex; + JOIN *join; + DBUG_ENTER("ha_partition::check_parallel_search"); + if (!table_list) + goto not_parallel; + + while (table_list->parent_l) + table_list= table_list->parent_l; + + select_lex= table_list->select_lex; + DBUG_PRINT("info",("partition select_lex: %p", select_lex)); + if (!select_lex) + goto not_parallel; + if (!select_lex->explicit_limit) + { + DBUG_PRINT("info",("partition not using explicit_limit")); + goto parallel; + } + + join= select_lex->join; + DBUG_PRINT("info",("partition join: %p", join)); + if (join && join->skip_sort_order) + { + DBUG_PRINT("info",("partition order_list.elements: %u", + select_lex->order_list.elements)); + if (select_lex->order_list.elements) + { + Item *item= *select_lex->order_list.first->item; + DBUG_PRINT("info",("partition item: %p", item)); + DBUG_PRINT("info",("partition item->type(): %u", item->type())); + DBUG_PRINT("info",("partition m_part_info->part_type: %u", + m_part_info->part_type)); + DBUG_PRINT("info",("partition m_is_sub_partitioned: %s", + m_is_sub_partitioned ? "TRUE" : "FALSE")); + DBUG_PRINT("info",("partition m_part_info->part_expr: %p", + m_part_info->part_expr)); + if (item->type() == Item::FIELD_ITEM && + m_part_info->part_type == RANGE_PARTITION && + !m_is_sub_partitioned && + (!m_part_info->part_expr || + m_part_info->part_expr->type() == Item::FIELD_ITEM)) + { + Field *order_field= ((Item_field *)item)->field; + DBUG_PRINT("info",("partition order_field: %p", order_field)); + if (order_field && order_field->table == table_list->table) + { + Field *part_field= m_part_info->full_part_field_array[0]; + if (set_top_table_fields) + order_field= top_table_field[order_field->field_index]; + DBUG_PRINT("info",("partition order_field: %p", order_field)); + DBUG_PRINT("info",("partition part_field: %p", part_field)); + if (part_field == order_field) + { + /* + We are using ORDER BY partition_field LIMIT # + In this case, let's not do things in parallel as it's + likely that the query can be satisfied from the first + partition + */ + DBUG_PRINT("info",("partition with ORDER on partition field")); + goto not_parallel; + } + } + } + DBUG_PRINT("info",("partition have order")); + goto parallel; + } + + DBUG_PRINT("info",("partition group_list.elements: %u", + select_lex->group_list.elements)); + if (select_lex->group_list.elements) + { + Item *item= *select_lex->group_list.first->item; + DBUG_PRINT("info",("partition item: %p", item)); + DBUG_PRINT("info",("partition item->type(): %u", item->type())); + DBUG_PRINT("info",("partition m_part_info->part_type: %u", + m_part_info->part_type)); + DBUG_PRINT("info",("partition m_is_sub_partitioned: %s", + m_is_sub_partitioned ? "TRUE" : "FALSE")); + DBUG_PRINT("info",("partition m_part_info->part_expr: %p", + m_part_info->part_expr)); + if (item->type() == Item::FIELD_ITEM && + m_part_info->part_type == RANGE_PARTITION && + !m_is_sub_partitioned && + (!m_part_info->part_expr || + m_part_info->part_expr->type() == Item::FIELD_ITEM)) + { + Field *group_field= ((Item_field *)item)->field; + DBUG_PRINT("info",("partition group_field: %p", group_field)); + if (group_field && group_field->table == table_list->table) + { + Field *part_field= m_part_info->full_part_field_array[0]; + if (set_top_table_fields) + group_field= top_table_field[group_field->field_index]; + DBUG_PRINT("info",("partition group_field: %p", group_field)); + DBUG_PRINT("info",("partition part_field: %p", part_field)); + if (part_field == group_field) + { + DBUG_PRINT("info",("partition with GROUP BY on partition field")); + goto not_parallel; + } + } + } + DBUG_PRINT("info",("partition with GROUP BY")); + goto parallel; + } + } + else if (select_lex->order_list.elements || + select_lex->group_list.elements) + { + DBUG_PRINT("info",("partition is not skip_order")); + DBUG_PRINT("info",("partition order_list.elements: %u", + select_lex->order_list.elements)); + DBUG_PRINT("info",("partition group_list.elements: %u", + select_lex->group_list.elements)); + goto parallel; + } + DBUG_PRINT("info",("partition is not skip_order")); + +not_parallel: + DBUG_PRINT("return",("partition FALSE")); + DBUG_RETURN(FALSE); + +parallel: + DBUG_PRINT("return",("partition TRUE")); + DBUG_RETURN(TRUE); +} + + +int ha_partition::handle_pre_scan(bool reverse_order, bool use_parallel) +{ + uint i; + DBUG_ENTER("ha_partition::handle_pre_scan"); + DBUG_PRINT("enter", + ("m_part_spec.start_part: %u m_part_spec.end_part: %u", + (uint) m_part_spec.start_part, (uint) m_part_spec.end_part)); + + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + if (!(bitmap_is_set(&(m_part_info->read_partitions), i))) + continue; + int error; + handler *file= m_file[i]; + + switch (m_index_scan_type) { + case partition_index_read: + error= file->pre_index_read_map(m_start_key.key, + m_start_key.keypart_map, + m_start_key.flag, + use_parallel); + break; + case partition_index_first: + error= file->pre_index_first(use_parallel); + break; + case partition_index_last: + error= file->pre_index_last(use_parallel); + break; + case partition_index_read_last: + error= file->pre_index_read_last_map(m_start_key.key, + m_start_key.keypart_map, + use_parallel); + break; + case partition_read_range: + error= file->pre_read_range_first(m_start_key.key? &m_start_key: NULL, + end_range, eq_range, TRUE, use_parallel); + break; + case partition_read_multi_range: + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + continue; + error= file->pre_multi_range_read_next(use_parallel); + break; + case partition_ft_read: + error= file->pre_ft_read(use_parallel); + break; + case partition_no_index_scan: + error= file->pre_rnd_next(use_parallel); + break; + default: + DBUG_ASSERT(FALSE); + DBUG_RETURN(0); + } + if (error == HA_ERR_END_OF_FILE) + error= 0; + if (error) + DBUG_RETURN(error); + } + table->status= 0; + DBUG_RETURN(0); +} + /**************************************************************************** Unordered Index Scan Routines @@ -5995,7 +7256,16 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) partition_read_range is_next_same are always local constants */ - if (m_index_scan_type == partition_read_range) + if (m_index_scan_type == partition_read_multi_range) + { + if (!(error= file-> + multi_range_read_next(&m_range_info[m_part_spec.start_part]))) + { + m_last_part= m_part_spec.start_part; + DBUG_RETURN(0); + } + } + else if (m_index_scan_type == partition_read_range) { if (!(error= file->read_range_next())) { @@ -6012,7 +7282,7 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) DBUG_RETURN(0); } } - else + else { if (!(error= file->ha_index_next(buf))) { @@ -6035,7 +7305,7 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same) SYNOPSIS handle_unordered_scan_next_partition() - buf Read row in MySQL Row Format + buf Read row in MariaDB Row Format RETURN VALUE HA_ERR_END_OF_FILE End of scan @@ -6053,6 +7323,7 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) int saved_error= HA_ERR_END_OF_FILE; DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition"); + /* Read next partition that includes start_part */ if (i) i= bitmap_get_next_set(&m_part_info->read_partitions, i - 1); else @@ -6065,34 +7336,29 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) int error; handler *file= m_file[i]; m_part_spec.start_part= i; + switch (m_index_scan_type) { + case partition_read_multi_range: + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + continue; + DBUG_PRINT("info", ("read_multi_range on partition %u", i)); + error= file->multi_range_read_next(&m_range_info[i]); + break; case partition_read_range: - DBUG_PRINT("info", ("read_range_first on partition %d", i)); + DBUG_PRINT("info", ("read_range_first on partition %u", i)); error= file->read_range_first(m_start_key.key? &m_start_key: NULL, end_range, eq_range, FALSE); break; case partition_index_read: - DBUG_PRINT("info", ("index_read on partition %d", i)); + DBUG_PRINT("info", ("index_read on partition %u", i)); error= file->ha_index_read_map(buf, m_start_key.key, m_start_key.keypart_map, m_start_key.flag); break; case partition_index_first: - DBUG_PRINT("info", ("index_first on partition %d", i)); + DBUG_PRINT("info", ("index_first on partition %u", i)); error= file->ha_index_first(buf); break; - case partition_index_first_unordered: - /* - We perform a scan without sorting and this means that we - should not use the index_first since not all handlers - support it and it is also unnecessary to restrict sort - order. - */ - DBUG_PRINT("info", ("read_range_first on partition %d", i)); - table->record[0]= buf; - error= file->read_range_first(0, end_range, eq_range, 0); - table->record[0]= m_rec0; - break; default: DBUG_ASSERT(FALSE); DBUG_RETURN(1); @@ -6106,12 +7372,12 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) DBUG_RETURN(error); /* - If HA_ERR_KEY_NOT_FOUND, we must return that error instead of + If HA_ERR_KEY_NOT_FOUND, we must return that error instead of HA_ERR_END_OF_FILE, to be able to continue search. */ if (saved_error != HA_ERR_KEY_NOT_FOUND) saved_error= error; - DBUG_PRINT("info", ("END_OF_FILE/KEY_NOT_FOUND on partition %d", i)); + DBUG_PRINT("info", ("END_OF_FILE/KEY_NOT_FOUND on partition %u", i)); } if (saved_error == HA_ERR_END_OF_FILE) m_part_spec.start_part= NO_CURRENT_PART_ID; @@ -6122,7 +7388,7 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) /** Common routine to start index scan with ordered results. - @param[out] buf Read row in MySQL Row Format + @param[out] buf Read row in MariaDB Row Format @return Operation status @retval HA_ERR_END_OF_FILE End of scan @@ -6148,19 +7414,31 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf) int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) { + int error; uint i; uint j= queue_first_element(&m_queue); + uint smallest_range_seq= 0; bool found= FALSE; uchar *part_rec_buf_ptr= m_ordered_rec_buffer; int saved_error= HA_ERR_END_OF_FILE; DBUG_ENTER("ha_partition::handle_ordered_index_scan"); + DBUG_PRINT("enter", ("partition this: %p", this)); + + if (m_pre_calling) + error= handle_pre_scan(reverse_order, m_pre_call_use_parallel); + else + error= handle_pre_scan(reverse_order, check_parallel_search()); + if (error) + DBUG_RETURN(error); if (m_key_not_found) { + /* m_key_not_found was set in the previous call to this function */ m_key_not_found= false; bitmap_clear_all(&m_key_not_found_partitions); } m_top_entry= NO_CURRENT_PART_ID; + DBUG_PRINT("info", ("partition queue_remove_all(1)")); queue_remove_all(&m_queue); DBUG_ASSERT(bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)); @@ -6180,14 +7458,14 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) DBUG_PRINT("info", ("m_part_spec.start_part %u first_used_part %u", m_part_spec.start_part, i)); for (/* continue from above */ ; - i <= m_part_spec.end_part; - i= bitmap_get_next_set(&m_part_info->read_partitions, i)) + i <= m_part_spec.end_part ; + i= bitmap_get_next_set(&m_part_info->read_partitions, i), + part_rec_buf_ptr+= m_priority_queue_rec_len) { DBUG_PRINT("info", ("reading from part %u (scan_type: %u)", i, m_index_scan_type)); DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr)); uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS; - int error; handler *file= m_file[i]; switch (m_index_scan_type) { @@ -6196,6 +7474,7 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) m_start_key.key, m_start_key.keypart_map, m_start_key.flag); + /* Caller has specified reverse_order */ break; case partition_index_first: error= file->ha_index_first(rec_buf_ptr); @@ -6207,16 +7486,49 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) break; case partition_read_range: { - /* + /* This can only read record to table->record[0], as it was set when the table was being opened. We have to memcpy data ourselves. */ error= file->read_range_first(m_start_key.key? &m_start_key: NULL, end_range, eq_range, TRUE); - memcpy(rec_buf_ptr, table->record[0], m_rec_length); + if (!error) + memcpy(rec_buf_ptr, table->record[0], m_rec_length); reverse_order= FALSE; break; } + case partition_read_multi_range: + { + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + continue; + DBUG_PRINT("info", ("partition %u", i)); + error= file->multi_range_read_next(&m_range_info[i]); + DBUG_PRINT("info", ("error: %d", error)); + if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE) + { + bitmap_clear_bit(&m_mrr_used_partitions, i); + continue; + } + if (!error) + { + memcpy(rec_buf_ptr, table->record[0], m_rec_length); + reverse_order= FALSE; + m_stock_range_seq[i]= (((PARTITION_KEY_MULTI_RANGE *) + m_range_info[i])->id); + /* Test if the key is in the first key range */ + if (m_stock_range_seq[i] != m_mrr_range_current->id) + { + /* + smallest_range_seq contains the smallest key range we have seen + so far + */ + if (!smallest_range_seq || smallest_range_seq > m_stock_range_seq[i]) + smallest_range_seq= m_stock_range_seq[i]; + continue; + } + } + break; + } default: DBUG_ASSERT(FALSE); DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -6234,10 +7546,6 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) */ queue_element(&m_queue, j++)= part_rec_buf_ptr; } - else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) - { - DBUG_RETURN(error); - } else if (error == HA_ERR_KEY_NOT_FOUND) { DBUG_PRINT("info", ("HA_ERR_KEY_NOT_FOUND from partition %u", i)); @@ -6245,7 +7553,53 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) m_key_not_found= true; saved_error= error; } - part_rec_buf_ptr+= m_priority_queue_rec_len; + else if (error != HA_ERR_END_OF_FILE) + { + DBUG_RETURN(error); + } + } + + if (!found && smallest_range_seq) + { + /* We know that there is an existing row based on code above */ + found= TRUE; + part_rec_buf_ptr= m_ordered_rec_buffer; + + /* + No key found in the first key range + Collect all partitions that has a key in smallest_range_seq + */ + DBUG_PRINT("info", ("partition !found && smallest_range_seq")); + for (i= bitmap_get_first_set(&m_part_info->read_partitions); + i <= m_part_spec.end_part; + i= bitmap_get_next_set(&m_part_info->read_partitions, i)) + { + DBUG_PRINT("info", ("partition current_part: %u", i)); + if (i < m_part_spec.start_part) + { + part_rec_buf_ptr+= m_priority_queue_rec_len; + DBUG_PRINT("info", ("partition i < m_part_spec.start_part")); + continue; + } + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + { + part_rec_buf_ptr+= m_priority_queue_rec_len; + DBUG_PRINT("info", ("partition !bitmap_is_set(&m_mrr_used_partitions, i)")); + continue; + } + DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr)); + if (smallest_range_seq == m_stock_range_seq[i]) + { + m_stock_range_seq[i]= 0; + queue_element(&m_queue, j++)= (uchar *) part_rec_buf_ptr; + DBUG_PRINT("info", ("partition smallest_range_seq == m_stock_range_seq[i]")); + } + part_rec_buf_ptr+= m_priority_queue_rec_len; + } + + /* Update global m_mrr_range_current to the current range */ + while (m_mrr_range_current->id < smallest_range_seq) + m_mrr_range_current= m_mrr_range_current->next; } if (found) { @@ -6254,12 +7608,11 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) after that read the first entry and copy it to the buffer to return in. */ queue_set_max_at_top(&m_queue, reverse_order); - queue_set_cmp_arg(&m_queue, m_using_extended_keys? m_curr_key_info : (void*)this); + queue_set_cmp_arg(&m_queue, (void*) this); m_queue.elements= j - queue_first_element(&m_queue); queue_fix(&m_queue); return_top_record(buf); - table->status= 0; - DBUG_PRINT("info", ("Record returned from partition %d", m_top_entry)); + DBUG_PRINT("info", ("Record returned from partition %u", m_top_entry)); DBUG_RETURN(0); } DBUG_RETURN(saved_error); @@ -6282,11 +7635,28 @@ void ha_partition::return_top_record(uchar *buf) uint part_id; uchar *key_buffer= queue_top(&m_queue); uchar *rec_buffer= key_buffer + PARTITION_BYTES_IN_POS; + DBUG_ENTER("ha_partition::return_top_record"); + DBUG_PRINT("enter", ("partition this: %p", this)); part_id= uint2korr(key_buffer); memcpy(buf, rec_buffer, m_rec_length); m_last_part= part_id; + DBUG_PRINT("info", ("partition m_last_part: %u", m_last_part)); m_top_entry= part_id; + table->status= 0; // Found an existing row + m_file[part_id]->return_record_by_parent(); + DBUG_VOID_RETURN; +} + +/* + This function is only used if the partitioned table has own partitions. + This can happen if the partitioned VP engine is used (part of spider). +*/ + +void ha_partition::return_record_by_parent() +{ + m_file[m_last_part]->return_record_by_parent(); + DBUG_ASSERT(0); } @@ -6305,6 +7675,7 @@ int ha_partition::handle_ordered_index_scan_key_not_found() uchar *part_buf= m_ordered_rec_buffer; uchar *curr_rec_buf= NULL; DBUG_ENTER("ha_partition::handle_ordered_index_scan_key_not_found"); + DBUG_PRINT("enter", ("partition this: %p", this)); DBUG_ASSERT(m_key_not_found); /* Loop over all used partitions to get the correct offset @@ -6325,7 +7696,10 @@ int ha_partition::handle_ordered_index_scan_key_not_found() /* HA_ERR_KEY_NOT_FOUND is not allowed from index_next! */ DBUG_ASSERT(error != HA_ERR_KEY_NOT_FOUND); if (!error) + { + DBUG_PRINT("info", ("partition queue_insert(1)")); queue_insert(&m_queue, part_buf); + } else if (error != HA_ERR_END_OF_FILE && error != HA_ERR_KEY_NOT_FOUND) DBUG_RETURN(error); } @@ -6362,11 +7736,15 @@ int ha_partition::handle_ordered_index_scan_key_not_found() int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) { int error; + DBUG_ENTER("ha_partition::handle_ordered_next"); + + if (m_top_entry == NO_CURRENT_PART_ID) + DBUG_RETURN(HA_ERR_END_OF_FILE); + uint part_id= m_top_entry; uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS; handler *file; - DBUG_ENTER("ha_partition::handle_ordered_next"); - + if (m_key_not_found) { if (is_next_same) @@ -6408,6 +7786,122 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) error= file->read_range_next(); memcpy(rec_buf, table->record[0], m_rec_length); } + else if (m_index_scan_type == partition_read_multi_range) + { + DBUG_PRINT("info", ("partition_read_multi_range route")); + DBUG_PRINT("info", ("part_id: %u", part_id)); + bool get_next= FALSE; + error= file->multi_range_read_next(&m_range_info[part_id]); + DBUG_PRINT("info", ("error: %d", error)); + if (error == HA_ERR_KEY_NOT_FOUND) + error= HA_ERR_END_OF_FILE; + if (error == HA_ERR_END_OF_FILE) + { + bitmap_clear_bit(&m_mrr_used_partitions, part_id); + DBUG_PRINT("info", ("partition m_queue.elements: %u", m_queue.elements)); + if (m_queue.elements) + { + DBUG_PRINT("info", ("partition queue_remove_top(1)")); + queue_remove_top(&m_queue); + if (m_queue.elements) + { + return_top_record(buf); + DBUG_PRINT("info", ("Record returned from partition %u (3)", + m_top_entry)); + DBUG_RETURN(0); + } + } + get_next= TRUE; + } + else if (!error) + { + DBUG_PRINT("info", ("m_range_info[%u])->id: %u", part_id, + ((PARTITION_KEY_MULTI_RANGE *) + m_range_info[part_id])->id)); + DBUG_PRINT("info", ("m_mrr_range_current->id: %u", + m_mrr_range_current->id)); + memcpy(rec_buf, table->record[0], m_rec_length); + if (((PARTITION_KEY_MULTI_RANGE *) m_range_info[part_id])->id != + m_mrr_range_current->id) + { + m_stock_range_seq[part_id]= + ((PARTITION_KEY_MULTI_RANGE *) m_range_info[part_id])->id; + DBUG_PRINT("info", ("partition queue_remove_top(2)")); + queue_remove_top(&m_queue); + if (!m_queue.elements) + get_next= TRUE; + } + } + if (get_next) + { + DBUG_PRINT("info", ("get_next route")); + uint i, j= 0, smallest_range_seq= UINT_MAX32; + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + if (!(bitmap_is_set(&(m_part_info->read_partitions), i))) + continue; + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + continue; + if (smallest_range_seq > m_stock_range_seq[i]) + smallest_range_seq= m_stock_range_seq[i]; + } + + DBUG_PRINT("info", ("smallest_range_seq: %u", smallest_range_seq)); + if (smallest_range_seq != UINT_MAX32) + { + uchar *part_rec_buf_ptr= m_ordered_rec_buffer; + DBUG_PRINT("info", ("partition queue_remove_all(2)")); + queue_remove_all(&m_queue); + DBUG_PRINT("info", ("m_part_spec.start_part: %u", + m_part_spec.start_part)); + + for (i= bitmap_get_first_set(&m_part_info->read_partitions); + i <= m_part_spec.end_part; + i= bitmap_get_next_set(&m_part_info->read_partitions, i), + part_rec_buf_ptr+= m_priority_queue_rec_len) + { + DBUG_PRINT("info",("partition part_id: %u", i)); + if (i < m_part_spec.start_part) + { + DBUG_PRINT("info",("partition i < m_part_spec.start_part")); + continue; + } + if (!bitmap_is_set(&m_mrr_used_partitions, i)) + { + DBUG_PRINT("info",("partition !bitmap_is_set(&m_mrr_used_partitions, i)")); + continue; + } + DBUG_PRINT("info",("partition uint2korr: %u", + uint2korr(part_rec_buf_ptr))); + DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr)); + DBUG_PRINT("info", ("partition m_stock_range_seq[%u]: %u", + i, m_stock_range_seq[i])); + if (smallest_range_seq == m_stock_range_seq[i]) + { + m_stock_range_seq[i]= 0; + DBUG_PRINT("info", ("partition queue_insert(2)")); + queue_insert(&m_queue, part_rec_buf_ptr); + j++; + } + } + while (m_mrr_range_current->id < smallest_range_seq) + m_mrr_range_current= m_mrr_range_current->next; + + DBUG_PRINT("info",("partition m_mrr_range_current: %p", + m_mrr_range_current)); + DBUG_PRINT("info",("partition m_mrr_range_current->id: %u", + m_mrr_range_current ? m_mrr_range_current->id : 0)); + queue_set_max_at_top(&m_queue, FALSE); + queue_set_cmp_arg(&m_queue, (void*) this); + m_queue.elements= j; + queue_fix(&m_queue); + return_top_record(buf); + DBUG_PRINT("info", ("Record returned from partition %u (4)", + m_top_entry)); + DBUG_RETURN(0); + } + } + } else if (!is_next_same) error= file->ha_index_next(rec_buf); else @@ -6416,16 +7910,16 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) if (error) { - if (error == HA_ERR_END_OF_FILE) + if (error == HA_ERR_END_OF_FILE && m_queue.elements) { /* Return next buffered row */ + DBUG_PRINT("info", ("partition queue_remove_top(3)")); queue_remove_top(&m_queue); if (m_queue.elements) { + return_top_record(buf); DBUG_PRINT("info", ("Record returned from partition %u (2)", m_top_entry)); - return_top_record(buf); - table->status= 0; error= 0; } } @@ -6461,30 +7955,35 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) int ha_partition::handle_ordered_prev(uchar *buf) { int error; + DBUG_ENTER("ha_partition::handle_ordered_prev"); + DBUG_PRINT("enter", ("partition: %p", this)); + + if (m_top_entry == NO_CURRENT_PART_ID) + DBUG_RETURN(HA_ERR_END_OF_FILE); + uint part_id= m_top_entry; uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS; handler *file= m_file[part_id]; - DBUG_ENTER("ha_partition::handle_ordered_prev"); if ((error= file->ha_index_prev(rec_buf))) { - if (error == HA_ERR_END_OF_FILE) + if (error == HA_ERR_END_OF_FILE && m_queue.elements) { + DBUG_PRINT("info", ("partition queue_remove_top(4)")); queue_remove_top(&m_queue); if (m_queue.elements) { return_top_record(buf); - DBUG_PRINT("info", ("Record returned from partition %d (2)", + DBUG_PRINT("info", ("Record returned from partition %u (2)", m_top_entry)); error= 0; - table->status= 0; } } DBUG_RETURN(error); } queue_replace_top(&m_queue); return_top_record(buf); - DBUG_PRINT("info", ("Record returned from partition %d", m_top_entry)); + DBUG_PRINT("info", ("Record returned from partition %u", m_top_entry)); DBUG_RETURN(0); } @@ -6636,7 +8135,8 @@ int ha_partition::info(uint flag) { set_if_bigger(part_share->next_auto_inc_val, auto_increment_value); - part_share->auto_inc_initialized= true; + if (can_use_for_auto_inc_init()) + part_share->auto_inc_initialized= true; DBUG_PRINT("info", ("initializing next_auto_inc_val to %lu", (ulong) part_share->next_auto_inc_val)); } @@ -7145,7 +8645,7 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, HA_EXTRA_DELETE_CANNOT_BATCH: HA_EXTRA_UPDATE_CANNOT_BATCH: Inform handler that delete_row()/update_row() cannot batch deletes/updates - and should perform them immediately. This may be needed when table has + and should perform them immediately. This may be needed when table has AFTER DELETE/UPDATE triggers which access to subject table. These flags are reset by the handler::extra(HA_EXTRA_RESET) call. @@ -7161,7 +8661,7 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, int ha_partition::extra(enum ha_extra_function operation) { DBUG_ENTER("ha_partition:extra"); - DBUG_PRINT("info", ("operation: %d", (int) operation)); + DBUG_PRINT("enter", ("operation: %d", (int) operation)); switch (operation) { /* Category 1), used by most handlers */ @@ -7188,7 +8688,7 @@ int ha_partition::extra(enum ha_extra_function operation) /* Category 3), used by MyISAM handlers */ case HA_EXTRA_PREPARE_FOR_UPDATE: /* - Needs to be run on the first partition in the range now, and + Needs to be run on the first partition in the range now, and later in late_extra_cache, when switching to a new partition to scan. */ m_extra_prepare_for_update= TRUE; @@ -7257,18 +8757,9 @@ int ha_partition::extra(enum ha_extra_function operation) with row being inserted by PK/unique key without reporting error to the SQL-layer. - This optimization is not safe for partitioned table in general case - since we may have to put new version of row into partition which is - different from partition in which old version resides (for example - when we partition by non-PK column or by some column which is not - part of unique key which were violated). - And since NDB which is the only engine at the moment that supports - this optimization handles partitioning on its own we simple disable - it here. (BTW for NDB this optimization is safe since it supports - only KEY partitioning and won't use this optimization for tables - which have additional unique constraints). + At this time, this is safe by limitation of ha_partition */ - break; + DBUG_RETURN(loop_extra(operation)); } /* Category 7), used by federated handlers */ case HA_EXTRA_INSERT_WITH_UPDATE: @@ -7282,20 +8773,39 @@ int ha_partition::extra(enum ha_extra_function operation) } /* Category 9) Operations only used by MERGE */ case HA_EXTRA_ADD_CHILDREN_LIST: + DBUG_RETURN(loop_extra(operation)); case HA_EXTRA_ATTACH_CHILDREN: - case HA_EXTRA_IS_ATTACHED_CHILDREN: - case HA_EXTRA_DETACH_CHILDREN: { - /* Special actions for MERGE tables. Ignore. */ + int result; + uint num_locks; + handler **file; + if ((result= loop_extra(operation))) + DBUG_RETURN(result); + + /* Recalculate lock count as each child may have different set of locks */ + num_locks= 0; + file= m_file; + do + { + num_locks+= (*file)->lock_count(); + } while (*(++file)); + + m_num_locks= num_locks; break; } + case HA_EXTRA_IS_ATTACHED_CHILDREN: + DBUG_RETURN(loop_extra(operation)); + case HA_EXTRA_DETACH_CHILDREN: + DBUG_RETURN(loop_extra(operation)); + case HA_EXTRA_MARK_AS_LOG_TABLE: /* http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations.html says we no longer support logging to partitioned tables, so we fail here. */ - case HA_EXTRA_MARK_AS_LOG_TABLE: DBUG_RETURN(ER_UNSUPORTED_LOG_ENGINE); + case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: + DBUG_RETURN(loop_extra(operation)); default: { /* Temporary crash to discover what is wrong */ @@ -7376,7 +8886,7 @@ int ha_partition::extra_opt(enum ha_extra_function operation, ulong cachesize) void ha_partition::prepare_extra_cache(uint cachesize) { DBUG_ENTER("ha_partition::prepare_extra_cache()"); - DBUG_PRINT("info", ("cachesize %u", cachesize)); + DBUG_PRINT("enter", ("cachesize %u", cachesize)); m_extra_cache= TRUE; m_extra_cache_size= cachesize; @@ -7443,7 +8953,7 @@ int ha_partition::loop_extra(enum ha_extra_function operation) int result= 0, tmp; uint i; DBUG_ENTER("ha_partition::loop_extra()"); - + for (i= bitmap_get_first_set(&m_part_info->lock_partitions); i < m_tot_parts; i= bitmap_get_next_set(&m_part_info->lock_partitions, i)) @@ -7472,9 +8982,9 @@ void ha_partition::late_extra_cache(uint partition_id) { handler *file; DBUG_ENTER("ha_partition::late_extra_cache"); - DBUG_PRINT("info", ("extra_cache %u prepare %u partid %u size %u", - m_extra_cache, m_extra_prepare_for_update, - partition_id, m_extra_cache_size)); + DBUG_PRINT("enter", ("extra_cache %u prepare %u partid %u size %u", + m_extra_cache, m_extra_prepare_for_update, + partition_id, m_extra_cache_size)); if (!m_extra_cache && !m_extra_prepare_for_update) DBUG_VOID_RETURN; @@ -7671,7 +9181,7 @@ ha_rows ha_partition::records_in_range(uint inx, key_range *min_key, != NO_CURRENT_PART_ID) { rows= m_file[part_id]->records_in_range(inx, min_key, max_key); - + DBUG_PRINT("info", ("part %u match %lu rows of %lu", part_id, (ulong) rows, (ulong) m_file[part_id]->stats.records)); @@ -7773,7 +9283,8 @@ double ha_partition::read_time(uint index, uint ranges, ha_rows rows) ha_rows ha_partition::records() { - ha_rows rows, tot_rows= 0; + int error; + ha_rows tot_rows= 0; uint i; DBUG_ENTER("ha_partition::records"); @@ -7781,11 +9292,13 @@ ha_rows ha_partition::records() i < m_tot_parts; i= bitmap_get_next_set(&m_part_info->read_partitions, i)) { - rows= m_file[i]->records(); - if (rows == HA_POS_ERROR) + ha_rows rows; + if ((error= m_file[i]->pre_records()) || + (rows= m_file[i]->records()) == HA_POS_ERROR) DBUG_RETURN(HA_POS_ERROR); tot_rows+= rows; } + DBUG_PRINT("exit", ("records: %lld", (longlong) tot_rows)); DBUG_RETURN(tot_rows); } @@ -7809,7 +9322,7 @@ bool ha_partition::can_switch_engines() { handler **file; DBUG_ENTER("ha_partition::can_switch_engines"); - + file= m_file; do { @@ -8044,10 +9557,9 @@ void ha_partition::print_error(int error, myf errflag) { THD *thd= ha_thd(); DBUG_ENTER("ha_partition::print_error"); - - /* Should probably look for my own errors first */ DBUG_PRINT("enter", ("error: %d", error)); + /* Should probably look for my own errors first */ if ((error == HA_ERR_NO_PARTITION_FOUND) && ! (thd->lex->alter_info.flags & Alter_info::ALTER_TRUNCATE_PARTITION)) { @@ -8534,7 +10046,7 @@ uint ha_partition::min_record_length(uint options) const the same record. Otherwise we use the particular handler to decide if they are the same. Sort in partition id order if not equal. - MariaDB note: + MariaDB note: Please don't merge the code from MySQL that does this: We get two references and need to check if those records are the same. @@ -8548,15 +10060,18 @@ uint ha_partition::min_record_length(uint options) const int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2) { int cmp; - my_ptrdiff_t diff1, diff2; + uint32 diff1, diff2; DBUG_ENTER("ha_partition::cmp_ref"); - cmp = m_file[0]->cmp_ref((ref1 + PARTITION_BYTES_IN_POS), - (ref2 + PARTITION_BYTES_IN_POS)); + cmp= m_file[0]->cmp_ref((ref1 + PARTITION_BYTES_IN_POS), + (ref2 + PARTITION_BYTES_IN_POS)); if (cmp) DBUG_RETURN(cmp); - if ((ref1[0] == ref2[0]) && (ref1[1] == ref2[1])) + diff2= uint2korr(ref2); + diff1= uint2korr(ref1); + + if (diff1 == diff2) { /* This means that the references are same and are in same partition.*/ DBUG_RETURN(0); @@ -8569,22 +10084,7 @@ int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2) Remove this assert if DB_ROW_ID is changed to be per partition. */ DBUG_ASSERT(!m_innodb); - - diff1= ref2[1] - ref1[1]; - diff2= ref2[0] - ref1[0]; - if (diff1 > 0) - { - DBUG_RETURN(-1); - } - if (diff1 < 0) - { - DBUG_RETURN(+1); - } - if (diff2 > 0) - { - DBUG_RETURN(-1); - } - DBUG_RETURN(+1); + DBUG_RETURN(diff2 > diff1 ? -1 : 1); } @@ -8593,6 +10093,82 @@ int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2) ****************************************************************************/ +/** + Retreive new values for part_share->next_auto_inc_val if needed + + This is needed if the value has not been initialized or if one of + the underlying partitions require that the value should be re-calculated +*/ + +void ha_partition::update_next_auto_inc_val() +{ + if (!part_share->auto_inc_initialized || + need_info_for_auto_inc()) + info(HA_STATUS_AUTO); +} + + +/** + Determine whether a partition needs auto-increment initialization. + + @return + TRUE A partition needs auto-increment initialization + FALSE No partition needs auto-increment initialization + + Resets part_share->auto_inc_initialized if next auto_increment needs to be + recalculated. +*/ + +bool ha_partition::need_info_for_auto_inc() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::need_info_for_auto_inc"); + + do + { + if ((*file)->need_info_for_auto_inc()) + { + /* We have to get new auto_increment values from handler */ + part_share->auto_inc_initialized= FALSE; + DBUG_RETURN(TRUE); + } + } while (*(++file)); + DBUG_RETURN(FALSE); +} + + +/** + Determine if all partitions can use the current auto-increment value for + auto-increment initialization. + + @return + TRUE All partitions can use the current auto-increment + value for auto-increment initialization + FALSE All partitions cannot use the current + auto-increment value for auto-increment + initialization + + Notes + This function is only called for ::info(HA_STATUS_AUTO) and is + mainly used by the Spider engine, which returns false + except in the case of DROP TABLE or ALTER TABLE when it returns TRUE. + Other engines always returns TRUE for this call. +*/ + +bool ha_partition::can_use_for_auto_inc_init() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::can_use_for_auto_inc_init"); + + do + { + if (!(*file)->can_use_for_auto_inc_init()) + DBUG_RETURN(FALSE); + } while (*(++file)); + DBUG_RETURN(TRUE); +} + + int ha_partition::reset_auto_increment(ulonglong value) { handler **file= m_file; @@ -8626,8 +10202,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment, ulonglong *nb_reserved_values) { DBUG_ENTER("ha_partition::get_auto_increment"); - DBUG_PRINT("info", ("offset: %lu inc: %lu desired_values: %lu " - "first_value: %lu", (ulong) offset, (ulong) increment, + DBUG_PRINT("enter", ("offset: %lu inc: %lu desired_values: %lu " + "first_value: %lu", (ulong) offset, (ulong) increment, (ulong) nb_desired_values, (ulong) *first_value)); DBUG_ASSERT(increment && nb_desired_values); *first_value= 0; @@ -8671,7 +10247,7 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment, /* Get a lock for handling the auto_increment in part_share for avoiding two concurrent statements getting the same number. - */ + */ lock_auto_increment(); @@ -8682,8 +10258,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment, based replication. Because the statement-based binary log contains only the first generated value used by the statement, and slaves assumes all other generated values used by this statement were consecutive to - this first one, we must exclusively lock the generator until the statement - is done. + this first one, we must exclusively lock the generator until the + statement is done. */ if (!auto_increment_safe_stmt_log_lock && thd->lex->sql_command != SQLCOM_INSERT && @@ -8946,8 +10522,8 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair) } else { - DBUG_PRINT("info", ("Moving row from partition %d to %d", - read_part_id, correct_part_id)); + DBUG_PRINT("info", ("Moving row from partition %u to %u", + (uint) read_part_id, (uint) correct_part_id)); /* Insert row into correct partition. Notice that there are no commit @@ -8978,19 +10554,19 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair) { /* Log this error, so the DBA can notice it and fix it! */ sql_print_error("Table '%-192s' failed to move/insert a row" - " from part %d into part %d:\n%s", + " from part %u into part %u:\n%s", table->s->table_name.str, - read_part_id, - correct_part_id, + (uint) read_part_id, + (uint) correct_part_id, str.c_ptr_safe()); } print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "error", table_share->db.str, table->alias, opt_op_name[REPAIR_PARTS], "Failed to move/insert a row" - " from part %d into part %d:\n%s", - read_part_id, - correct_part_id, + " from part %u into part %u:\n%s", + (uint) read_part_id, + (uint) correct_part_id, str.c_ptr_safe()); break; } @@ -9011,14 +10587,14 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair) append_row_to_str(str); /* Log this error, so the DBA can notice it and fix it! */ - sql_print_error("Table '%-192s': Delete from part %d failed with" + sql_print_error("Table '%-192s': Delete from part %u failed with" " error %d. But it was already inserted into" - " part %d, when moving the misplaced row!" + " part %u, when moving the misplaced row!" "\nPlease manually fix the duplicate row:\n%s", table->s->table_name.str, - read_part_id, + (uint) read_part_id, result, - correct_part_id, + (uint) correct_part_id, str.c_ptr_safe()); break; } @@ -9148,6 +10724,670 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt) } +TABLE_LIST *ha_partition::get_next_global_for_child() +{ + handler **file; + DBUG_ENTER("ha_partition::get_next_global_for_child"); + for (file= m_file; *file; file++) + { + TABLE_LIST *table_list; + if ((table_list= (*file)->get_next_global_for_child())) + DBUG_RETURN(table_list); + } + DBUG_RETURN(0); +} + + +const COND *ha_partition::cond_push(const COND *cond) +{ + handler **file= m_file; + COND *res_cond= NULL; + DBUG_ENTER("ha_partition::cond_push"); + + if (set_top_table_fields) + { + /* + We want to do this in a separate loop to not come into a situation + where we have only done cond_push() to some of the tables + */ + do + { + if (((*file)->set_top_table_and_fields(top_table, + top_table_field, + top_table_fields))) + DBUG_RETURN(cond); // Abort cond push, no error + } while (*(++file)); + file= m_file; + } + + do + { + if ((*file)->pushed_cond != cond) + { + if ((*file)->cond_push(cond)) + res_cond= (COND *) cond; + else + (*file)->pushed_cond= cond; + } + } while (*(++file)); + DBUG_RETURN(res_cond); +} + + +void ha_partition::cond_pop() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::cond_push"); + + do + { + (*file)->cond_pop(); + } while (*(++file)); + DBUG_VOID_RETURN; +} + + +/** + Perform bulk update preparation on each partition. + + SYNOPSIS + start_bulk_update() + + RETURN VALUE + TRUE Error + FALSE Success +*/ + +bool ha_partition::start_bulk_update() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::start_bulk_update"); + + if (bitmap_is_overlapping(&m_part_info->full_part_field_set, + table->write_set)) + DBUG_RETURN(TRUE); + + do + { + if ((*file)->start_bulk_update()) + DBUG_RETURN(TRUE); + } while (*(++file)); + DBUG_RETURN(FALSE); +} + + +/** + Perform bulk update execution on each partition. A bulk update allows + a handler to batch the updated rows instead of performing the updates + one row at a time. + + SYNOPSIS + exec_bulk_update() + + RETURN VALUE + TRUE Error + FALSE Success +*/ + +int ha_partition::exec_bulk_update(ha_rows *dup_key_found) +{ + int error; + handler **file= m_file; + DBUG_ENTER("ha_partition::exec_bulk_update"); + + do + { + if ((error= (*file)->exec_bulk_update(dup_key_found))) + DBUG_RETURN(error); + } while (*(++file)); + DBUG_RETURN(0); +} + + +/** + Perform bulk update cleanup on each partition. + + SYNOPSIS + end_bulk_update() + + RETURN VALUE + NONE +*/ + +int ha_partition::end_bulk_update() +{ + int error= 0; + handler **file= m_file; + DBUG_ENTER("ha_partition::end_bulk_update"); + + do + { + int tmp; + if ((tmp= (*file)->end_bulk_update())) + error= tmp; + } while (*(++file)); + DBUG_RETURN(error); +} + + +/** + Add the row to the bulk update on the partition on which the row is stored. + A bulk update allows a handler to batch the updated rows instead of + performing the updates one row at a time. + + SYNOPSIS + bulk_update_row() + old_data Old record + new_data New record + dup_key_found Number of duplicate keys found + + RETURN VALUE + >1 Error + 1 Bulk update not used, normal operation used + 0 Bulk update used by handler +*/ + +int ha_partition::bulk_update_row(const uchar *old_data, const uchar *new_data, + ha_rows *dup_key_found) +{ + int error= 0; + uint32 part_id; + longlong func_value; + my_bitmap_map *old_map; + DBUG_ENTER("ha_partition::bulk_update_row"); + + old_map= dbug_tmp_use_all_columns(table, table->read_set); + error= m_part_info->get_partition_id(m_part_info, &part_id, + &func_value); + dbug_tmp_restore_column_map(table->read_set, old_map); + if (unlikely(error)) + { + m_part_info->err_value= func_value; + goto end; + } + + error= m_file[part_id]->ha_bulk_update_row(old_data, new_data, + dup_key_found); + +end: + DBUG_RETURN(error); +} + + +/** + Perform bulk delete preparation on each partition. + + SYNOPSIS + start_bulk_delete() + + RETURN VALUE + TRUE Error + FALSE Success +*/ + +bool ha_partition::start_bulk_delete() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::start_bulk_delete"); + + do + { + if ((*file)->start_bulk_delete()) + DBUG_RETURN(TRUE); + } while (*(++file)); + DBUG_RETURN(FALSE); +} + + +/** + Perform bulk delete cleanup on each partition. + + SYNOPSIS + end_bulk_delete() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::end_bulk_delete() +{ + int error= 0; + handler **file= m_file; + DBUG_ENTER("ha_partition::end_bulk_delete"); + + do + { + int tmp; + if ((tmp= (*file)->end_bulk_delete())) + error= tmp; + } while (*(++file)); + DBUG_RETURN(error); +} + + +/** + Perform initialization for a direct update request. + + SYNOPSIS + direct_update_rows_init() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::direct_update_rows_init() +{ + int error; + uint i, found; + handler *file; + DBUG_ENTER("ha_partition::direct_update_rows_init"); + + if (bitmap_is_overlapping(&m_part_info->full_part_field_set, + table->write_set)) + { + DBUG_PRINT("info", ("partition FALSE by updating part_key")); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + + m_part_spec.start_part= 0; + m_part_spec.end_part= m_tot_parts - 1; + m_direct_update_part_spec= m_part_spec; + + found= 0; + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + if (bitmap_is_set(&(m_part_info->read_partitions), i) && + bitmap_is_set(&(m_part_info->lock_partitions), i)) + { + file= m_file[i]; + if ((error= (m_pre_calling ? + file->pre_direct_update_rows_init() : + file->direct_update_rows_init()))) + { + DBUG_PRINT("info", ("partition FALSE by storage engine")); + DBUG_RETURN(error); + } + found++; + } + } + + TABLE_LIST *table_list= table->pos_in_table_list; + if (found != 1 && table_list) + { + while (table_list->parent_l) + table_list= table_list->parent_l; + st_select_lex *select_lex= table_list->select_lex; + DBUG_PRINT("info", ("partition select_lex: %p", select_lex)); + if (select_lex && select_lex->explicit_limit) + { + DBUG_PRINT("info", ("partition explicit_limit=TRUE")); + DBUG_PRINT("info", ("partition offset_limit: %p", + select_lex->offset_limit)); + DBUG_PRINT("info", ("partition select_limit: %p", + select_lex->select_limit)); + DBUG_PRINT("info", ("partition FALSE by select_lex")); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + } + DBUG_PRINT("info", ("partition OK")); + DBUG_RETURN(0); +} + + +/** + Do initialization for performing parallel direct update + for a handlersocket update request. + + SYNOPSIS + pre_direct_update_rows_init() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::pre_direct_update_rows_init() +{ + bool save_m_pre_calling; + int error; + DBUG_ENTER("ha_partition::pre_direct_update_rows_init"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + error= direct_update_rows_init(); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + + +/** + Execute a direct update request. A direct update request updates all + qualified rows in a single operation, rather than one row at a time. + The direct update operation is pushed down to each individual + partition. + + SYNOPSIS + direct_update_rows() + update_rows Number of updated rows + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::direct_update_rows(ha_rows *update_rows_result) +{ + int error; + bool rnd_seq= FALSE; + ha_rows update_rows= 0; + uint32 i; + DBUG_ENTER("ha_partition::direct_update_rows"); + + /* If first call to direct_update_rows with RND scan */ + if ((m_pre_calling ? pre_inited : inited) == RND && m_scan_value == 1) + { + rnd_seq= TRUE; + m_scan_value= 2; + } + + *update_rows_result= 0; + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + handler *file= m_file[i]; + if (bitmap_is_set(&(m_part_info->read_partitions), i) && + bitmap_is_set(&(m_part_info->lock_partitions), i)) + { + if (rnd_seq && (m_pre_calling ? file->pre_inited : file->inited) == NONE) + { + if ((error= (m_pre_calling ? + file->ha_pre_rnd_init(TRUE) : + file->ha_rnd_init(TRUE)))) + DBUG_RETURN(error); + } + if ((error= (m_pre_calling ? + (file)->pre_direct_update_rows() : + (file)->ha_direct_update_rows(&update_rows)))) + { + if (rnd_seq) + { + if (m_pre_calling) + file->ha_pre_rnd_end(); + else + file->ha_rnd_end(); + } + DBUG_RETURN(error); + } + *update_rows_result+= update_rows; + } + if (rnd_seq) + { + if ((error= (m_pre_calling ? + file->ha_pre_index_or_rnd_end() : + file->ha_index_or_rnd_end()))) + DBUG_RETURN(error); + } + } + DBUG_RETURN(0); +} + + +/** + Start parallel execution of a direct update for a handlersocket update + request. A direct update request updates all qualified rows in a single + operation, rather than one row at a time. The direct update operation + is pushed down to each individual partition. + + SYNOPSIS + pre_direct_update_rows() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::pre_direct_update_rows() +{ + bool save_m_pre_calling; + int error; + ha_rows not_used= 0; + DBUG_ENTER("ha_partition::pre_direct_update_rows"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + error= direct_update_rows(¬_used); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + + +/** + Perform initialization for a direct delete request. + + SYNOPSIS + direct_delete_rows_init() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::direct_delete_rows_init() +{ + int error; + uint i, found; + DBUG_ENTER("ha_partition::direct_delete_rows_init"); + + m_part_spec.start_part= 0; + m_part_spec.end_part= m_tot_parts - 1; + m_direct_update_part_spec= m_part_spec; + + found= 0; + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + if (bitmap_is_set(&(m_part_info->read_partitions), i) && + bitmap_is_set(&(m_part_info->lock_partitions), i)) + { + handler *file= m_file[i]; + if ((error= (m_pre_calling ? + file->pre_direct_delete_rows_init() : + file->direct_delete_rows_init()))) + { + DBUG_PRINT("exit", ("error in direct_delete_rows_init")); + DBUG_RETURN(error); + } + found++; + } + } + + TABLE_LIST *table_list= table->pos_in_table_list; + if (found != 1 && table_list) + { + while (table_list->parent_l) + table_list= table_list->parent_l; + st_select_lex *select_lex= table_list->select_lex; + DBUG_PRINT("info", ("partition select_lex: %p", select_lex)); + if (select_lex && select_lex->explicit_limit) + { + DBUG_PRINT("info", ("partition explicit_limit: TRUE")); + DBUG_PRINT("info", ("partition offset_limit: %p", + select_lex->offset_limit)); + DBUG_PRINT("info", ("partition select_limit: %p", + select_lex->select_limit)); + DBUG_PRINT("info", ("partition FALSE by select_lex")); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + } + DBUG_PRINT("exit", ("OK")); + DBUG_RETURN(0); +} + + +/** + Do initialization for performing parallel direct delete + for a handlersocket delete request. + + SYNOPSIS + pre_direct_delete_rows_init() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::pre_direct_delete_rows_init() +{ + bool save_m_pre_calling; + int error; + DBUG_ENTER("ha_partition::pre_direct_delete_rows_init"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + error= direct_delete_rows_init(); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + + +/** + Execute a direct delete request. A direct delete request deletes all + qualified rows in a single operation, rather than one row at a time. + The direct delete operation is pushed down to each individual + partition. + + SYNOPSIS + direct_delete_rows() + delete_rows Number of deleted rows + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::direct_delete_rows(ha_rows *delete_rows_result) +{ + int error; + bool rnd_seq= FALSE; + ha_rows delete_rows= 0; + uint32 i; + handler *file; + DBUG_ENTER("ha_partition::direct_delete_rows"); + + if ((m_pre_calling ? pre_inited : inited) == RND && m_scan_value == 1) + { + rnd_seq= TRUE; + m_scan_value= 2; + } + + *delete_rows_result= 0; + m_part_spec= m_direct_update_part_spec; + for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++) + { + file= m_file[i]; + if (bitmap_is_set(&(m_part_info->read_partitions), i) && + bitmap_is_set(&(m_part_info->lock_partitions), i)) + { + if (rnd_seq && (m_pre_calling ? file->pre_inited : file->inited) == NONE) + { + if ((error= (m_pre_calling ? + file->ha_pre_rnd_init(TRUE) : + file->ha_rnd_init(TRUE)))) + DBUG_RETURN(error); + } + if ((error= (m_pre_calling ? + 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(); + DBUG_RETURN(error); + } + delete_rows_result+= delete_rows; + } + if (rnd_seq) + { + if ((error= (m_pre_calling ? + file->ha_pre_index_or_rnd_end() : + file->ha_index_or_rnd_end()))) + DBUG_RETURN(error); + } + } + DBUG_RETURN(0); +} + + +/** + Start parallel execution of a direct delete for a handlersocket delete + request. A direct delete request deletes all qualified rows in a single + operation, rather than one row at a time. The direct delete operation + is pushed down to each individual partition. + + SYNOPSIS + pre_direct_delete_rows() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::pre_direct_delete_rows() +{ + bool save_m_pre_calling; + int error; + ha_rows not_used; + DBUG_ENTER("ha_partition::pre_direct_delete_rows"); + save_m_pre_calling= m_pre_calling; + m_pre_calling= TRUE; + error= direct_delete_rows(¬_used); + m_pre_calling= save_m_pre_calling; + DBUG_RETURN(error); +} + +/** + Push metadata for the current operation down to each partition. + + SYNOPSIS + info_push() + + RETURN VALUE + >0 Error + 0 Success +*/ + +int ha_partition::info_push(uint info_type, void *info) +{ + int error= 0; + handler **file= m_file; + DBUG_ENTER("ha_partition::info_push"); + + do + { + int tmp; + if ((tmp= (*file)->info_push(info_type, info))) + error= tmp; + } while (*(++file)); + DBUG_RETURN(error); +} + + +void ha_partition::clear_top_table_fields() +{ + handler **file; + DBUG_ENTER("ha_partition::clear_top_table_fields"); + + if (set_top_table_fields) + { + set_top_table_fields= FALSE; + top_table= NULL; + top_table_field= NULL; + top_table_fields= 0; + for (file= m_file; *file; file++) + (*file)->clear_top_table_fields(); + } + DBUG_VOID_RETURN; +} + + struct st_mysql_storage_engine partition_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 40e6fd78c97..0b9f1dc3953 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -67,6 +67,17 @@ public: } }; +class ha_partition; + +/* Partition Full Text Search info */ +struct st_partition_ft_info +{ + struct _ft_vft *please; + st_partition_ft_info *next; + ha_partition *file; + FT_INFO **part_ft_info; +}; + extern PSI_mutex_key key_partition_auto_inc_mutex; @@ -169,7 +180,34 @@ private: bool is_subpart); }; +typedef struct st_partition_key_multi_range +{ + uint id; + uchar *key[2]; + uint length[2]; + KEY_MULTI_RANGE key_multi_range; + range_id_t ptr; + st_partition_key_multi_range *next; +} PARTITION_KEY_MULTI_RANGE; + +typedef struct st_partition_part_key_multi_range +{ + PARTITION_KEY_MULTI_RANGE *partition_key_multi_range; + st_partition_part_key_multi_range *next; +} PARTITION_PART_KEY_MULTI_RANGE; + + +class ha_partition; +typedef struct st_partition_part_key_multi_range_hld +{ + ha_partition *partition; + uint32 part_id; + PARTITION_PART_KEY_MULTI_RANGE *partition_part_key_multi_range; +} PARTITION_PART_KEY_MULTI_RANGE_HLD; + + +extern "C" int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2); extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2); class ha_partition :public handler @@ -179,16 +217,17 @@ private: { partition_index_read= 0, partition_index_first= 1, - partition_index_first_unordered= 2, partition_index_last= 3, partition_index_read_last= 4, partition_read_range = 5, - partition_no_index_scan= 6 + partition_no_index_scan= 6, + partition_read_multi_range = 7, + partition_ft_read= 8 }; /* Data for the partition handler */ int m_mode; // Open mode uint m_open_test_lock; // Open test_if_locked - uchar *m_file_buffer; // Content of the .par file + uchar *m_file_buffer; // Content of the .par file char *m_name_buffer_ptr; // Pointer to first partition name MEM_ROOT m_mem_root; plugin_ref *m_engine_array; // Array of types of the handlers @@ -201,6 +240,8 @@ private: partition_info *m_part_info; // local reference to partition Field **m_part_field_array; // Part field array locally to save acc uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan + st_partition_ft_info *ft_first; + st_partition_ft_info *ft_current; /* Current index. When used in key_rec_cmp: If clustered pk, index compare @@ -217,7 +258,7 @@ private: Length of an element in m_ordered_rec_buffer. The elements are composed of [part_no] [table->record copy] [underlying_table_rowid] - + underlying_table_rowid is only stored when the table has no extended keys. */ uint m_priority_queue_rec_len; @@ -265,14 +306,16 @@ private: bool m_create_handler; // Handler used to create table bool m_is_sub_partitioned; // Is subpartitioned bool m_ordered_scan_ongoing; + bool m_rnd_init_and_first; + bool m_ft_init_and_first; - /* + /* If set, this object was created with ha_partition::clone and doesn't "own" the m_part_info structure. */ ha_partition *m_is_clone_of; MEM_ROOT *m_clone_mem_root; - + /* We keep track if all underlying handlers are MyISAM since MyISAM has a great number of extra flags not needed by other handlers. @@ -317,6 +360,12 @@ private: ha_rows m_bulk_inserted_rows; /** used for prediction of start_bulk_insert rows */ enum_monotonicity_info m_part_func_monotonicity_info; + part_id_range m_direct_update_part_spec; + bool m_pre_calling; + bool m_pre_call_use_parallel; + /* Keep track of bulk access requests */ + bool bulk_access_executing; + /** keep track of locked partitions */ MY_BITMAP m_locked_partitions; /** Stores shared auto_increment etc. */ @@ -335,6 +384,18 @@ private: MY_BITMAP m_key_not_found_partitions; bool m_key_not_found; public: + handler **get_child_handlers() + { + return m_file; + } + virtual part_id_range *get_part_spec() + { + return &m_part_spec; + } + virtual uint get_no_current_part_id() + { + return NO_CURRENT_PART_ID; + } Partition_share *get_part_share() { return part_share; } handler *clone(const char *name, MEM_ROOT *mem_root); virtual void set_part_info(partition_info *part_info) @@ -342,6 +403,9 @@ public: m_part_info= part_info; m_is_sub_partitioned= part_info->is_sub_partitioned(); } + + virtual void return_record_by_parent(); + /* ------------------------------------------------------------------------- MODULE create/delete handler object @@ -360,6 +424,7 @@ public: ha_partition *clone_arg, MEM_ROOT *clone_mem_root_arg); ~ha_partition(); + void ha_partition_init(); /* A partition handler has no characteristics in itself. It only inherits those from the underlying handlers. Here we set-up those constants to @@ -543,8 +608,23 @@ public: number of calls to write_row. */ virtual int write_row(uchar * buf); + virtual bool start_bulk_update(); + virtual int exec_bulk_update(ha_rows *dup_key_found); + virtual int end_bulk_update(); + virtual int bulk_update_row(const uchar *old_data, const uchar *new_data, + ha_rows *dup_key_found); virtual int update_row(const uchar * old_data, const uchar * new_data); + virtual int direct_update_rows_init(); + virtual int pre_direct_update_rows_init(); + virtual int direct_update_rows(ha_rows *update_rows); + virtual int pre_direct_update_rows(); + virtual bool start_bulk_delete(); + virtual int end_bulk_delete(); virtual int delete_row(const uchar * buf); + virtual int direct_delete_rows_init(); + virtual int pre_direct_delete_rows_init(); + virtual int direct_delete_rows(ha_rows *delete_rows); + virtual int pre_direct_delete_rows(); virtual int delete_all_rows(void); virtual int truncate(); virtual void start_bulk_insert(ha_rows rows, uint flags); @@ -671,16 +751,8 @@ public: read_first_row is virtual method but is only implemented by handler.cc, no storage engine has implemented it so neither will the partition handler. - - virtual int read_first_row(uchar *buf, uint primary_key); - */ - /* - We don't implement multi read range yet, will do later. - virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, - KEY_MULTI_RANGE *ranges, uint range_count, - bool sorted, HANDLER_BUFFER *buffer); - virtual int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); + virtual int read_first_row(uchar *buf, uint primary_key); */ @@ -689,12 +761,59 @@ public: bool eq_range, bool sorted); virtual int read_range_next(); + + HANDLER_BUFFER *m_mrr_buffer; + uint *m_mrr_buffer_size; + uchar *m_mrr_full_buffer; + uint m_mrr_full_buffer_size; + uint m_mrr_new_full_buffer_size; + MY_BITMAP m_mrr_used_partitions; + uint *m_stock_range_seq; + uint m_current_range_seq; + uint m_mrr_mode; + uint m_mrr_n_ranges; + range_id_t *m_range_info; + bool m_multi_range_read_first; + uint m_mrr_range_init_flags; + uint m_mrr_range_length; + PARTITION_KEY_MULTI_RANGE *m_mrr_range_first; + PARTITION_KEY_MULTI_RANGE *m_mrr_range_current; + uint *m_part_mrr_range_length; + PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_first; + PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_current; + PARTITION_PART_KEY_MULTI_RANGE_HLD *m_partition_part_key_multi_range_hld; + range_seq_t m_seq; + RANGE_SEQ_IF *m_seq_if; + RANGE_SEQ_IF m_part_seq_if; + + virtual int multi_range_key_create_key( + RANGE_SEQ_IF *seq, + range_seq_t seq_it + ); + virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *mrr_mode, + Cost_estimate *cost); + virtual ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, + uint key_parts, uint *bufsz, + uint *mrr_mode, Cost_estimate *cost); + virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mrr_mode, + HANDLER_BUFFER *buf); + virtual int multi_range_read_next(range_id_t *range_info); + virtual int multi_range_read_explain_info(uint mrr_mode, char *str, + size_t size); + uint last_part() { return m_last_part; } + private: bool init_record_priority_queue(); void destroy_record_priority_queue(); int common_index_read(uchar * buf, bool have_start_key); int common_first_last(uchar * buf); int partition_scan_set_up(uchar * buf, bool idx_read_flag); + bool check_parallel_search(); + int handle_pre_scan(bool reverse_order, bool use_parallel); int handle_unordered_next(uchar * buf, bool next_same); int handle_unordered_scan_next_partition(uchar * buf); int handle_ordered_index_scan(uchar * buf, bool reverse_order); @@ -735,7 +854,7 @@ private: Query_cache_block_table **block_table, handler *file, uint *n); - static const uint NO_CURRENT_PART_ID; + static const uint NO_CURRENT_PART_ID= NOT_A_PARTITION_ID; int loop_extra(enum ha_extra_function operation); int loop_extra_alter(enum ha_extra_function operations); void late_extra_cache(uint partition_id); @@ -984,7 +1103,7 @@ public: special file for handling names of partitions, engine types. HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot guarantee that the records will be returned in sequence. - HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, HA_DUPLICATE_POS, + HA_DUPLICATE_POS, HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled until further investigated. */ @@ -1066,7 +1185,7 @@ public: The maximum supported values is the minimum of all handlers in the table */ - uint min_of_the_max_uint(uint (handler::*operator_func)(void) const) const; + uint min_of_the_max_uint(uint (handler::*operator_func)(void) const) const; virtual uint max_supported_record_length() const; virtual uint max_supported_keys() const; virtual uint max_supported_key_parts() const; @@ -1111,6 +1230,8 @@ public: auto_increment_column_changed ------------------------------------------------------------------------- */ + virtual bool need_info_for_auto_inc(); + virtual bool can_use_for_auto_inc_init(); virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, @@ -1118,16 +1239,17 @@ public: virtual void release_auto_increment(); private: virtual int reset_auto_increment(ulonglong value); + void update_next_auto_inc_val(); virtual void lock_auto_increment() { /* lock already taken */ if (auto_increment_safe_stmt_log_lock) return; - DBUG_ASSERT(!auto_increment_lock); - if(table_share->tmp_table == NO_TMP_TABLE) + if (table_share->tmp_table == NO_TMP_TABLE) { - auto_increment_lock= TRUE; part_share->lock_auto_inc(); + DBUG_ASSERT(!auto_increment_lock); + auto_increment_lock= TRUE; } } virtual void unlock_auto_increment() @@ -1137,10 +1259,10 @@ private: It will be set to false and thus unlocked at the end of the statement by ha_partition::release_auto_increment. */ - if(auto_increment_lock && !auto_increment_safe_stmt_log_lock) + if (auto_increment_lock && !auto_increment_safe_stmt_log_lock) { - part_share->unlock_auto_inc(); auto_increment_lock= FALSE; + part_share->unlock_auto_inc(); } } virtual void set_auto_increment_if_higher(Field *field) @@ -1148,6 +1270,8 @@ private: ulonglong nr= (((Field_num*) field)->unsigned_flag || field->val_int() > 0) ? field->val_int() : 0; lock_auto_increment(); + DBUG_ASSERT(part_share->auto_inc_initialized || + !can_use_for_auto_inc_init()); /* must check when the mutex is taken */ if (nr >= part_share->next_auto_inc_val) part_share->next_auto_inc_val= nr + 1; @@ -1196,14 +1320,15 @@ public: ------------------------------------------------------------------------- MODULE fulltext index ------------------------------------------------------------------------- - Fulltext stuff not yet. - ------------------------------------------------------------------------- - virtual int ft_init() { return HA_ERR_WRONG_COMMAND; } - virtual FT_INFO *ft_init_ext(uint flags,uint inx,const uchar *key, - uint keylen) - { return NULL; } - virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; } */ + void ft_close_search(FT_INFO *handler); + virtual int ft_init(); + virtual int pre_ft_init(); + virtual void ft_end(); + virtual int pre_ft_end(); + virtual FT_INFO *ft_init_ext(uint flags, uint inx, String *key); + virtual int ft_read(uchar *buf); + virtual int pre_ft_read(bool use_parallel); /* ------------------------------------------------------------------------- @@ -1265,6 +1390,16 @@ public: virtual bool is_crashed() const; virtual int check_for_upgrade(HA_CHECK_OPT *check_opt); + /* + ------------------------------------------------------------------------- + MODULE condition pushdown + ------------------------------------------------------------------------- + */ + virtual const COND *cond_push(const COND *cond); + virtual void cond_pop(); + virtual void clear_top_table_fields(); + virtual int info_push(uint info_type, void *info); + private: int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, uint part_id, @@ -1292,6 +1427,7 @@ public: /* Enabled keycache for performance reasons, WL#4571 */ virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt); virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt); + virtual TABLE_LIST *get_next_global_for_child(); /* ------------------------------------------------------------------------- @@ -1364,11 +1500,6 @@ public: } friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2); + friend int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2); }; - -bool print_admin_msg(THD* thd, uint len, - const char* msg_type, - const char* db_name, String &table_name, - const char* op_name, const char *fmt, ...); - #endif /* HA_PARTITION_INCLUDED */ diff --git a/sql/handler.cc b/sql/handler.cc index 9ad866d92de..bb52f6bb211 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4110,7 +4110,7 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt) int handler::ha_bulk_update_row(const uchar *old_data, const uchar *new_data, - uint *dup_key_found) + ha_rows *dup_key_found) { DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || m_lock_type == F_WRLCK); @@ -5396,6 +5396,27 @@ int ha_discover_table_names(THD *thd, LEX_CSTRING *db, MY_DIR *dirp, } +/* +int handler::pre_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, HANDLER_BUFFER *buffer, + bool use_parallel) +{ + int result; + DBUG_ENTER("handler::pre_read_multi_range_first"); + result = pre_read_range_first(ranges->start_key.keypart_map ? + &ranges->start_key : 0, + ranges->end_key.keypart_map ? + &ranges->end_key : 0, + test(ranges->range_flag & EQ_RANGE), + sorted, + use_parallel); + DBUG_RETURN(result); +} +*/ + + /** Read first row between two ranges. Store ranges for future calls to read_range_next. @@ -6044,6 +6065,7 @@ int handler::ha_reset() /* Reset information about pushed engine conditions */ cancel_pushed_idx_cond(); /* Reset information about pushed index conditions */ + clear_top_table_fields(); DBUG_RETURN(reset()); } @@ -6188,6 +6210,59 @@ int handler::ha_delete_row(const uchar *buf) } +/** + Execute a direct update request. A direct update request updates all + qualified rows in a single operation, rather than one row at a time. + In a Spider cluster the direct update operation is pushed down to the + child levels of the cluster. + + Note that this can't be used in case of statment logging + + @param update_rows Number of updated rows. + + @retval 0 Success. + @retval != 0 Failure. +*/ + +int handler::ha_direct_update_rows(ha_rows *update_rows) +{ + int error; + + MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str); + mark_trx_read_write(); + + error = direct_update_rows(update_rows); + MYSQL_UPDATE_ROW_DONE(error); + return error; +} + + +/** + Execute a direct delete request. A direct delete request deletes all + qualified rows in a single operation, rather than one row at a time. + In a Spider cluster the direct delete operation is pushed down to the + child levels of the cluster. + + @param delete_rows Number of deleted rows. + + @retval 0 Success. + @retval != 0 Failure. +*/ + +int handler::ha_direct_delete_rows(ha_rows *delete_rows) +{ + int error; + /* Ensure we are not using binlog row */ + DBUG_ASSERT(!table->in_use->is_current_stmt_binlog_format_row()); + + MYSQL_DELETE_ROW_START(table_share->db.str, table_share->table_name.str); + mark_trx_read_write(); + + error = direct_delete_rows(delete_rows); + MYSQL_DELETE_ROW_DONE(error); + return error; +} + /** @brief use_hidden_primary_key() is called in case of an update/delete when diff --git a/sql/handler.h b/sql/handler.h index 50e8d7e0e78..6fbb61c902c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -162,6 +162,7 @@ enum enum_alter_inplace_result { */ #define HA_BINLOG_ROW_CAPABLE (1ULL << 34) #define HA_BINLOG_STMT_CAPABLE (1ULL << 35) + /* When a multiple key conflict happens in a REPLACE command mysql expects the conflicts to be reported in the ascending order of @@ -287,6 +288,17 @@ enum enum_alter_inplace_result { */ #define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE) +/* The following are used by Spider */ +#define HA_CAN_FORCE_BULK_UPDATE (1ULL << 50) +#define HA_CAN_FORCE_BULK_DELETE (1ULL << 51) +#define HA_CAN_DIRECT_UPDATE_AND_DELETE (1ULL << 52) + +/* The following is for partition handler */ +#define HA_CAN_MULTISTEP_MERGE (1LL << 53) + +/* calling cmp_ref() on the engine is expensive */ +#define HA_CMP_REF_IS_EXPENSIVE (1ULL << 54) + /* bits in index_flags(index_number) for what you can do with index */ #define HA_READ_NEXT 1 /* TODO really use this flag */ #define HA_READ_PREV 2 /* supports ::index_prev */ @@ -438,6 +450,12 @@ static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4; #define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE) #define HA_CHECK_ALL (~0U) +/* Options for info_push() */ +#define INFO_KIND_UPDATE_FIELDS 101 +#define INFO_KIND_UPDATE_VALUES 102 +#define INFO_KIND_FORCE_LIMIT_BEGIN 103 +#define INFO_KIND_FORCE_LIMIT_END 104 + enum legacy_db_type { /* note these numerical values are fixed and can *not* be changed */ @@ -1447,6 +1465,10 @@ handlerton *ha_default_tmp_handlerton(THD *thd); // MySQL compatibility. Unused. #define HTON_SUPPORTS_FOREIGN_KEYS (1 << 0) //Foreign key constraint supported. +#define HTON_CAN_MERGE (1 <<11) //Merge type table +// Engine needs to access the main connect string in partitions +#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 <<12) + class Ha_trx_info; struct THD_TRANS @@ -2816,7 +2838,8 @@ public: /** Length of ref (1-8 or the clustered key length) */ uint ref_length; FT_INFO *ft_handler; - enum {NONE=0, INDEX, RND} inited; + enum init_stat { NONE=0, INDEX, RND }; + init_stat inited, pre_inited; const COND *pushed_cond; /** @@ -2882,6 +2905,11 @@ public: virtual void unbind_psi(); virtual void rebind_psi(); + bool set_top_table_fields; + struct TABLE *top_table; + Field **top_table_field; + uint top_table_fields; + private: /** The lock type set by when calling::ha_external_lock(). This is @@ -2910,13 +2938,15 @@ public: key_used_on_scan(MAX_KEY), active_index(MAX_KEY), keyread(MAX_KEY), ref_length(sizeof(my_off_t)), - ft_handler(0), inited(NONE), + ft_handler(0), inited(NONE), pre_inited(NONE), pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0), tracker(NULL), pushed_idx_cond(NULL), pushed_idx_cond_keyno(MAX_KEY), auto_inc_intervals_count(0), - m_psi(NULL), m_lock_type(F_UNLCK), ha_share(NULL) + m_psi(NULL), set_top_table_fields(FALSE), top_table(0), + top_table_field(0), top_table_fields(0), + m_lock_type(F_UNLCK), ha_share(NULL) { DBUG_PRINT("info", ("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d", @@ -3049,7 +3079,7 @@ public: DBUG_RETURN(ret); } int ha_bulk_update_row(const uchar *old_data, const uchar *new_data, - uint *dup_key_found); + ha_rows *dup_key_found); int ha_delete_all_rows(); int ha_truncate(); int ha_reset_auto_increment(ulonglong value); @@ -3190,6 +3220,7 @@ public: Number of rows in table. It will only be called if (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0 */ + virtual int pre_records() { return 0; } virtual ha_rows records() { return stats.records; } /** Return upper bound of current number of records in the table @@ -3246,7 +3277,7 @@ public: @retval 0 Success @retval >0 Error code */ - virtual int exec_bulk_update(uint *dup_key_found) + virtual int exec_bulk_update(ha_rows *dup_key_found) { DBUG_ASSERT(FALSE); return HA_ERR_WRONG_COMMAND; @@ -3255,7 +3286,7 @@ public: Perform any needed clean-up, no outstanding updates are there at the moment. */ - virtual void end_bulk_update() { return; } + virtual int end_bulk_update() { return 0; } /** Execute all outstanding deletes and close down the bulk delete. @@ -3267,6 +3298,79 @@ public: DBUG_ASSERT(FALSE); return HA_ERR_WRONG_COMMAND; } + virtual int pre_index_read_map(const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag, + bool use_parallel) + { return 0; } + virtual int pre_index_first(bool use_parallel) + { return 0; } + virtual int pre_index_last(bool use_parallel) + { return 0; } + virtual int pre_index_read_last_map(const uchar *key, + key_part_map keypart_map, + bool use_parallel) + { return 0; } +/* + virtual int pre_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, HANDLER_BUFFER *buffer, + bool use_parallel); +*/ + virtual int pre_multi_range_read_next(bool use_parallel) + { return 0; } + virtual int pre_read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted, + bool use_parallel) + { return 0; } + virtual int pre_ft_read(bool use_parallel) + { return 0; } + virtual int pre_rnd_next(bool use_parallel) + { return 0; } + int ha_pre_rnd_init(bool scan) + { + int result; + DBUG_ENTER("ha_pre_rnd_init"); + DBUG_ASSERT(pre_inited==NONE || (pre_inited==RND && scan)); + pre_inited= (result= pre_rnd_init(scan)) ? NONE: RND; + DBUG_RETURN(result); + } + int ha_pre_rnd_end() + { + DBUG_ENTER("ha_pre_rnd_end"); + DBUG_ASSERT(pre_inited==RND); + pre_inited=NONE; + DBUG_RETURN(pre_rnd_end()); + } + virtual int pre_rnd_init(bool scan) { return 0; } + virtual int pre_rnd_end() { return 0; } + virtual int pre_index_init(uint idx, bool sorted) { return 0; } + virtual int pre_index_end() { return 0; } + int ha_pre_index_init(uint idx, bool sorted) + { + int result; + DBUG_ENTER("ha_pre_index_init"); + DBUG_ASSERT(pre_inited==NONE); + if (!(result= pre_index_init(idx, sorted))) + pre_inited=INDEX; + DBUG_RETURN(result); + } + int ha_pre_index_end() + { + DBUG_ENTER("ha_pre_index_end"); + DBUG_ASSERT(pre_inited==INDEX); + pre_inited=NONE; + DBUG_RETURN(pre_index_end()); + } + int ha_pre_index_or_rnd_end() + { + return (pre_inited == INDEX ? + ha_pre_index_end() : + pre_inited == RND ? ha_pre_rnd_end() : 0 ); + } + /** @brief Positions an index cursor to the index specified in the @@ -3387,7 +3491,9 @@ public: int compare_key(key_range *range); int compare_key2(key_range *range) const; virtual int ft_init() { return HA_ERR_WRONG_COMMAND; } - void ft_end() { ft_handler=NULL; } + virtual int pre_ft_init() { return HA_ERR_WRONG_COMMAND; } + virtual void ft_end() {} + virtual int pre_ft_end() { return 0; } virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key) { return NULL; } public: @@ -3410,6 +3516,7 @@ public: /* Same as above, but with statistics */ inline int ha_ft_read(uchar *buf); + inline void ha_ft_end() { ft_end(); ft_handler=NULL; } int ha_rnd_next(uchar *buf); int ha_rnd_pos(uchar *buf, uchar *pos); inline int ha_rnd_pos_by_record(uchar *buf); @@ -3467,6 +3574,8 @@ public: virtual void try_semi_consistent_read(bool) {} virtual void unlock_row() {} virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} + virtual bool need_info_for_auto_inc() { return 0; } + virtual bool can_use_for_auto_inc_init() { return 1; } virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, @@ -3574,6 +3683,7 @@ public: return 0; } virtual void set_part_info(partition_info *part_info) {return;} + virtual void return_record_by_parent() { return; } virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0; @@ -3777,6 +3887,41 @@ public: */ virtual void cond_pop() { return; }; + /** + Push metadata for the current operation down to the table handler. + */ + virtual int info_push(uint info_type, void *info) { return 0; }; + + /** + This function is used to get correlating of a parent (table/column) + and children (table/column). When conditions are pushed down to child + table (like child of myisam_merge), child table needs to know about + which table/column is my parent for understanding conditions. + */ + virtual int set_top_table_and_fields(TABLE *top_table, + Field **top_table_field, + uint top_table_fields) + { + if (!set_top_table_fields) + { + set_top_table_fields= TRUE; + this->top_table= top_table; + this->top_table_field= top_table_field; + this->top_table_fields= top_table_fields; + } + return 0; + } + virtual void clear_top_table_fields() + { + if (set_top_table_fields) + { + set_top_table_fields= FALSE; + top_table= NULL; + top_table_field= NULL; + top_table_fields= 0; + } + } + /** Push down an index condition to the handler. @@ -3810,6 +3955,10 @@ public: pushed_idx_cond_keyno= MAX_KEY; in_range_check_pushed_down= false; } + + /* Needed for partition / spider */ + virtual TABLE_LIST *get_next_global_for_child() { return NULL; } + /** Part of old, deprecated in-place ALTER API. */ @@ -4195,6 +4344,49 @@ private: { return HA_ERR_WRONG_COMMAND; } + + /* Perform initialization for a direct update request */ +public: + int ha_direct_update_rows(ha_rows *update_rows); + virtual int direct_update_rows_init() + { + return HA_ERR_WRONG_COMMAND; + } +private: + virtual int pre_direct_update_rows_init() + { + return HA_ERR_WRONG_COMMAND; + } + virtual int direct_update_rows(ha_rows *update_rows __attribute__((unused))) + { + return HA_ERR_WRONG_COMMAND; + } + virtual int pre_direct_update_rows() + { + return HA_ERR_WRONG_COMMAND; + } + + /* Perform initialization for a direct delete request */ +public: + int ha_direct_delete_rows(ha_rows *delete_rows); + virtual int direct_delete_rows_init() + { + return HA_ERR_WRONG_COMMAND; + } +private: + virtual int pre_direct_delete_rows_init() + { + return HA_ERR_WRONG_COMMAND; + } + virtual int direct_delete_rows(ha_rows *delete_rows __attribute__((unused))) + { + return HA_ERR_WRONG_COMMAND; + } + virtual int pre_direct_delete_rows() + { + return HA_ERR_WRONG_COMMAND; + } + /** Reset state of file to after 'open'. This function is called after every statement for all tables used @@ -4274,7 +4466,7 @@ public: @retval 1 Bulk delete not used, normal operation used */ virtual int bulk_update_row(const uchar *old_data, const uchar *new_data, - uint *dup_key_found) + ha_rows *dup_key_found) { DBUG_ASSERT(FALSE); return HA_ERR_WRONG_COMMAND; diff --git a/sql/item.cc b/sql/item.cc index 88cd7305fdd..cde9170b990 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -538,7 +538,6 @@ Item::Item(THD *thd): marker= 0; maybe_null=null_value=with_sum_func=with_window_func=with_field=0; in_rollup= 0; - with_subselect= 0; /* Initially this item is not attached to any JOIN_TAB. */ join_tab_idx= MAX_TABLES; @@ -583,8 +582,7 @@ Item::Item(THD *thd, Item *item): with_window_func(item->with_window_func), with_field(item->with_field), fixed(item->fixed), - is_autogenerated_name(item->is_autogenerated_name), - with_subselect(item->has_subquery()) + is_autogenerated_name(item->is_autogenerated_name) { next= thd->free_list; // Put in free list thd->free_list= this; @@ -2732,6 +2730,252 @@ Item* Item_func_or_sum::build_clone(THD *thd) return copy; } +Item_sp::Item_sp(THD *thd, Name_resolution_context *context_arg, + sp_name *name_arg) : + context(context_arg), m_name(name_arg), m_sp(NULL), func_ctx(NULL), + sp_result_field(NULL) +{ + dummy_table= (TABLE*) thd->calloc(sizeof(TABLE) + sizeof(TABLE_SHARE) + + sizeof(Query_arena)); + dummy_table->s= (TABLE_SHARE*) (dummy_table + 1); + /* TODO(cvicentiu) Move this sp_query_arena in the class as a direct member. + Currently it can not be done due to header include dependencies. */ + sp_query_arena= (Query_arena *) (dummy_table->s + 1); + memset(&sp_mem_root, 0, sizeof(sp_mem_root)); +} + +const char * +Item_sp::func_name(THD *thd) const +{ + /* Calculate length to avoid reallocation of string for sure */ + uint len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) + + m_name->m_name.length)*2 + //characters*quoting + 2 + // ` and ` + (m_name->m_explicit_name ? + 3 : 0) + // '`', '`' and '.' for the db + 1 + // end of string + ALIGN_SIZE(1)); // to avoid String reallocation + String qname((char *)alloc_root(thd->mem_root, len), len, + system_charset_info); + + qname.length(0); + if (m_name->m_explicit_name) + { + append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length); + qname.append('.'); + } + append_identifier(thd, &qname, m_name->m_name.str, m_name->m_name.length); + return qname.c_ptr_safe(); +} + +void +Item_sp::cleanup() +{ + delete sp_result_field; + sp_result_field= NULL; + m_sp= NULL; + delete func_ctx; + func_ctx= NULL; + free_root(&sp_mem_root, MYF(0)); + dummy_table->alias.free(); +} + +/** + @brief Checks if requested access to function can be granted to user. + If function isn't found yet, it searches function first. + If function can't be found or user don't have requested access + error is raised. + + @param thd thread handler + + @return Indication if the access was granted or not. + @retval FALSE Access is granted. + @retval TRUE Requested access can't be granted or function doesn't exists. + +*/ +bool +Item_sp::sp_check_access(THD *thd) +{ + DBUG_ENTER("Item_sp::sp_check_access"); + DBUG_ASSERT(m_sp); + DBUG_RETURN(m_sp->check_execute_access(thd)); +} + +/** + @brief Execute function & store value in field. + + @return Function returns error status. + @retval FALSE on success. + @retval TRUE if an error occurred. +*/ +bool Item_sp::execute(THD *thd, bool *null_value, Item **args, uint arg_count) +{ + if (execute_impl(thd, args, arg_count)) + { + *null_value= 1; + context->process_error(thd); + if (thd->killed) + thd->send_kill_message(); + return true; + } + + /* Check that the field (the value) is not NULL. */ + + *null_value= sp_result_field->is_null(); + return (*null_value); +} + +/** + @brief Execute function and store the return value in the field. + + @note This function was intended to be the concrete implementation of + the interface function execute. This was never realized. + + @return The error state. + @retval FALSE on success + @retval TRUE if an error occurred. +*/ +bool +Item_sp::execute_impl(THD *thd, Item **args, uint arg_count) +{ + Sub_statement_state statement_state; + Security_context *save_security_ctx= thd->security_ctx; + enum enum_sp_data_access access= + (m_sp->daccess() == SP_DEFAULT_ACCESS) ? + SP_DEFAULT_ACCESS_MAPPING : m_sp->daccess(); + + DBUG_ENTER("Item_sp::execute_impl"); + + if (context->security_ctx) + { + /* Set view definer security context */ + thd->security_ctx= context->security_ctx; + } + + if (sp_check_access(thd)) + { + thd->security_ctx= save_security_ctx; + DBUG_RETURN(TRUE); + } + + /* + Throw an error if a non-deterministic function is called while + statement-based replication (SBR) is active. + */ + + if (!m_sp->detistic() && !trust_function_creators && + (access == SP_CONTAINS_SQL || access == SP_MODIFIES_SQL_DATA) && + (mysql_bin_log.is_open() && + thd->variables.binlog_format == BINLOG_FORMAT_STMT)) + { + my_error(ER_BINLOG_UNSAFE_ROUTINE, MYF(0)); + thd->security_ctx= save_security_ctx; + DBUG_RETURN(TRUE); + } + + /* + Disable the binlogging if this is not a SELECT statement. If this is a + SELECT, leave binlogging on, so execute_function() code writes the + function call into binlog. + */ + thd->reset_sub_statement_state(&statement_state, SUB_STMT_FUNCTION); + + /* + If this function is an aggregate function, we want to initialise the + mem_root only once per group. For a regular stored function, we will + initialise once for each call to execute_function. + */ + m_sp->agg_type(); + DBUG_ASSERT(m_sp->agg_type() == GROUP_AGGREGATE || + (m_sp->agg_type() == NOT_AGGREGATE && !func_ctx)); + if (!func_ctx) + { + init_sql_alloc(&sp_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0)); + *sp_query_arena= Query_arena(&sp_mem_root, + Query_arena::STMT_INITIALIZED_FOR_SP); + } + + bool err_status= m_sp->execute_function(thd, args, arg_count, + sp_result_field, &func_ctx, + sp_query_arena); + /* + We free the function context when the function finished executing normally + (quit_func == TRUE) or the function has exited with an error. + */ + if (err_status || func_ctx->quit_func) + { + /* Free Items allocated during function execution. */ + delete func_ctx; + func_ctx= NULL; + sp_query_arena->free_items(); + free_root(&sp_mem_root, MYF(0)); + memset(&sp_mem_root, 0, sizeof(sp_mem_root)); + } + thd->restore_sub_statement_state(&statement_state); + + thd->security_ctx= save_security_ctx; + DBUG_RETURN(err_status); +} + + +/** + @brief Initialize the result field by creating a temporary dummy table + and assign it to a newly created field object. Meta data used to + create the field is fetched from the sp_head belonging to the stored + proceedure found in the stored procedure functon cache. + + @note This function should be called from fix_fields to init the result + field. It is some what related to Item_field. + + @see Item_field + + @param thd A pointer to the session and thread context. + + @return Function return error status. + @retval TRUE is returned on an error + @retval FALSE is returned on success. +*/ + +bool +Item_sp::init_result_field(THD *thd, uint max_length, uint maybe_null, + bool *null_value, LEX_CSTRING *name) +{ + DBUG_ENTER("Item_sp::init_result_field"); + + DBUG_ASSERT(m_sp != NULL); + DBUG_ASSERT(sp_result_field == NULL); + + /* + A Field needs to be attached to a Table. + Below we "create" a dummy table by initializing + the needed pointers. + */ + dummy_table->alias.set("", 0, table_alias_charset); + dummy_table->in_use= thd; + dummy_table->copy_blobs= TRUE; + dummy_table->s->table_cache_key= empty_clex_str; + dummy_table->s->table_name= empty_clex_str; + dummy_table->maybe_null= maybe_null; + + if (!(sp_result_field= m_sp->create_result_field(max_length, name, + dummy_table))) + DBUG_RETURN(TRUE); + + if (sp_result_field->pack_length() > sizeof(result_buf)) + { + void *tmp; + if (!(tmp= thd->alloc(sp_result_field->pack_length()))) + DBUG_RETURN(TRUE); + sp_result_field->move_field((uchar*) tmp); + } + else + sp_result_field->move_field(result_buf); + + sp_result_field->null_ptr= (uchar *) null_value; + sp_result_field->null_bit= 1; + + DBUG_RETURN(FALSE); +} /** @brief @@ -3714,20 +3958,6 @@ Item *Item_null::clone_item(THD *thd) /*********************** Item_param related ******************************/ -/** - Default function of Item_param::set_param_func, so in case - of malformed packet the server won't SIGSEGV. -*/ - -static void -default_set_param_func(Item_param *param, - uchar **pos __attribute__((unused)), - ulong len __attribute__((unused))) -{ - param->set_null(); -} - - Item_param::Item_param(THD *thd, const LEX_CSTRING *name_arg, uint pos_in_query_arg, uint len_in_query_arg): Item_basic_value(thd), @@ -3745,8 +3975,8 @@ Item_param::Item_param(THD *thd, const LEX_CSTRING *name_arg, state(NO_VALUE), /* Don't pretend to be a literal unless value for this item is set. */ item_type(PARAM_ITEM), + m_empty_string_is_null(false), indicator(STMT_INDICATOR_NONE), - set_param_func(default_set_param_func), m_out_param_info(NULL), /* Set m_is_settable_routine_parameter to "true" by default. @@ -3787,8 +4017,10 @@ void Item_param::set_null() void Item_param::set_int(longlong i, uint32 max_length_arg) { DBUG_ENTER("Item_param::set_int"); + DBUG_ASSERT(value.type_handler()->cmp_type() == INT_RESULT); value.integer= (longlong) i; - state= INT_VALUE; + state= SHORT_DATA_VALUE; + collation.set_numeric(); max_length= max_length_arg; decimals= 0; maybe_null= 0; @@ -3799,8 +4031,10 @@ void Item_param::set_int(longlong i, uint32 max_length_arg) void Item_param::set_double(double d) { DBUG_ENTER("Item_param::set_double"); + DBUG_ASSERT(value.type_handler()->cmp_type() == REAL_RESULT); value.real= d; - state= REAL_VALUE; + state= SHORT_DATA_VALUE; + collation.set_numeric(); max_length= DBL_DIG + 8; decimals= NOT_FIXED_DEC; maybe_null= 0; @@ -3825,13 +4059,15 @@ void Item_param::set_decimal(const char *str, ulong length) { char *end; DBUG_ENTER("Item_param::set_decimal"); + DBUG_ASSERT(value.type_handler()->cmp_type() == DECIMAL_RESULT); end= (char*) str+length; - str2my_decimal(E_DEC_FATAL_ERROR, str, &decimal_value, &end); - state= DECIMAL_VALUE; - decimals= decimal_value.frac; + str2my_decimal(E_DEC_FATAL_ERROR, str, &value.m_decimal, &end); + state= SHORT_DATA_VALUE; + decimals= value.m_decimal.frac; + collation.set_numeric(); max_length= - my_decimal_precision_to_length_no_truncation(decimal_value.precision(), + my_decimal_precision_to_length_no_truncation(value.m_decimal.precision(), decimals, unsigned_flag); maybe_null= 0; fix_type(Item::DECIMAL_ITEM); @@ -3840,13 +4076,15 @@ void Item_param::set_decimal(const char *str, ulong length) void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg) { - state= DECIMAL_VALUE; + DBUG_ASSERT(value.type_handler()->cmp_type() == DECIMAL_RESULT); + state= SHORT_DATA_VALUE; - my_decimal2decimal(dv, &decimal_value); + my_decimal2decimal(dv, &value.m_decimal); - decimals= (uint8) decimal_value.frac; + decimals= (uint8) value.m_decimal.frac; + collation.set_numeric(); unsigned_flag= unsigned_arg; - max_length= my_decimal_precision_to_length(decimal_value.intg + decimals, + max_length= my_decimal_precision_to_length(value.m_decimal.intg + decimals, decimals, unsigned_flag); fix_type(Item::DECIMAL_ITEM); } @@ -3854,7 +4092,8 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg) void Item_param::fix_temporal(uint32 max_length_arg, uint decimals_arg) { - state= TIME_VALUE; + state= SHORT_DATA_VALUE; + collation.set_numeric(); max_length= max_length_arg; decimals= decimals_arg; fix_type(Item::DATE_ITEM); @@ -3864,6 +4103,7 @@ void Item_param::fix_temporal(uint32 max_length_arg, uint decimals_arg) void Item_param::set_time(const MYSQL_TIME *tm, uint32 max_length_arg, uint decimals_arg) { + DBUG_ASSERT(value.type_handler()->cmp_type() == TIME_RESULT); value.time= *tm; fix_temporal(max_length_arg, decimals_arg); } @@ -3886,6 +4126,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type, uint32 max_length_arg) { DBUG_ENTER("Item_param::set_time"); + DBUG_ASSERT(value.type_handler()->cmp_type() == TIME_RESULT); value.time= *tm; value.time.time_type= time_type; @@ -3904,18 +4145,34 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type, } -bool Item_param::set_str(const char *str, ulong length) +bool Item_param::set_str(const char *str, ulong length, + CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { DBUG_ENTER("Item_param::set_str"); + DBUG_ASSERT(value.type_handler()->cmp_type() == STRING_RESULT); /* Assign string with no conversion: data is converted only after it's been written to the binary log. */ uint dummy_errors; - if (str_value.copy(str, length, &my_charset_bin, &my_charset_bin, - &dummy_errors)) + if (value.m_string.copy(str, length, fromcs, tocs, &dummy_errors)) DBUG_RETURN(TRUE); - state= STRING_VALUE; + /* + Set str_value_ptr to make sure it's in sync with str_value. + This is needed in case if we're called from Item_param::set_value(), + from the code responsible for setting OUT parameters in + sp_head::execute_procedure(). This makes sure that + Protocol_binary::send_out_parameters() later gets a valid value + from Item_param::val_str(). + Note, for IN parameters, Item_param::convert_str_value() will be called + later, which will convert the value from the client character set to the + connection character set, and will reset both str_value and str_value_ptr. + */ + value.m_string_ptr.set(value.m_string.ptr(), + value.m_string.length(), + value.m_string.charset()); + state= SHORT_DATA_VALUE; + collation.set(tocs, DERIVATION_COERCIBLE); max_length= length; maybe_null= 0; /* max_length and decimals are set after charset conversion */ @@ -3928,6 +4185,7 @@ bool Item_param::set_str(const char *str, ulong length) bool Item_param::set_longdata(const char *str, ulong length) { DBUG_ENTER("Item_param::set_longdata"); + DBUG_ASSERT(value.type_handler()->cmp_type() == STRING_RESULT); /* If client character set is multibyte, end of long data packet @@ -3938,7 +4196,7 @@ bool Item_param::set_longdata(const char *str, ulong length) (here), and first have to concatenate all pieces together, write query to the binary log and only then perform conversion. */ - if (str_value.length() + length > max_long_data_size) + if (value.m_string.length() + length > max_long_data_size) { my_message(ER_UNKNOWN_ERROR, "Parameter of prepared statement which is set through " @@ -3948,7 +4206,7 @@ bool Item_param::set_longdata(const char *str, ulong length) DBUG_RETURN(true); } - if (str_value.append(str, length, &my_charset_bin)) + if (value.m_string.append(str, length, &my_charset_bin)) DBUG_RETURN(TRUE); state= LONG_DATA_VALUE; maybe_null= 0; @@ -4011,16 +4269,16 @@ bool Item_param::set_from_item(THD *thd, Item *item) else { unsigned_flag= item->unsigned_flag; - set_int(val, MY_INT64_NUM_DECIMAL_DIGITS); - set_handler_by_result_type(item->result_type()); - DBUG_RETURN(!unsigned_flag && value.integer < 0 ? 1 : 0); + set_handler(item->type_handler()); + DBUG_RETURN(set_limit_clause_param(val)); } } struct st_value tmp; if (!item->save_in_value(&tmp)) { - if (item->type_handler()->Item_param_set_from_value(thd, this, item, &tmp)) - DBUG_RETURN(true); + const Type_handler *h= item->type_handler(); + set_handler(h); + DBUG_RETURN(set_value(thd, item, &tmp, h)); } else set_null(); @@ -4040,16 +4298,16 @@ void Item_param::reset() { DBUG_ENTER("Item_param::reset"); /* Shrink string buffer if it's bigger than max possible CHAR column */ - if (str_value.alloced_length() > MAX_CHAR_WIDTH) - str_value.free(); + if (value.m_string.alloced_length() > MAX_CHAR_WIDTH) + value.m_string.free(); else - str_value.length(0); - str_value_ptr.length(0); + value.m_string.length(0); + value.m_string_ptr.length(0); /* We must prevent all charset conversions until data has been written to the binary log. */ - str_value.set_charset(&my_charset_bin); + value.m_string.set_charset(&my_charset_bin); collation.set(&my_charset_bin, DERIVATION_COERCIBLE); state= NO_VALUE; maybe_null= 1; @@ -4078,19 +4336,9 @@ int Item_param::save_in_field(Field *field, bool no_conversions) Garbage (e.g. in case of a memory overrun) is handled after the switch. */ switch (state) { - case INT_VALUE: - return field->store(value.integer, unsigned_flag); - case REAL_VALUE: - return field->store(value.real); - case DECIMAL_VALUE: - return field->store_decimal(&decimal_value); - case TIME_VALUE: - field->store_time_dec(&value.time, decimals); - return 0; - case STRING_VALUE: + case SHORT_DATA_VALUE: case LONG_DATA_VALUE: - return field->store(str_value.ptr(), str_value.length(), - str_value.charset()); + return value.type_handler()->Item_save_in_field(this, field, no_conversions); case NULL_VALUE: return set_field_to_null_with_conversions(field, no_conversions); case DEFAULT_VALUE: @@ -4110,6 +4358,28 @@ int Item_param::save_in_field(Field *field, bool no_conversions) } +bool Item_param::can_return_value() const +{ + // There's no "default". See comments in Item_param::save_in_field(). + switch (state) { + case SHORT_DATA_VALUE: + case LONG_DATA_VALUE: + return true; + case IGNORE_VALUE: + case DEFAULT_VALUE: + invalid_default_param(); + // fall through + case NULL_VALUE: + return false; + case NO_VALUE: + DBUG_ASSERT(0); // Should not be possible + return false; + } + DBUG_ASSERT(0); // Garbage + return false; +} + + void Item_param::invalid_default_param() const { my_message(ER_INVALID_DEFAULT_PARAM, @@ -4119,7 +4389,14 @@ void Item_param::invalid_default_param() const bool Item_param::get_date(MYSQL_TIME *res, ulonglong fuzzydate) { - if (state == TIME_VALUE) + /* + LIMIT clause parameter should not call get_date() + For non-LIMIT parameters, handlers must be the same. + */ + DBUG_ASSERT(type_handler()->result_type() == + value.type_handler()->result_type()); + if (state == SHORT_DATA_VALUE && + value.type_handler()->cmp_type() == TIME_RESULT) { *res= value.time; return 0; @@ -4128,157 +4405,117 @@ bool Item_param::get_date(MYSQL_TIME *res, ulonglong fuzzydate) } -double Item_param::val_real() +double Item_param::PValue::val_real() const { - // There's no "default". See comments in Item_param::save_in_field(). - switch (state) { - case REAL_VALUE: - return value.real; - case INT_VALUE: - return (double) value.integer; - case DECIMAL_VALUE: + switch (type_handler()->cmp_type()) { + case REAL_RESULT: + return real; + case INT_RESULT: + return (double) integer; + case DECIMAL_RESULT: { double result; - my_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &result); + my_decimal2double(E_DEC_FATAL_ERROR, &m_decimal, &result); return result; } - case STRING_VALUE: - case LONG_DATA_VALUE: - { - return double_from_string_with_check(&str_value); - } - case TIME_VALUE: + case STRING_RESULT: + return double_from_string_with_check(&m_string); + case TIME_RESULT: /* This works for example when user says SELECT ?+0.0 and supplies time value for the placeholder. */ - return TIME_to_double(&value.time); - case IGNORE_VALUE: - case DEFAULT_VALUE: - invalid_default_param(); - // fall through - case NULL_VALUE: - return 0.0; - case NO_VALUE: - DBUG_ASSERT(0); // Should not be possible - return 0.0; + return TIME_to_double(&time); + case ROW_RESULT: + DBUG_ASSERT(0); + break; } - DBUG_ASSERT(0); // Garbage return 0.0; -} +} -longlong Item_param::val_int() -{ - // There's no "default". See comments in Item_param::save_in_field(). - switch (state) { - case REAL_VALUE: - return (longlong) rint(value.real); - case INT_VALUE: - return value.integer; - case DECIMAL_VALUE: +longlong Item_param::PValue::val_int(const Type_std_attributes *attr) const +{ + switch (type_handler()->cmp_type()) { + case REAL_RESULT: + return (longlong) rint(real); + case INT_RESULT: + return integer; + case DECIMAL_RESULT: { longlong i; - my_decimal2int(E_DEC_FATAL_ERROR, &decimal_value, unsigned_flag, &i); + my_decimal2int(E_DEC_FATAL_ERROR, &m_decimal, attr->unsigned_flag, &i); return i; } - case STRING_VALUE: - case LONG_DATA_VALUE: - { - return longlong_from_string_with_check(&str_value); - } - case TIME_VALUE: - return (longlong) TIME_to_ulonglong(&value.time); - case IGNORE_VALUE: - case DEFAULT_VALUE: - invalid_default_param(); - // fall through - case NULL_VALUE: - return 0; - case NO_VALUE: - DBUG_ASSERT(0); // Should not be possible - return 0; + case STRING_RESULT: + return longlong_from_string_with_check(&m_string); + case TIME_RESULT: + return (longlong) TIME_to_ulonglong(&time); + case ROW_RESULT: + DBUG_ASSERT(0); + break; } - DBUG_ASSERT(0); // Garbage return 0; } -my_decimal *Item_param::val_decimal(my_decimal *dec) +my_decimal *Item_param::PValue::val_decimal(my_decimal *dec, + const Type_std_attributes *attr) { - // There's no "default". See comments in Item_param::save_in_field(). - switch (state) { - case DECIMAL_VALUE: - return &decimal_value; - case REAL_VALUE: - double2my_decimal(E_DEC_FATAL_ERROR, value.real, dec); + switch (type_handler()->cmp_type()) { + case DECIMAL_RESULT: + return &m_decimal; + case REAL_RESULT: + double2my_decimal(E_DEC_FATAL_ERROR, real, dec); return dec; - case INT_VALUE: - int2my_decimal(E_DEC_FATAL_ERROR, value.integer, unsigned_flag, dec); + case INT_RESULT: + int2my_decimal(E_DEC_FATAL_ERROR, integer, attr->unsigned_flag, dec); return dec; - case STRING_VALUE: - case LONG_DATA_VALUE: - return decimal_from_string_with_check(dec, &str_value); - case TIME_VALUE: - { - return TIME_to_my_decimal(&value.time, dec); + case STRING_RESULT: + return decimal_from_string_with_check(dec, &m_string); + case TIME_RESULT: + return TIME_to_my_decimal(&time, dec); + case ROW_RESULT: + DBUG_ASSERT(0); + break; } - case IGNORE_VALUE: - case DEFAULT_VALUE: - invalid_default_param(); - // fall through - case NULL_VALUE: - return 0; - case NO_VALUE: - DBUG_ASSERT(0); // Should not be possible - return 0; - } - DBUG_ASSERT(0); // Gabrage return 0; } -String *Item_param::val_str(String* str) -{ - // There's no "default". See comments in Item_param::save_in_field(). - switch (state) { - case STRING_VALUE: - case LONG_DATA_VALUE: - return &str_value_ptr; - case REAL_VALUE: - str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin); +String *Item_param::PValue::val_str(String *str, + const Type_std_attributes *attr) +{ + switch (type_handler()->cmp_type()) { + case STRING_RESULT: + return &m_string_ptr; + case REAL_RESULT: + str->set_real(real, NOT_FIXED_DEC, &my_charset_bin); return str; - case INT_VALUE: - str->set(value.integer, &my_charset_bin); + case INT_RESULT: + str->set(integer, &my_charset_bin); return str; - case DECIMAL_VALUE: - if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, - 0, 0, 0, str) <= 1) + case DECIMAL_RESULT: + if (my_decimal2string(E_DEC_FATAL_ERROR, &m_decimal, 0, 0, 0, str) <= 1) return str; return NULL; - case TIME_VALUE: + case TIME_RESULT: { if (str->reserve(MAX_DATE_STRING_REP_LENGTH)) - break; - str->length((uint) my_TIME_to_str(&value.time, (char*) str->ptr(), - decimals)); + return NULL; + str->length((uint) my_TIME_to_str(&time, (char*) str->ptr(), + attr->decimals)); str->set_charset(&my_charset_bin); return str; } - case IGNORE_VALUE: - case DEFAULT_VALUE: - invalid_default_param(); - // fall through - case NULL_VALUE: - return NULL; - case NO_VALUE: - DBUG_ASSERT(0); // Should not be possible - return NULL; + case ROW_RESULT: + DBUG_ASSERT(0); + break; } - DBUG_ASSERT(0); // Garbage return NULL; } + /** Return Param item values in string format, for generating the dynamic query used in update/binary logs. @@ -4290,32 +4527,31 @@ String *Item_param::val_str(String* str) that binary log contains wrong statement */ -const String *Item_param::query_val_str(THD *thd, String* str) const +const String *Item_param::value_query_val_str(THD *thd, String *str) const { - // There's no "default". See comments in Item_param::save_in_field(). - switch (state) { - case INT_VALUE: + switch (value.type_handler()->cmp_type()) { + case INT_RESULT: str->set_int(value.integer, unsigned_flag, &my_charset_bin); return str; - case REAL_VALUE: + case REAL_RESULT: str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin); return str; - case DECIMAL_VALUE: - if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, + case DECIMAL_RESULT: + if (my_decimal2string(E_DEC_FATAL_ERROR, &value.m_decimal, 0, 0, 0, str) > 1) return &my_null_string; return str; - case TIME_VALUE: + case TIME_RESULT: { static const uint32 typelen= 9; // "TIMESTAMP" is the longest type name char *buf, *ptr; str->length(0); /* TODO: in case of error we need to notify replication - that binary log contains wrong statement + that binary log contains wrong statement */ if (str->reserve(MAX_DATE_STRING_REP_LENGTH + 3 + typelen)) - break; + return NULL; /* Create date string inplace */ switch (value.time.time_type) { @@ -4341,15 +4577,29 @@ const String *Item_param::query_val_str(THD *thd, String* str) const str->length((uint32) (ptr - buf)); return str; } - case STRING_VALUE: - case LONG_DATA_VALUE: + case STRING_RESULT: { str->length(0); append_query_string(value.cs_info.character_set_client, str, - str_value.ptr(), str_value.length(), + value.m_string.ptr(), value.m_string.length(), thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES); return str; } + case ROW_RESULT: + DBUG_ASSERT(0); + break; + } + return NULL; +} + + +const String *Item_param::query_val_str(THD *thd, String* str) const +{ + // There's no "default". See comments in Item_param::save_in_field(). + switch (state) { + case SHORT_DATA_VALUE: + case LONG_DATA_VALUE: + return value_query_val_str(thd, str); case IGNORE_VALUE: case DEFAULT_VALUE: return &my_default_string; @@ -4372,19 +4622,20 @@ const String *Item_param::query_val_str(THD *thd, String* str) const bool Item_param::convert_str_value(THD *thd) { bool rc= FALSE; - if (state == STRING_VALUE || state == LONG_DATA_VALUE) + if ((state == SHORT_DATA_VALUE || state == LONG_DATA_VALUE) && + value.type_handler()->cmp_type() == STRING_RESULT) { - rc= value.cs_info.convert_if_needed(thd, &str_value); + rc= value.cs_info.convert_if_needed(thd, &value.m_string); /* Here str_value is guaranteed to be in final_character_set_of_str_value */ /* str_value_ptr is returned from val_str(). It must be not alloced to prevent it's modification by val_str() invoker. */ - str_value_ptr.set(str_value.ptr(), str_value.length(), - str_value.charset()); + value.m_string_ptr.set(value.m_string.ptr(), value.m_string.length(), + value.m_string.charset()); /* Synchronize item charset and length with value charset */ - fix_charset_and_length_from_str_value(DERIVATION_COERCIBLE); + fix_charset_and_length_from_str_value(value.m_string, DERIVATION_COERCIBLE); } return rc; } @@ -4393,18 +4644,48 @@ bool Item_param::convert_str_value(THD *thd) bool Item_param::basic_const_item() const { DBUG_ASSERT(fixed || state == NO_VALUE); - if (state == NO_VALUE || state == TIME_VALUE) + if (state == NO_VALUE || + (state == SHORT_DATA_VALUE && type_handler()->cmp_type() == TIME_RESULT)) return FALSE; return TRUE; } +Item *Item_param::value_clone_item(THD *thd) +{ + MEM_ROOT *mem_root= thd->mem_root; + switch (value.type_handler()->cmp_type()) { + case INT_RESULT: + return (unsigned_flag ? + new (mem_root) Item_uint(thd, name.str, value.integer, max_length) : + new (mem_root) Item_int(thd, name.str, value.integer, max_length)); + case REAL_RESULT: + return new (mem_root) Item_float(thd, name.str, value.real, decimals, + max_length); + case DECIMAL_RESULT: + return 0; // Should create Item_decimal. See MDEV-11361. + case STRING_RESULT: + return new (mem_root) Item_string(thd, name.str, + value.m_string.c_ptr_quick(), + value.m_string.length(), + value.m_string.charset(), + collation.derivation, + collation.repertoire); + case TIME_RESULT: + break; + case ROW_RESULT: + DBUG_ASSERT(0); + break; + } + return 0; +} + + /* see comments in the header file */ Item * Item_param::clone_item(THD *thd) { - MEM_ROOT *mem_root= thd->mem_root; // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case IGNORE_VALUE: @@ -4412,24 +4693,13 @@ Item_param::clone_item(THD *thd) invalid_default_param(); // fall through case NULL_VALUE: - return new (mem_root) Item_null(thd, name.str); - case INT_VALUE: - return (unsigned_flag ? - new (mem_root) Item_uint(thd, name.str, value.integer, max_length) : - new (mem_root) Item_int(thd, name.str, value.integer, max_length)); - case REAL_VALUE: - return new (mem_root) Item_float(thd, name.str, value.real, decimals, - max_length); - case DECIMAL_VALUE: - return 0; // Should create Item_decimal. See MDEV-11361. - case STRING_VALUE: + return new (thd->mem_root) Item_null(thd, name.str); + case SHORT_DATA_VALUE: case LONG_DATA_VALUE: - return new (mem_root) Item_string(thd, name.str, str_value.c_ptr_quick(), - str_value.length(), str_value.charset(), - collation.derivation, - collation.repertoire); - case TIME_VALUE: - return 0; + { + DBUG_ASSERT(type_handler()->cmp_type() == value.type_handler()->cmp_type()); + return value_clone_item(thd); + } case NO_VALUE: return 0; } @@ -4438,6 +4708,24 @@ Item_param::clone_item(THD *thd) } +bool Item_param::value_eq(const Item *item, bool binary_cmp) const +{ + switch (value.type_handler()->cmp_type()) { + case INT_RESULT: + return int_eq(value.integer, item); + case REAL_RESULT: + return real_eq(value.real, item); + case STRING_RESULT: + return str_eq(&value.m_string, item, binary_cmp); + case DECIMAL_RESULT: + case TIME_RESULT: + case ROW_RESULT: + break; + } + return false; +} + + bool Item_param::eq(const Item *item, bool binary_cmp) const { @@ -4452,15 +4740,9 @@ Item_param::eq(const Item *item, bool binary_cmp) const return false; case NULL_VALUE: return null_eq(item); - case INT_VALUE: - return int_eq(value.integer, item); - case REAL_VALUE: - return real_eq(value.real, item); - case STRING_VALUE: + case SHORT_DATA_VALUE: case LONG_DATA_VALUE: - return str_eq(&str_value, item, binary_cmp); - case DECIMAL_VALUE: - case TIME_VALUE: + return value_eq(item, binary_cmp); case NO_VALUE: return false; } @@ -4521,18 +4803,14 @@ Item_param::set_param_type_and_swap_value(Item_param *src) { Type_std_attributes::set(src); set_handler(src->type_handler()); - set_param_func= src->set_param_func; item_type= src->item_type; maybe_null= src->maybe_null; null_value= src->null_value; state= src->state; fixed= src->fixed; - value= src->value; - decimal_value.swap(src->decimal_value); - str_value.swap(src->str_value); - str_value_ptr.swap(src->str_value_ptr); + value.swap(src->value); } @@ -4577,65 +4855,21 @@ bool Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it) { Item *arg= *it; - - if (arg->is_null()) + struct st_value tmp; + /* + The OUT parameter is bound to some data type. + It's important not to touch m_type_handler, + to make sure the next mysql_stmt_execute() + correctly fetches the value from the client-server protocol, + using set_param_func(). + */ + if (arg->save_in_value(&tmp) || + set_value(thd, arg, &tmp, arg->type_handler())) { set_null(); - return FALSE; + return false; } - - null_value= FALSE; - - switch (arg->result_type()) { - case STRING_RESULT: - { - char str_buffer[STRING_BUFFER_USUAL_SIZE]; - String sv_buffer(str_buffer, sizeof(str_buffer), &my_charset_bin); - String *sv= arg->val_str(&sv_buffer); - - if (!sv) - return TRUE; - - set_str(sv->c_ptr_safe(), sv->length()); - str_value_ptr.set(str_value.ptr(), - str_value.length(), - str_value.charset()); - collation.set(str_value.charset(), DERIVATION_COERCIBLE); - decimals= 0; - break; - } - - case REAL_RESULT: - set_double(arg->val_real()); - break; - - case INT_RESULT: - set_int(arg->val_int(), arg->max_length); - break; - - case DECIMAL_RESULT: - { - my_decimal dv_buf; - my_decimal *dv= arg->val_decimal(&dv_buf); - - if (!dv) - return TRUE; - - set_decimal(dv, !dv->sign()); - break; - } - - default: - /* That can not happen. */ - - DBUG_ASSERT(TRUE); // Abort in debug mode. - - set_null(); // Set to NULL in release mode. - return FALSE; - } - - set_handler_by_result_type(arg->result_type()); - return FALSE; + return null_value= false; } @@ -8274,7 +8508,7 @@ Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg): with_sum_func= orig_item->with_sum_func; with_field= orig_item->with_field; name= item_arg->name; - with_subselect= orig_item->with_subselect; + m_with_subquery= orig_item->with_subquery(); if ((expr_value= orig_item->get_cache(thd))) expr_value->setup(thd, orig_item); diff --git a/sql/item.h b/sql/item.h index b81af3db4de..d178d9f97d6 100644 --- a/sql/item.h +++ b/sql/item.h @@ -411,6 +411,8 @@ public: virtual const Send_field *get_out_param_info() const { return NULL; } + + virtual Item_param *get_item_param() { return 0; } }; @@ -720,9 +722,6 @@ public: bool fixed; /* If item fixed with fix_fields */ bool is_autogenerated_name; /* indicate was name of this Item autogenerated or set by user */ - bool with_subselect; /* If this item is a subselect or some - of its arguments is or contains a - subselect */ // alloc & destruct is done as start of select on THD::mem_root Item(THD *thd); /* @@ -1898,9 +1897,10 @@ public: virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; } /** - Checks if this item or any of its decendents contains a subquery. + Checks if this item or any of its decendents contains a subquery. This is a + replacement of the former Item::has_subquery() and Item::with_subselect. */ - virtual bool has_subquery() const { return with_subselect; } + virtual bool with_subquery() const { DBUG_ASSERT(fixed); return false; } Item* set_expr_cache(THD *thd); @@ -1978,6 +1978,21 @@ inline Item* get_item_copy (THD *thd, T* item) } +/* + This class is a replacement for the former member Item::with_subselect. + Determines if the descendant Item is a subselect or some of + its arguments is or contains a subselect. +*/ +class With_subquery_cache +{ +protected: + bool m_with_subquery; +public: + With_subquery_cache(): m_with_subquery(false) { } + void join(const Item *item) { m_with_subquery|= item->with_subquery(); } +}; + + class Type_geometry_attributes { uint m_geometry_type; @@ -2200,7 +2215,8 @@ protected: uint repertoire() const { return MY_STRING_METADATA::repertoire; } size_t char_length() const { return MY_STRING_METADATA::char_length; } }; - void fix_charset_and_length_from_str_value(Derivation dv, Metadata metadata) + void fix_charset_and_length(CHARSET_INFO *cs, + Derivation dv, Metadata metadata) { /* We have to have a different max_length than 'length' here to @@ -2209,13 +2225,13 @@ protected: number of chars for a string of this type because we in Create_field:: divide the max_length with mbmaxlen). */ - collation.set(str_value.charset(), dv, metadata.repertoire()); + collation.set(cs, dv, metadata.repertoire()); fix_char_length(metadata.char_length()); decimals= NOT_FIXED_DEC; } - void fix_charset_and_length_from_str_value(Derivation dv) + void fix_charset_and_length_from_str_value(const String &str, Derivation dv) { - fix_charset_and_length_from_str_value(dv, Metadata(&str_value)); + fix_charset_and_length(str.charset(), dv, Metadata(&str)); } Item_basic_value(THD *thd): Item(thd) {} /* @@ -3097,12 +3113,27 @@ public: For example in case of 'SELECT ?' you'll get MYSQL_TYPE_STRING both in result set and placeholders metadata, no matter what type you will supply for this placeholder in mysql_stmt_execute. + + Item_param has two Type_handler pointers, + which can point to different handlers: + + 1. In the Type_handler_hybrid_field_type member + It's initialized in: + - Item_param::setup_conversion(), for client-server PS protocol, + according to the bind type. + - Item_param::set_from_item(), for EXECUTE and EXECUTE IMMEDIATE, + according to the actual parameter data type. + + 2. In the "value" member. + It's initialized in: + - Item_param::set_param_func(), for client-server PS protocol. + - Item_param::set_from_item(), for EXECUTE and EXECUTE IMMEDIATE. */ class Item_param :public Item_basic_value, private Settable_routine_parameter, public Rewritable_query_parameter, - public Type_handler_hybrid_field_type, + private Type_handler_hybrid_field_type, public Type_geometry_attributes { /* @@ -3148,9 +3179,8 @@ class Item_param :public Item_basic_value, */ enum enum_item_param_state { - NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, - STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, - DECIMAL_VALUE, DEFAULT_VALUE, IGNORE_VALUE + NO_VALUE, NULL_VALUE, SHORT_DATA_VALUE, LONG_DATA_VALUE, + DEFAULT_VALUE, IGNORE_VALUE } state; enum Type item_type; @@ -3163,7 +3193,6 @@ class Item_param :public Item_basic_value, void fix_temporal(uint32 max_length_arg, uint decimals_arg); -public: struct CONVERSION_INFO { /* @@ -3205,31 +3234,71 @@ public: } }; + bool m_empty_string_is_null; + + class PValue_simple + { + public: + union + { + longlong integer; + double real; + CONVERSION_INFO cs_info; + MYSQL_TIME time; + }; + void swap(PValue_simple &other) + { + swap_variables(PValue_simple, *this, other); + } + }; + + class PValue: public Type_handler_hybrid_field_type, + public PValue_simple, + public Value_source + { + public: + PValue(): Type_handler_hybrid_field_type(&type_handler_null) {} + my_decimal m_decimal; + String m_string; + /* + A buffer for string and long data values. Historically all allocated + values returned from val_str() were treated as eligible to + modification. I. e. in some cases Item_func_concat can append it's + second argument to return value of the first one. Because of that we + can't return the original buffer holding string data from val_str(), + and have to have one buffer for data and another just pointing to + the data. This is the latter one and it's returned from val_str(). + Can not be declared inside the union as it's not a POD type. + */ + String m_string_ptr; + + void swap(PValue &other) + { + Type_handler_hybrid_field_type::swap(other); + PValue_simple::swap(other); + m_decimal.swap(other.m_decimal); + m_string.swap(other.m_string); + m_string_ptr.swap(other.m_string_ptr); + } + double val_real() const; + longlong val_int(const Type_std_attributes *attr) const; + my_decimal *val_decimal(my_decimal *dec, const Type_std_attributes *attr); + String *val_str(String *str, const Type_std_attributes *attr); + }; + + PValue value; + + const String *value_query_val_str(THD *thd, String* str) const; + bool value_eq(const Item *item, bool binary_cmp) const; + Item *value_clone_item(THD *thd); + bool can_return_value() const; + +public: /* Used for bulk protocol only. */ enum enum_indicator_type indicator; - /* - A buffer for string and long data values. Historically all allocated - values returned from val_str() were treated as eligible to - modification. I. e. in some cases Item_func_concat can append it's - second argument to return value of the first one. Because of that we - can't return the original buffer holding string data from val_str(), - and have to have one buffer for data and another just pointing to - the data. This is the latter one and it's returned from val_str(). - Can not be declared inside the union as it's not a POD type. - */ - String str_value_ptr; - my_decimal decimal_value; - union - { - longlong integer; - double real; - CONVERSION_INFO cs_info; - MYSQL_TIME time; - } value; - const Type_handler *type_handler() const { return Type_handler_hybrid_field_type::type_handler(); } @@ -3248,10 +3317,22 @@ public: return item_type; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal*); - String *val_str(String*); + double val_real() + { + return can_return_value() ? value.val_real() : 0e0; + } + longlong val_int() + { + return can_return_value() ? value.val_int(this) : 0; + } + my_decimal *val_decimal(my_decimal *dec) + { + return can_return_value() ? value.val_decimal(dec, this) : NULL; + } + String *val_str(String *str) + { + return can_return_value() ? value.val_str(str, this) : NULL; + } bool get_date(MYSQL_TIME *tm, ulonglong fuzzydate); int save_in_field(Field *field, bool no_conversions); @@ -3262,20 +3343,64 @@ public: void set_double(double i); void set_decimal(const char *str, ulong length); void set_decimal(const my_decimal *dv, bool unsigned_arg); - bool set_str(const char *str, ulong length); + bool set_str(const char *str, ulong length, + CHARSET_INFO *fromcs, CHARSET_INFO *tocs); bool set_longdata(const char *str, ulong length); void set_time(MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg); void set_time(const MYSQL_TIME *tm, uint32 max_length_arg, uint decimals_arg); bool set_from_item(THD *thd, Item *item); void reset(); + + void set_param_tiny(uchar **pos, ulong len); + void set_param_short(uchar **pos, ulong len); + void set_param_int32(uchar **pos, ulong len); + void set_param_int64(uchar **pos, ulong len); + void set_param_float(uchar **pos, ulong len); + void set_param_double(uchar **pos, ulong len); + void set_param_decimal(uchar **pos, ulong len); + void set_param_time(uchar **pos, ulong len); + void set_param_datetime(uchar **pos, ulong len); + void set_param_date(uchar **pos, ulong len); + void set_param_str(uchar **pos, ulong len); + + void setup_conversion(THD *thd, uchar param_type); + void setup_conversion_blob(THD *thd); + void setup_conversion_string(THD *thd, CHARSET_INFO *fromcs); + /* Assign placeholder value from bind data. Note, that 'len' has different semantics in embedded library (as we don't need to check that packet is not broken there). See sql_prepare.cc for details. */ - void (*set_param_func)(Item_param *param, uchar **pos, ulong len); + void set_param_func(uchar **pos, ulong len) + { + /* + To avoid Item_param::set_xxx() asserting on data type mismatch, + we set the value type handler here: + - It can not be initialized yet after Item_param::setup_conversion(). + - Also, for LIMIT clause parameters, the value type handler might have + changed from the real type handler to type_handler_longlong. + So here we'll restore it. + */ + const Type_handler *h= Item_param::type_handler(); + value.set_handler(h); + h->Item_param_set_param_func(this, pos, len); + } + bool set_value(THD *thd, const Type_all_attributes *attr, + const st_value *val, const Type_handler *h) + { + value.set_handler(h); // See comments in set_param_func() + return h->Item_param_set_from_value(thd, this, attr, val); + } + + bool set_limit_clause_param(longlong nr) + { + value.set_handler(&type_handler_longlong); + set_int(nr, MY_INT64_NUM_DECIMAL_DIGITS); + return !unsigned_flag && value.integer < 0; + } const String *query_val_str(THD *thd, String *str) const; bool convert_str_value(THD *thd); @@ -3301,7 +3426,8 @@ public: } bool has_int_value() const { - return state == INT_VALUE; + return state == SHORT_DATA_VALUE && + value.type_handler()->cmp_type() == INT_RESULT; } /* This method is used to make a copy of a basic constant item when @@ -3342,6 +3468,8 @@ private: public: virtual const Send_field *get_out_param_info() const; + Item_param *get_item_param() { return this; } + virtual void make_field(THD *thd, Send_field *field); private: @@ -3562,7 +3690,7 @@ class Item_string :public Item_basic_constant protected: void fix_from_value(Derivation dv, const Metadata metadata) { - fix_charset_and_length_from_str_value(dv, metadata); + fix_charset_and_length(str_value.charset(), dv, metadata); // it is constant => can be used without fix_fields (and frequently used) fixed= 1; } @@ -4279,7 +4407,8 @@ public: */ class Item_func_or_sum: public Item_result_field, public Item_args, - public Used_tables_and_const_cache + public Used_tables_and_const_cache, + public With_subquery_cache { protected: bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, @@ -4362,6 +4491,7 @@ public: Used_tables_and_const_cache(item) { } Item_func_or_sum(THD *thd, List &list): Item_result_field(thd), Item_args(thd, list) { } + bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } bool walk(Item_processor processor, bool walk_subquery, void *arg) { if (walk_args(processor, walk_subquery, arg)) @@ -4391,6 +4521,35 @@ public: Item* build_clone(THD *thd); }; +class sp_head; +class sp_name; +struct st_sp_security_context; + +class Item_sp +{ +public: + Name_resolution_context *context; + sp_name *m_name; + sp_head *m_sp; + TABLE *dummy_table; + uchar result_buf[64]; + sp_rcontext *func_ctx; + MEM_ROOT sp_mem_root; + Query_arena *sp_query_arena; + + /* + The result field of the stored function. + */ + Field *sp_result_field; + Item_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name_arg); + const char *func_name(THD *thd) const; + void cleanup(); + bool sp_check_access(THD *thd); + bool execute(THD *thd, bool *null_value, Item **args, uint arg_count); + bool execute_impl(THD *thd, Item **args, uint arg_count); + bool init_result_field(THD *thd, uint max_length, uint maybe_null, + bool *null_value, LEX_CSTRING *name); +}; class Item_ref :public Item_ident { @@ -4576,9 +4735,9 @@ public: /** Checks if the item tree that ref points to contains a subquery. */ - virtual bool has_subquery() const - { - return (*ref)->has_subquery(); + virtual bool with_subquery() const + { + return (*ref)->with_subquery(); } Item *get_copy(THD *thd) { return get_item_copy(thd, this); } @@ -4701,7 +4860,8 @@ class Expression_cache_tracker; The objects of this class can store its values in an expression cache. */ -class Item_cache_wrapper :public Item_result_field +class Item_cache_wrapper :public Item_result_field, + public With_subquery_cache { private: /* Pointer on the cached expression */ @@ -4728,6 +4888,7 @@ public: enum Type type() const { return EXPR_CACHE_ITEM; } enum Type real_type() const { return orig_item->type(); } + bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } bool set_cache(THD *thd); Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root); @@ -5773,6 +5934,7 @@ public: } virtual void store(Item *item); + virtual Item *get_item() { return example; } virtual bool cache_value()= 0; bool basic_const_item() const { return MY_TEST(example && example->basic_const_item()); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4360e629388..d38b0100246 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1368,7 +1368,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref) } if (args[1]->maybe_null) maybe_null=1; - with_subselect= 1; + m_with_subquery= true; with_sum_func= with_sum_func || args[1]->with_sum_func; with_field= with_field || args[1]->with_field; used_tables_and_const_cache_join(args[1]); @@ -4626,7 +4626,7 @@ Item_cond::fix_fields(THD *thd, Item **ref) with_sum_func|= item->with_sum_func; with_field|= item->with_field; - with_subselect|= item->has_subquery(); + m_with_subquery|= item->with_subquery(); with_window_func|= item->with_window_func; maybe_null|= item->maybe_null; } @@ -5487,7 +5487,7 @@ void Regexp_processor_pcre::pcre_exec_warn(int rc) const switch (rc) { case PCRE_ERROR_NULL: - errmsg= "pcre_exec: null arguement passed"; + errmsg= "pcre_exec: null argument passed"; break; case PCRE_ERROR_BADOPTION: errmsg= "pcre_exec: bad option"; @@ -6629,7 +6629,7 @@ bool Item_equal::fix_fields(THD *thd, Item **ref) used_tables_cache|= item->used_tables(); tmp_table_map= item->not_null_tables(); not_null_tables_cache|= tmp_table_map; - DBUG_ASSERT(!item->with_sum_func && !item->with_subselect); + DBUG_ASSERT(!item->with_sum_func && !item->with_subquery()); if (item->maybe_null) maybe_null= 1; if (!item->get_item_equal()) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0a3339e7ffe..1561a78a12a 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -356,7 +356,7 @@ public: Item_in_optimizer(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b), cache(0), expr_cache(0), save_cache(0), result_for_null_param(UNKNOWN) - { with_subselect= true; } + { m_with_subquery= true; } bool fix_fields(THD *, Item **); bool fix_left(THD *thd); table_map not_null_tables() const { return 0; } diff --git a/sql/item_func.cc b/sql/item_func.cc index 659ec29e452..a8b4a64856e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -362,7 +362,7 @@ Item_func::fix_fields(THD *thd, Item **ref) with_window_func= with_window_func || item->with_window_func; with_field= with_field || item->with_field; used_tables_and_const_cache_join(item); - with_subselect|= item->has_subquery(); + m_with_subquery|= item->with_subquery(); } } if (check_arguments()) @@ -3249,7 +3249,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, func->maybe_null=1; func->with_sum_func= func->with_sum_func || item->with_sum_func; func->with_field= func->with_field || item->with_field; - func->with_subselect|= item->with_subselect; + func->With_subquery_cache::join(item); func->used_tables_and_const_cache_join(item); f_args.arg_type[i]=item->result_type(); } @@ -6238,35 +6238,24 @@ longlong Item_func_row_count::val_int() Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name): - Item_func(thd), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL) + Item_func(thd), Item_sp(thd, context_arg, name) { maybe_null= 1; - dummy_table= (TABLE*) thd->calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); - dummy_table->s= (TABLE_SHARE*) (dummy_table+1); } Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name_arg, List &list): - Item_func(thd, list), context(context_arg), m_name(name_arg), m_sp(NULL), - sp_result_field(NULL) + Item_func(thd, list), Item_sp(thd, context_arg, name_arg) { maybe_null= 1; - dummy_table= (TABLE*) thd->calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE)); - dummy_table->s= (TABLE_SHARE*) (dummy_table+1); } void Item_func_sp::cleanup() { - if (sp_result_field) - { - delete sp_result_field; - sp_result_field= NULL; - } - m_sp= NULL; - dummy_table->alias.free(); + Item_sp::cleanup(); Item_func::cleanup(); } @@ -6274,25 +6263,7 @@ const char * Item_func_sp::func_name() const { THD *thd= current_thd; - /* Calculate length to avoid reallocation of string for sure */ - uint len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) + - m_name->m_name.length)*2 + //characters*quoting - 2 + // ` and ` - (m_name->m_explicit_name ? - 3 : 0) + // '`', '`' and '.' for the db - 1 + // end of string - ALIGN_SIZE(1)); // to avoid String reallocation - String qname((char *)alloc_root(thd->mem_root, len), len, - system_charset_info); - - qname.length(0); - if (m_name->m_explicit_name) - { - append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length); - qname.append('.'); - } - append_identifier(thd, &qname, m_name->m_name.str, m_name->m_name.length); - return qname.c_ptr_safe(); + return Item_sp::func_name(thd); } @@ -6305,75 +6276,6 @@ void my_missing_function_error(const LEX_CSTRING &token, const char *func_name) } -/** - @brief Initialize the result field by creating a temporary dummy table - and assign it to a newly created field object. Meta data used to - create the field is fetched from the sp_head belonging to the stored - proceedure found in the stored procedure functon cache. - - @note This function should be called from fix_fields to init the result - field. It is some what related to Item_field. - - @see Item_field - - @param thd A pointer to the session and thread context. - - @return Function return error status. - @retval TRUE is returned on an error - @retval FALSE is returned on success. -*/ - -bool -Item_func_sp::init_result_field(THD *thd, sp_head *sp) -{ - TABLE_SHARE *share; - DBUG_ENTER("Item_func_sp::init_result_field"); - - DBUG_ASSERT(m_sp == NULL); - DBUG_ASSERT(sp_result_field == NULL); - - if (!(m_sp= sp)) - { - my_missing_function_error (m_name->m_name, ErrConvDQName(m_name).ptr()); - context->process_error(thd); - DBUG_RETURN(TRUE); - } - - /* - A Field need to be attached to a Table. - Below we "create" a dummy table by initializing - the needed pointers. - */ - - share= dummy_table->s; - dummy_table->alias.set("", 0, table_alias_charset); - dummy_table->maybe_null = maybe_null; - dummy_table->in_use= thd; - dummy_table->copy_blobs= TRUE; - share->table_cache_key= empty_clex_str; - share->table_name= empty_clex_str; - - if (!(sp_result_field= m_sp->create_result_field(max_length, &name, dummy_table))) - { - DBUG_RETURN(TRUE); - } - - if (sp_result_field->pack_length() > sizeof(result_buf)) - { - void *tmp; - if (!(tmp= thd->alloc(sp_result_field->pack_length()))) - DBUG_RETURN(TRUE); - sp_result_field->move_field((uchar*) tmp); - } - else - sp_result_field->move_field(result_buf); - - sp_result_field->null_ptr= (uchar *) &null_value; - sp_result_field->null_bit= 1; - DBUG_RETURN(FALSE); -} - - /** @note Deterministic stored procedures are considered inexpensive. @@ -6408,95 +6310,11 @@ void Item_func_sp::fix_length_and_dec() } -/** - @brief Execute function & store value in field. - - @return Function returns error status. - @retval FALSE on success. - @retval TRUE if an error occurred. -*/ - bool Item_func_sp::execute() { - THD *thd= current_thd; - /* Execute function and store the return value in the field. */ - - if (execute_impl(thd)) - { - null_value= 1; - context->process_error(thd); - if (thd->killed) - thd->send_kill_message(); - return TRUE; - } - - /* Check that the field (the value) is not NULL. */ - - null_value= sp_result_field->is_null(); - - return null_value; -} - - -/** - @brief Execute function and store the return value in the field. - - @note This function was intended to be the concrete implementation of - the interface function execute. This was never realized. - - @return The error state. - @retval FALSE on success - @retval TRUE if an error occurred. -*/ -bool -Item_func_sp::execute_impl(THD *thd) -{ - bool err_status= TRUE; - Sub_statement_state statement_state; - Security_context *save_security_ctx= thd->security_ctx; - enum enum_sp_data_access access= - (m_sp->daccess() == SP_DEFAULT_ACCESS) ? - SP_DEFAULT_ACCESS_MAPPING : m_sp->daccess(); - - DBUG_ENTER("Item_func_sp::execute_impl"); - - if (context->security_ctx) - { - /* Set view definer security context */ - thd->security_ctx= context->security_ctx; - } - if (sp_check_access(thd)) - goto error; - - /* - Throw an error if a non-deterministic function is called while - statement-based replication (SBR) is active. - */ - - if (!m_sp->detistic() && !trust_function_creators && - (access == SP_CONTAINS_SQL || access == SP_MODIFIES_SQL_DATA) && - (mysql_bin_log.is_open() && - thd->variables.binlog_format == BINLOG_FORMAT_STMT)) - { - my_error(ER_BINLOG_UNSAFE_ROUTINE, MYF(0)); - goto error; - } - - /* - Disable the binlogging if this is not a SELECT statement. If this is a - SELECT, leave binlogging on, so execute_function() code writes the - function call into binlog. - */ - thd->reset_sub_statement_state(&statement_state, SUB_STMT_FUNCTION); - err_status= m_sp->execute_function(thd, args, arg_count, sp_result_field); - thd->restore_sub_statement_state(&statement_state); - -error: - thd->security_ctx= save_security_ctx; - - DBUG_RETURN(err_status); + return Item_sp::execute(current_thd, &null_value, args, arg_count); } @@ -6561,29 +6379,6 @@ longlong Item_func_sqlcode::val_int() } -/** - @brief Checks if requested access to function can be granted to user. - If function isn't found yet, it searches function first. - If function can't be found or user don't have requested access - error is raised. - - @param thd thread handler - - @return Indication if the access was granted or not. - @retval FALSE Access is granted. - @retval TRUE Requested access can't be granted or function doesn't exists. - -*/ - -bool -Item_func_sp::sp_check_access(THD *thd) -{ - DBUG_ENTER("Item_func_sp::sp_check_access"); - DBUG_ASSERT(m_sp); - DBUG_RETURN(m_sp->check_execute_access(thd)); -} - - bool Item_func_sp::fix_fields(THD *thd, Item **ref) { @@ -6620,20 +6415,66 @@ Item_func_sp::fix_fields(THD *thd, Item **ref) } } + + /* Custom aggregates are transformed into an Item_sum_sp. We can not do this + earlier as we have no way of knowing what kind of Item we should create + when parsing the query. + + TODO(cvicentiu): See if this limitation can be lifted. + */ + + DBUG_ASSERT(m_sp == NULL); + if (!(m_sp= sp)) + { + my_missing_function_error(m_name->m_name, ErrConvDQName(m_name).ptr()); + context->process_error(thd); + DBUG_RETURN(TRUE); + } + /* - We must call init_result_field before Item_func::fix_fields() + We must call init_result_field before Item_func::fix_fields() to make m_sp and result_field members available to fix_length_and_dec(), which is called from Item_func::fix_fields(). */ - res= init_result_field(thd, sp); + res= init_result_field(thd, max_length, maybe_null, &null_value, &name); if (res) - DBUG_RETURN(res); + DBUG_RETURN(TRUE); + + if (m_sp->agg_type() == GROUP_AGGREGATE) + { + List list; + list.empty(); + for (uint i=0; i < arg_count; i++) + list.push_back(*(args+i)); + + Item_sum_sp *item_sp; + Query_arena *arena, backup; + arena= thd->activate_stmt_arena_if_needed(&backup); + + if (arg_count) + item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp, list); + else + item_sp= new (thd->mem_root) Item_sum_sp(thd, context, m_name, sp); + + if (arena) + thd->restore_active_arena(arena, &backup); + if (!item_sp) + DBUG_RETURN(TRUE); + *ref= item_sp; + item_sp->name= name; + bool err= item_sp->fix_fields(thd, ref); + if (err) + DBUG_RETURN(TRUE); + + list.empty(); + DBUG_RETURN(FALSE); + } res= Item_func::fix_fields(thd, ref); if (res) - DBUG_RETURN(res); + DBUG_RETURN(TRUE); if (thd->lex->is_view_context_analysis()) { diff --git a/sql/item_func.h b/sql/item_func.h index c4a87b4f699..f6640c9b719 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -2735,26 +2735,12 @@ public: * */ -class sp_head; -class sp_name; -struct st_sp_security_context; - -class Item_func_sp :public Item_func +class Item_func_sp :public Item_func, + public Item_sp { private: - Name_resolution_context *context; - sp_name *m_name; - mutable sp_head *m_sp; - TABLE *dummy_table; - uchar result_buf[64]; - /* - The result field of the concrete stored function. - */ - Field *sp_result_field; bool execute(); - bool execute_impl(THD *thd); - bool init_result_field(THD *thd, sp_head *sp); protected: bool is_expensive_processor(void *arg) @@ -2846,7 +2832,6 @@ public: virtual bool change_context_processor(void *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } - bool sp_check_access(THD * thd); virtual enum Functype functype() const { return FUNC_SP; } bool fix_fields(THD *thd, Item **ref); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a060ed221bf..aee44a7a01f 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -165,6 +165,9 @@ String *Item_func_geometry_from_json::val_str(String *str) case Geometry::GEOJ_TOO_FEW_POINTS: code= ER_GEOJSON_TOO_FEW_POINTS; break; + case Geometry::GEOJ_EMPTY_COORDINATES: + code= ER_GEOJSON_EMPTY_COORDINATES; + break; case Geometry::GEOJ_POLYGON_NOT_CLOSED: code= ER_GEOJSON_NOT_CLOSED; break; diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 54ffa5a2e63..7afb94ba332 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -69,6 +69,7 @@ static inline bool append_simple(String *s, const uchar *a, size_t a_len) /* Appends JSON string to the String object taking charsets in consideration. +*/ static int st_append_json(String *s, CHARSET_INFO *json_cs, const uchar *js, uint js_len) { @@ -82,9 +83,8 @@ static int st_append_json(String *s, return 0; } - return js_len; + return str_len; } -*/ /* @@ -475,6 +475,9 @@ String *Item_func_json_value::val_str(String *str) json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), (const uchar *) js->ptr() + js->length()); + str->length(0); + str->set_charset(&my_charset_utf8mb4_bin); + path.cur_step= path.p.steps; continue_search: if (json_find_path(&je, &path.p, &path.cur_step, array_counters)) @@ -515,8 +518,7 @@ bool Item_func_json_value::check_and_get_value(json_engine_t *je, String *res, return true; } - res->set((const char *) je->value, je->value_len, je->s.cs); - return false; + return st_append_json(res, je->s.cs, je->value, je->value_len); } diff --git a/sql/item_row.cc b/sql/item_row.cc index eae88cd2e6e..64794093bec 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -64,7 +64,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref) with_sum_func= with_sum_func || item->with_sum_func; with_window_func = with_window_func || item->with_window_func; with_field= with_field || item->with_field; - with_subselect|= item->with_subselect; + m_with_subquery|= item->with_subquery(); } fixed= 1; return FALSE; diff --git a/sql/item_row.h b/sql/item_row.h index a66ae7fb5dc..064c1f267b4 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -35,7 +35,8 @@ */ class Item_row: public Item, private Item_args, - private Used_tables_and_const_cache + private Used_tables_and_const_cache, + private With_subquery_cache { table_map not_null_tables_cache; /** @@ -52,6 +53,7 @@ public: not_null_tables_cache(0), with_null(0) { } + bool with_subquery() const { DBUG_ASSERT(fixed); return m_with_subquery; } enum Type type() const { return ROW_ITEM; }; const Type_handler *type_handler() const { return &type_handler_row; } void illegal_method_call(const char *); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 3a7d8582913..e47fa17896d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -64,7 +64,6 @@ Item_subselect::Item_subselect(THD *thd_arg): #ifndef DBUG_OFF exec_counter= 0; #endif - with_subselect= 1; reset(); /* Item value is NULL if select_result_interceptor didn't change this value diff --git a/sql/item_subselect.h b/sql/item_subselect.h index e48b45fb11e..55c9d759ddf 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -182,6 +182,7 @@ public: return null_value; } bool fix_fields(THD *thd, Item **ref); + bool with_subquery() const { DBUG_ASSERT(fixed); return true; } bool mark_as_dependent(THD *thd, st_select_lex *select, Item *item); void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); void recalc_used_tables(st_select_lex *new_parent, bool after_pullout); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 269190ef3df..d4abdfc614f 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -30,6 +30,10 @@ #include "sql_priv.h" #include "sql_select.h" #include "uniques.h" +#include "sp_rcontext.h" +#include "sp.h" +#include "sql_parse.h" +#include "sp_head.h" /** Calculate the affordable RAM limit for structures like TREE or Unique @@ -1126,7 +1130,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref) if (args[i]->fix_fields(thd, args + i) || args[i]->check_cols(1)) return TRUE; set_if_bigger(decimals, args[i]->decimals); - with_subselect|= args[i]->with_subselect; + m_with_subquery|= args[i]->with_subquery(); with_window_func|= args[i]->with_window_func; } result_field=0; @@ -1146,18 +1150,20 @@ Item_sum_num::fix_fields(THD *thd, Item **ref) bool Item_sum_hybrid::fix_fields(THD *thd, Item **ref) { + DBUG_ENTER("Item_sum_hybrid::fix_fields"); DBUG_ASSERT(fixed == 0); Item *item= args[0]; if (init_sum_func_check(thd)) - return TRUE; + DBUG_RETURN(TRUE); // 'item' can be changed during fix_fields if ((!item->fixed && item->fix_fields(thd, args)) || (item= args[0])->check_cols(1)) - return TRUE; - with_subselect= args[0]->with_subselect; + DBUG_RETURN(TRUE); + + m_with_subquery= args[0]->with_subquery(); with_window_func|= args[0]->with_window_func; fix_length_and_dec(); @@ -1166,11 +1172,11 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) result_field=0; if (check_sum_func(thd, ref)) - return TRUE; + DBUG_RETURN(TRUE); orig_args[0]= args[0]; fixed= 1; - return FALSE; + DBUG_RETURN(FALSE); } @@ -1201,15 +1207,16 @@ void Item_sum_hybrid::fix_length_and_dec() void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg) { + DBUG_ENTER("Item_sum_hybrid::setup_hybrid"); if (!(value= item->get_cache(thd))) - return; + DBUG_VOID_RETURN; value->setup(thd, item); value->store(value_arg); /* Don't cache value, as it will change */ if (!item->const_item()) value->set_used_tables(RAND_TABLE_BIT); if (!(arg_cache= item->get_cache(thd))) - return; + DBUG_VOID_RETURN; arg_cache->setup(thd, item); /* Don't cache value, as it will change */ if (!item->const_item()) @@ -1217,22 +1224,177 @@ void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg) cmp= new Arg_comparator(); if (cmp) cmp->set_cmp_func(this, (Item**)&arg_cache, (Item**)&value, FALSE); + DBUG_VOID_RETURN; } Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table) { + DBUG_ENTER("Item_sum_hybrid::create_tmp_field"); + if (args[0]->type() == Item::FIELD_ITEM) { Field *field= ((Item_field*) args[0])->field; if ((field= create_tmp_field_from_field(table->in_use, field, &name, table, NULL))) field->flags&= ~NOT_NULL_FLAG; - return field; + DBUG_RETURN(field); } - return tmp_table_field_from_field_type(table); + DBUG_RETURN(tmp_table_field_from_field_type(table)); } +/*********************************************************************** +** Item_sum_sp class +***********************************************************************/ + +Item_sum_sp::Item_sum_sp(THD *thd, Name_resolution_context *context_arg, + sp_name *name_arg, sp_head *sp, List &list) + :Item_sum(thd, list), Item_sp(thd, context_arg, name_arg) +{ + maybe_null= 1; + quick_group= 0; + m_sp= sp; +} + +Item_sum_sp::Item_sum_sp(THD *thd, Name_resolution_context *context_arg, + sp_name *name_arg, sp_head *sp) + :Item_sum(thd), Item_sp(thd, context_arg, name_arg) +{ + maybe_null= 1; + quick_group= 0; + m_sp= sp; +} + + +bool +Item_sum_sp::fix_fields(THD *thd, Item **ref) +{ + DBUG_ASSERT(fixed == 0); + if (init_sum_func_check(thd)) + return TRUE; + decimals= 0; + + m_sp= m_sp ? m_sp : sp_handler_function.sp_find_routine(thd, m_name, true); + + if (!m_sp) + { + my_missing_function_error(m_name->m_name, ErrConvDQName(m_name).ptr()); + context->process_error(thd); + return TRUE; + } + + if (init_result_field(thd, max_length, maybe_null, &null_value, &name)) + return TRUE; + + for (uint i= 0 ; i < arg_count ; i++) + { + if (args[i]->fix_fields(thd, args + i) || args[i]->check_cols(1)) + return TRUE; + set_if_bigger(decimals, args[i]->decimals); + m_with_subquery|= args[i]->with_subquery(); + with_window_func|= args[i]->with_window_func; + } + result_field= NULL; + max_length= float_length(decimals); + null_value= 1; + fix_length_and_dec(); + + if (check_sum_func(thd, ref)) + return TRUE; + + memcpy(orig_args, args, sizeof(Item *) * arg_count); + fixed= 1; + return FALSE; +} + +/** + Execute function to store value in result field. + This is called when we need the value to be returned for the function. + Here we send a signal in form of the server status that all rows have been + fetched and now we have to exit from the function with the return value. + @return Function returns error status. + @retval FALSE on success. + @retval TRUE if an error occurred. +*/ + +bool +Item_sum_sp::execute() +{ + THD *thd= current_thd; + bool res; + uint old_server_status= thd->server_status; + + /* We set server status so we can send a signal to exit from the + function with the return value. */ + + thd->server_status= SERVER_STATUS_LAST_ROW_SENT; + res= Item_sp::execute(thd, &null_value, args, arg_count); + thd->server_status= old_server_status; + return res; +} + +/** + Handles the aggregation of the values. + @note: See class description for more details on how and why this is done. + @return The error state. + @retval FALSE on success. + @retval TRUE if an error occurred. +*/ + +bool +Item_sum_sp::add() +{ + return execute_impl(current_thd, args, arg_count); +} + + +void +Item_sum_sp::clear() +{ + delete func_ctx; + func_ctx= NULL; + sp_query_arena->free_items(); + free_root(&sp_mem_root, MYF(0)); +} + +const Type_handler *Item_sum_sp::type_handler() const +{ + DBUG_ENTER("Item_sum_sp::type_handler"); + DBUG_PRINT("info", ("m_sp = %p", (void *) m_sp)); + DBUG_ASSERT(sp_result_field); + // This converts ENUM/SET to STRING + const Type_handler *handler= sp_result_field->type_handler(); + DBUG_RETURN(handler->type_handler_for_item_field()); +} + +void +Item_sum_sp::cleanup() +{ + Item_sp::cleanup(); + Item_sum::cleanup(); +} + +/** + Initialize local members with values from the Field interface. + @note called from Item::fix_fields. +*/ + +void +Item_sum_sp::fix_length_and_dec() +{ + DBUG_ENTER("Item_sum_sp::fix_length_and_dec"); + DBUG_ASSERT(sp_result_field); + Type_std_attributes::set(sp_result_field); + Item_sum::fix_length_and_dec(); + DBUG_VOID_RETURN; +} + +const char * +Item_sum_sp::func_name() const +{ + THD *thd= current_thd; + return Item_sp::func_name(thd); +} /*********************************************************************** ** reset and add of sum_func @@ -1245,6 +1407,7 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table) Item_sum_sum::Item_sum_sum(THD *thd, Item_sum_sum *item) :Item_sum_num(thd, item), Type_handler_hybrid_field_type(item), + direct_added(FALSE), direct_reseted_field(FALSE), curr_dec_buff(item->curr_dec_buff), count(item->count) { @@ -1264,6 +1427,15 @@ Item *Item_sum_sum::copy_or_same(THD* thd) } +void Item_sum_sum::cleanup() +{ + DBUG_ENTER("Item_sum_sum::cleanup"); + direct_added= direct_reseted_field= FALSE; + Item_sum_num::cleanup(); + DBUG_VOID_RETURN; +} + + void Item_sum_sum::clear() { DBUG_ENTER("Item_sum_sum::clear"); @@ -1313,6 +1485,38 @@ void Item_sum_sum::fix_length_and_dec() } +void Item_sum_sum::direct_add(my_decimal *add_sum_decimal) +{ + DBUG_ENTER("Item_sum_sum::direct_add"); + DBUG_PRINT("info", ("add_sum_decimal: %p", add_sum_decimal)); + direct_added= TRUE; + direct_reseted_field= FALSE; + if (add_sum_decimal) + { + direct_sum_is_null= FALSE; + direct_sum_decimal= *add_sum_decimal; + } + else + { + direct_sum_is_null= TRUE; + direct_sum_decimal= decimal_zero; + } + DBUG_VOID_RETURN; +} + + +void Item_sum_sum::direct_add(double add_sum_real, bool add_sum_is_null) +{ + DBUG_ENTER("Item_sum_sum::direct_add"); + DBUG_PRINT("info", ("add_sum_real: %f", add_sum_real)); + direct_added= TRUE; + direct_reseted_field= FALSE; + direct_sum_is_null= add_sum_is_null; + direct_sum_real= add_sum_real; + DBUG_VOID_RETURN; +} + + bool Item_sum_sum::add() { DBUG_ENTER("Item_sum_sum::add"); @@ -1326,50 +1530,84 @@ void Item_sum_sum::add_helper(bool perform_removal) if (result_type() == DECIMAL_RESULT) { - my_decimal value; - const my_decimal *val= aggr->arg_val_decimal(&value); - if (!aggr->arg_is_null(true)) + if (unlikely(direct_added)) { - if (perform_removal) + /* Add value stored by Item_sum_sum::direct_add */ + DBUG_ASSERT(!perform_removal); + + direct_added= FALSE; + if (likely(!direct_sum_is_null)) { - if (count > 0) + my_decimal_add(E_DEC_FATAL_ERROR, dec_buffs + (curr_dec_buff^1), + &direct_sum_decimal, dec_buffs + curr_dec_buff); + curr_dec_buff^= 1; + null_value= 0; + } + } + else + { + direct_reseted_field= FALSE; + my_decimal value; + const my_decimal *val= aggr->arg_val_decimal(&value); + if (!aggr->arg_is_null(true)) + { + if (perform_removal) { - my_decimal_sub(E_DEC_FATAL_ERROR, dec_buffs + (curr_dec_buff ^ 1), - dec_buffs + curr_dec_buff, val); - count--; + if (count > 0) + { + my_decimal_sub(E_DEC_FATAL_ERROR, dec_buffs + (curr_dec_buff ^ 1), + dec_buffs + curr_dec_buff, val); + count--; + } + else + DBUG_VOID_RETURN; } else - DBUG_VOID_RETURN; + { + count++; + my_decimal_add(E_DEC_FATAL_ERROR, dec_buffs + (curr_dec_buff ^ 1), + val, dec_buffs + curr_dec_buff); + } + curr_dec_buff^= 1; + null_value= (count > 0) ? 0 : 1; } - else - { - count++; - my_decimal_add(E_DEC_FATAL_ERROR, dec_buffs + (curr_dec_buff ^ 1), - val, dec_buffs + curr_dec_buff); - } - curr_dec_buff^= 1; - null_value= (count > 0) ? 0 : 1; } } else { - if (perform_removal && count > 0) - sum-= aggr->arg_val_real(); - else - sum+= aggr->arg_val_real(); - if (!aggr->arg_is_null(true)) + if (unlikely(direct_added)) { - if (perform_removal) - { - if (count > 0) - { - count--; - } - } - else - count++; + /* Add value stored by Item_sum_sum::direct_add */ + DBUG_ASSERT(!perform_removal); - null_value= (count > 0) ? 0 : 1; + direct_added= FALSE; + if (!direct_sum_is_null) + { + sum+= direct_sum_real; + null_value= 0; + } + } + else + { + direct_reseted_field= FALSE; + if (perform_removal && count > 0) + sum-= aggr->arg_val_real(); + else + sum+= aggr->arg_val_real(); + if (!aggr->arg_is_null(true)) + { + if (perform_removal) + { + if (count > 0) + { + count--; + } + } + else + count++; + + null_value= (count > 0) ? 0 : 1; + } } } DBUG_VOID_RETURN; @@ -1556,22 +1794,46 @@ bool Aggregator_distinct::arg_is_null(bool use_null_value) Item *Item_sum_count::copy_or_same(THD* thd) { - return new (thd->mem_root) Item_sum_count(thd, this); + DBUG_ENTER("Item_sum_count::copy_or_same"); + DBUG_RETURN(new (thd->mem_root) Item_sum_count(thd, this)); +} + + +void Item_sum_count::direct_add(longlong add_count) +{ + DBUG_ENTER("Item_sum_count::direct_add"); + DBUG_PRINT("info", ("add_count: %lld", add_count)); + direct_counted= TRUE; + direct_reseted_field= FALSE; + direct_count= add_count; + DBUG_VOID_RETURN; } void Item_sum_count::clear() { + DBUG_ENTER("Item_sum_count::clear"); count= 0; + DBUG_VOID_RETURN; } bool Item_sum_count::add() { - if (aggr->arg_is_null(false)) - return 0; - count++; - return 0; + DBUG_ENTER("Item_sum_count::add"); + if (direct_counted) + { + direct_counted= FALSE; + count+= direct_count; + } + else + { + direct_reseted_field= FALSE; + if (aggr->arg_is_null(false)) + DBUG_RETURN(0); + count++; + } + DBUG_RETURN(0); } @@ -1590,10 +1852,11 @@ void Item_sum_count::remove() longlong Item_sum_count::val_int() { + DBUG_ENTER("Item_sum_count::val_int"); DBUG_ASSERT(fixed == 1); if (aggr) aggr->endup(); - return (longlong) count; + DBUG_RETURN((longlong)count); } @@ -1601,6 +1864,8 @@ void Item_sum_count::cleanup() { DBUG_ENTER("Item_sum_count::cleanup"); count= 0; + direct_counted= FALSE; + direct_reseted_field= FALSE; Item_sum_int::cleanup(); DBUG_VOID_RETURN; } @@ -2015,10 +2280,13 @@ Item *Item_sum_variance::result_item(THD *thd, Field *field) void Item_sum_hybrid::clear() { + DBUG_ENTER("Item_sum_hybrid::clear"); value->clear(); null_value= 1; + DBUG_VOID_RETURN; } + bool Item_sum_hybrid::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { @@ -2031,51 +2299,66 @@ Item_sum_hybrid::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) return retval; } + +void Item_sum_hybrid::direct_add(Item *item) +{ + DBUG_ENTER("Item_sum_hybrid::direct_add"); + DBUG_PRINT("info", ("item: %p", item)); + direct_added= TRUE; + direct_item= item; + DBUG_VOID_RETURN; +} + + double Item_sum_hybrid::val_real() { + DBUG_ENTER("Item_sum_hybrid::val_real"); DBUG_ASSERT(fixed == 1); if (null_value) - return 0.0; + DBUG_RETURN(0.0); double retval= value->val_real(); if ((null_value= value->null_value)) DBUG_ASSERT(retval == 0.0); - return retval; + DBUG_RETURN(retval); } longlong Item_sum_hybrid::val_int() { + DBUG_ENTER("Item_sum_hybrid::val_int"); DBUG_ASSERT(fixed == 1); if (null_value) - return 0; + DBUG_RETURN(0); longlong retval= value->val_int(); if ((null_value= value->null_value)) DBUG_ASSERT(retval == 0); - return retval; + DBUG_RETURN(retval); } my_decimal *Item_sum_hybrid::val_decimal(my_decimal *val) { + DBUG_ENTER("Item_sum_hybrid::val_decimal"); DBUG_ASSERT(fixed == 1); if (null_value) - return 0; + DBUG_RETURN(0); my_decimal *retval= value->val_decimal(val); if ((null_value= value->null_value)) DBUG_ASSERT(retval == NULL); - return retval; + DBUG_RETURN(retval); } String * Item_sum_hybrid::val_str(String *str) { + DBUG_ENTER("Item_sum_hybrid::val_str"); DBUG_ASSERT(fixed == 1); if (null_value) - return 0; + DBUG_RETURN(0); String *retval= value->val_str(str); if ((null_value= value->null_value)) DBUG_ASSERT(retval == NULL); - return retval; + DBUG_RETURN(retval); } @@ -2099,6 +2382,7 @@ void Item_sum_hybrid::cleanup() void Item_sum_hybrid::no_rows_in_result() { + DBUG_ENTER("Item_sum_hybrid::no_rows_in_result"); /* We may be called here twice in case of ref field in function */ if (was_values) { @@ -2106,6 +2390,7 @@ void Item_sum_hybrid::no_rows_in_result() was_null_value= value->null_value; clear(); } + DBUG_VOID_RETURN; } void Item_sum_hybrid::restore_to_before_no_rows_in_result() @@ -2120,14 +2405,26 @@ void Item_sum_hybrid::restore_to_before_no_rows_in_result() Item *Item_sum_min::copy_or_same(THD* thd) { + DBUG_ENTER("Item_sum_min::copy_or_same"); Item_sum_min *item= new (thd->mem_root) Item_sum_min(thd, this); item->setup_hybrid(thd, args[0], value); - return item; + DBUG_RETURN(item); } bool Item_sum_min::add() { + Item *tmp_item; + DBUG_ENTER("Item_sum_min::add"); + DBUG_PRINT("enter", ("this: %p", this)); + + if (unlikely(direct_added)) + { + /* Change to use direct_item */ + tmp_item= arg_cache->get_item(); + arg_cache->store(direct_item); + } + DBUG_PRINT("info", ("null_value: %s", null_value ? "TRUE" : "FALSE")); /* args[0] < value */ arg_cache->cache_value(); if (!arg_cache->null_value && @@ -2137,7 +2434,13 @@ bool Item_sum_min::add() value->cache_value(); null_value= 0; } - return 0; + if (unlikely(direct_added)) + { + /* Restore original item */ + direct_added= FALSE; + arg_cache->store(tmp_item); + } + DBUG_RETURN(0); } @@ -2151,8 +2454,19 @@ Item *Item_sum_max::copy_or_same(THD* thd) bool Item_sum_max::add() { + Item *tmp_item; + DBUG_ENTER("Item_sum_max::add"); + DBUG_PRINT("enter", ("this: %p", this)); + + if (unlikely(direct_added)) + { + /* Change to use direct_item */ + tmp_item= arg_cache->get_item(); + arg_cache->store(direct_item); + } /* args[0] > value */ arg_cache->cache_value(); + DBUG_PRINT("info", ("null_value: %s", null_value ? "TRUE" : "FALSE")); if (!arg_cache->null_value && (null_value || cmp->compare() > 0)) { @@ -2160,7 +2474,13 @@ bool Item_sum_max::add() value->cache_value(); null_value= 0; } - return 0; + if (unlikely(direct_added)) + { + /* Restore original item */ + direct_added= FALSE; + arg_cache->store(tmp_item); + } + DBUG_RETURN(0); } @@ -2339,14 +2659,26 @@ void Item_sum_num::reset_field() void Item_sum_hybrid::reset_field() { + Item *tmp_item, *arg0; + DBUG_ENTER("Item_sum_hybrid::reset_field"); + + arg0= args[0]; + if (unlikely(direct_added)) + { + /* Switch to use direct item */ + tmp_item= value->get_item(); + value->store(direct_item); + arg0= direct_item; + } + switch(result_type()) { case STRING_RESULT: { char buff[MAX_FIELD_WIDTH]; String tmp(buff,sizeof(buff),result_field->charset()),*res; - res=args[0]->val_str(&tmp); - if (args[0]->null_value) + res= arg0->val_str(&tmp); + if (arg0->null_value) { result_field->set_null(); result_field->reset(); @@ -2360,11 +2692,11 @@ void Item_sum_hybrid::reset_field() } case INT_RESULT: { - longlong nr=args[0]->val_int(); + longlong nr= arg0->val_int(); if (maybe_null) { - if (args[0]->null_value) + if (arg0->null_value) { nr=0; result_field->set_null(); @@ -2372,16 +2704,17 @@ void Item_sum_hybrid::reset_field() else result_field->set_notnull(); } + DBUG_PRINT("info", ("nr: %lld", nr)); result_field->store(nr, unsigned_flag); break; } case REAL_RESULT: { - double nr= args[0]->val_real(); + double nr= arg0->val_real(); if (maybe_null) { - if (args[0]->null_value) + if (arg0->null_value) { nr=0.0; result_field->set_null(); @@ -2394,11 +2727,11 @@ void Item_sum_hybrid::reset_field() } case DECIMAL_RESULT: { - my_decimal value_buff, *arg_dec= args[0]->val_decimal(&value_buff); + my_decimal value_buff, *arg_dec= arg0->val_decimal(&value_buff); if (maybe_null) { - if (args[0]->null_value) + if (arg0->null_value) result_field->set_null(); else result_field->set_notnull(); @@ -2416,26 +2749,49 @@ void Item_sum_hybrid::reset_field() case TIME_RESULT: DBUG_ASSERT(0); } + + if (unlikely(direct_added)) + { + direct_added= FALSE; + value->store(tmp_item); + } + DBUG_VOID_RETURN; } void Item_sum_sum::reset_field() { + my_bool null_flag; DBUG_ASSERT (aggr->Aggrtype() != Aggregator::DISTINCT_AGGREGATOR); if (result_type() == DECIMAL_RESULT) { - my_decimal value, *arg_val= args[0]->val_decimal(&value); - if (!arg_val) // Null - arg_val= &decimal_zero; + my_decimal value, *arg_val; + if (unlikely(direct_added)) + arg_val= &direct_sum_decimal; + else + { + if (!(arg_val= args[0]->val_decimal(&value))) + arg_val= &decimal_zero; // Null + } result_field->store_decimal(arg_val); } else { DBUG_ASSERT(result_type() == REAL_RESULT); - double nr= args[0]->val_real(); // Nulls also return 0 + double nr= likely(!direct_added) ? args[0]->val_real() : direct_sum_real; float8store(result_field->ptr, nr); } - if (args[0]->null_value) + + if (unlikely(direct_added)) + { + direct_added= FALSE; + direct_reseted_field= TRUE; + null_flag= direct_sum_is_null; + } + else + null_flag= args[0]->null_value; + + if (null_flag) result_field->set_null(); else result_field->set_notnull(); @@ -2444,13 +2800,22 @@ void Item_sum_sum::reset_field() void Item_sum_count::reset_field() { + DBUG_ENTER("Item_sum_count::reset_field"); uchar *res=result_field->ptr; longlong nr=0; DBUG_ASSERT (aggr->Aggrtype() != Aggregator::DISTINCT_AGGREGATOR); - if (!args[0]->maybe_null || !args[0]->is_null()) - nr=1; + if (unlikely(direct_counted)) + { + nr= direct_count; + direct_counted= FALSE; + direct_reseted_field= TRUE; + } + else if (!args[0]->maybe_null || !args[0]->is_null()) + nr= 1; + DBUG_PRINT("info", ("nr: %lld", nr)); int8store(res,nr); + DBUG_VOID_RETURN; } @@ -2518,13 +2883,26 @@ void Item_sum_sum::update_field() DBUG_ASSERT (aggr->Aggrtype() != Aggregator::DISTINCT_AGGREGATOR); if (result_type() == DECIMAL_RESULT) { - my_decimal value, *arg_val= args[0]->val_decimal(&value); - if (!args[0]->null_value) + my_decimal value, *arg_val; + my_bool null_flag; + if (unlikely(direct_added || direct_reseted_field)) + { + direct_added= direct_reseted_field= FALSE; + arg_val= &direct_sum_decimal; + null_flag= direct_sum_is_null; + } + else + { + arg_val= args[0]->val_decimal(&value); + null_flag= args[0]->null_value; + } + + if (!null_flag) { if (!result_field->is_null()) { - my_decimal field_value, - *field_val= result_field->val_decimal(&field_value); + my_decimal field_value; + my_decimal *field_val= result_field->val_decimal(&field_value); my_decimal_add(E_DEC_FATAL_ERROR, dec_buffs, arg_val, field_val); result_field->store_decimal(dec_buffs); } @@ -2538,11 +2916,22 @@ void Item_sum_sum::update_field() else { double old_nr,nr; - uchar *res=result_field->ptr; + uchar *res= result_field->ptr; + my_bool null_flag; float8get(old_nr,res); - nr= args[0]->val_real(); - if (!args[0]->null_value) + if (unlikely(direct_added || direct_reseted_field)) + { + direct_added= direct_reseted_field= FALSE; + null_flag= direct_sum_is_null; + nr= direct_sum_real; + } + else + { + nr= args[0]->val_real(); + null_flag= args[0]->null_value; + } + if (!null_flag) { old_nr+=nr; result_field->set_notnull(); @@ -2554,13 +2943,21 @@ void Item_sum_sum::update_field() void Item_sum_count::update_field() { + DBUG_ENTER("Item_sum_count::update_field"); longlong nr; uchar *res=result_field->ptr; nr=sint8korr(res); - if (!args[0]->maybe_null || !args[0]->is_null()) + if (unlikely(direct_counted || direct_reseted_field)) + { + direct_counted= direct_reseted_field= FALSE; + nr+= direct_count; + } + else if (!args[0]->maybe_null || !args[0]->is_null()) nr++; + DBUG_PRINT("info", ("nr: %lld", nr)); int8store(res,nr); + DBUG_VOID_RETURN; } @@ -2618,6 +3015,13 @@ Item *Item_sum_avg::result_item(THD *thd, Field *field) void Item_sum_hybrid::update_field() { + DBUG_ENTER("Item_sum_hybrid::update_field"); + Item *tmp_item; + if (unlikely(direct_added)) + { + tmp_item= args[0]; + args[0]= direct_item; + } switch (result_type()) { case STRING_RESULT: min_max_update_str_field(); @@ -2631,12 +3035,19 @@ void Item_sum_hybrid::update_field() default: min_max_update_real_field(); } + if (unlikely(direct_added)) + { + direct_added= FALSE; + args[0]= tmp_item; + } + DBUG_VOID_RETURN; } void Item_sum_hybrid::min_max_update_str_field() { + DBUG_ENTER("Item_sum_hybrid::min_max_update_str_field"); DBUG_ASSERT(cmp); String *res_str=args[0]->val_str(&cmp->value1); @@ -2649,6 +3060,7 @@ Item_sum_hybrid::min_max_update_str_field() result_field->store(res_str->ptr(),res_str->length(),res_str->charset()); result_field->set_notnull(); } + DBUG_VOID_RETURN; } @@ -2657,6 +3069,7 @@ Item_sum_hybrid::min_max_update_real_field() { double nr,old_nr; + DBUG_ENTER("Item_sum_hybrid::min_max_update_real_field"); old_nr=result_field->val_real(); nr= args[0]->val_real(); if (!args[0]->null_value) @@ -2669,6 +3082,7 @@ Item_sum_hybrid::min_max_update_real_field() else if (result_field->is_null(0)) result_field->set_null(); result_field->store(old_nr); + DBUG_VOID_RETURN; } @@ -2677,6 +3091,7 @@ Item_sum_hybrid::min_max_update_int_field() { longlong nr,old_nr; + DBUG_ENTER("Item_sum_hybrid::min_max_update_int_field"); old_nr=result_field->val_int(); nr=args[0]->val_int(); if (!args[0]->null_value) @@ -2696,7 +3111,9 @@ Item_sum_hybrid::min_max_update_int_field() } else if (result_field->is_null(0)) result_field->set_null(); + DBUG_PRINT("info", ("nr: %lld", old_nr)); result_field->store(old_nr, unsigned_flag); + DBUG_VOID_RETURN; } @@ -2707,6 +3124,7 @@ Item_sum_hybrid::min_max_update_int_field() void Item_sum_hybrid::min_max_update_decimal_field() { + DBUG_ENTER("Item_sum_hybrid::min_max_update_decimal_field"); my_decimal old_val, nr_val; const my_decimal *old_nr; const my_decimal *nr= args[0]->val_decimal(&nr_val); @@ -2727,6 +3145,7 @@ Item_sum_hybrid::min_max_update_decimal_field() } else if (result_field->is_null(0)) result_field->set_null(); + DBUG_VOID_RETURN; } @@ -2850,7 +3269,7 @@ double Item_sum_udf_float::val_real() double res; DBUG_ASSERT(fixed == 1); DBUG_ENTER("Item_sum_udf_float::val"); - DBUG_PRINT("info",("result_type: %d arg_count: %d", + DBUG_PRINT("enter",("result_type: %d arg_count: %d", args[0]->result_type(), arg_count)); res= udf.val(&tmp_null_value); null_value= tmp_null_value; @@ -2894,7 +3313,7 @@ my_decimal *Item_sum_udf_decimal::val_decimal(my_decimal *dec_buf) my_bool tmp_null_value; DBUG_ASSERT(fixed == 1); DBUG_ENTER("Item_func_udf_decimal::val_decimal"); - DBUG_PRINT("info",("result_type: %d arg_count: %d", + DBUG_PRINT("enter",("result_type: %d arg_count: %d", args[0]->result_type(), arg_count)); res= udf.val_decimal(&tmp_null_value, dec_buf); @@ -2920,7 +3339,7 @@ longlong Item_sum_udf_int::val_int() longlong res; DBUG_ASSERT(fixed == 1); DBUG_ENTER("Item_sum_udf_int::val_int"); - DBUG_PRINT("info",("result_type: %d arg_count: %d", + DBUG_PRINT("enter",("result_type: %d arg_count: %d", args[0]->result_type(), arg_count)); res= udf.val_int(&tmp_null_value); null_value= tmp_null_value; @@ -3114,6 +3533,11 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), Item **arg= item->args, **arg_end= item->args + item->arg_count_field; uint old_length= result->length(); + ulonglong *offset_limit= &item->copy_offset_limit; + ulonglong *row_limit = &item->copy_row_limit; + if (item->limit_clause && !(*row_limit)) + return 1; + if (item->no_appended) item->no_appended= FALSE; else @@ -3121,6 +3545,14 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), tmp.length(0); + if (item->limit_clause && (*offset_limit)) + { + item->row_count++; + item->no_appended= TRUE; + (*offset_limit)--; + return 0; + } + for (; arg < arg_end; arg++) { String *res; @@ -3150,6 +3582,8 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), result->append(*res); } + if (item->limit_clause) + (*row_limit)--; item->row_count++; /* stop if length of result more than max_length */ @@ -3198,7 +3632,8 @@ Item_func_group_concat:: Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, bool distinct_arg, List *select_list, const SQL_I_List &order_list, - String *separator_arg) + String *separator_arg, bool limit_clause, + Item *row_limit_arg, Item *offset_limit_arg) :Item_sum(thd), tmp_table_param(0), separator(separator_arg), tree(0), unique_filter(NULL), table(0), order(0), context(context_arg), @@ -3207,7 +3642,9 @@ Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, row_count(0), distinct(distinct_arg), warning_for_row(FALSE), - force_copy_fields(0), original(0) + force_copy_fields(0), row_limit(NULL), + offset_limit(NULL), limit_clause(limit_clause), + copy_offset_limit(0), copy_row_limit(0), original(0) { Item *item_select; Item **arg_ptr; @@ -3249,6 +3686,11 @@ Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, /* orig_args is only used for print() */ orig_args= (Item**) (order + arg_count_order); memcpy(orig_args, args, sizeof(Item*) * arg_count); + if (limit_clause) + { + row_limit= row_limit_arg; + offset_limit= offset_limit_arg; + } } @@ -3268,7 +3710,9 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, warning_for_row(item->warning_for_row), always_null(item->always_null), force_copy_fields(item->force_copy_fields), - original(item) + row_limit(item->row_limit), offset_limit(item->offset_limit), + limit_clause(item->limit_clause),copy_offset_limit(item->copy_offset_limit), + copy_row_limit(item->copy_row_limit), original(item) { quick_group= item->quick_group; result.set_charset(collation.collation); @@ -3363,6 +3807,10 @@ void Item_func_group_concat::clear() null_value= TRUE; warning_for_row= FALSE; no_appended= TRUE; + if (offset_limit) + copy_offset_limit= offset_limit->val_int(); + if (row_limit) + copy_row_limit= row_limit->val_int(); if (tree) reset_tree(tree); if (unique_filter) @@ -3447,7 +3895,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) args[i]->fix_fields(thd, args + i)) || args[i]->check_cols(1)) return TRUE; - with_subselect|= args[i]->with_subselect; + m_with_subquery|= args[i]->with_subquery(); with_window_func|= args[i]->with_window_func; } @@ -3617,6 +4065,12 @@ bool Item_func_group_concat::setup(THD *thd) (void*)this, tree_key_length, ram_limitation(thd)); + if ((row_limit && row_limit->cmp_type() != INT_RESULT) || + (offset_limit && offset_limit->cmp_type() != INT_RESULT)) + { + my_error(ER_INVALID_VALUE_TO_LIMIT, MYF(0)); + DBUG_RETURN(TRUE); + } DBUG_RETURN(FALSE); } diff --git a/sql/item_sum.h b/sql/item_sum.h index 9822f9e5430..cbf245f3cd3 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -355,7 +355,7 @@ public: ROW_NUMBER_FUNC, RANK_FUNC, DENSE_RANK_FUNC, PERCENT_RANK_FUNC, CUME_DIST_FUNC, NTILE_FUNC, FIRST_VALUE_FUNC, LAST_VALUE_FUNC, NTH_VALUE_FUNC, LEAD_FUNC, LAG_FUNC, PERCENTILE_CONT_FUNC, - PERCENTILE_DISC_FUNC + PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC }; Item **ref_by; /* pointer to a ref to the object used to register it */ @@ -521,6 +521,7 @@ public: Item *get_arg(uint i) const { return args[i]; } Item *set_arg(uint i, THD *thd, Item *new_val); uint get_arg_count() const { return arg_count; } + virtual Item **get_args() { return fixed ? orig_args : args; } /* Initialization of distinct related members */ void init_aggregator() @@ -757,14 +758,20 @@ class Item_sum_sum :public Item_sum_num, public Type_handler_hybrid_field_type { protected: + bool direct_added; + bool direct_reseted_field; + bool direct_sum_is_null; + double direct_sum_real; double sum; + my_decimal direct_sum_decimal; my_decimal dec_buffs[2]; uint curr_dec_buff; void fix_length_and_dec(); public: Item_sum_sum(THD *thd, Item *item_par, bool distinct): - Item_sum_num(thd, item_par) + Item_sum_num(thd, item_par), direct_added(FALSE), + direct_reseted_field(FALSE) { set_distinct(distinct); } @@ -773,6 +780,9 @@ public: { return has_with_distinct() ? SUM_DISTINCT_FUNC : SUM_FUNC; } + void cleanup(); + void direct_add(my_decimal *add_sum_decimal); + void direct_add(double add_sum_real, bool add_sum_is_null); void clear(); bool add(); double val_real(); @@ -808,6 +818,9 @@ private: class Item_sum_count :public Item_sum_int { + bool direct_counted; + bool direct_reseted_field; + longlong direct_count; longlong count; friend class Aggregator_distinct; @@ -817,9 +830,10 @@ class Item_sum_count :public Item_sum_int void cleanup(); void remove(); - public: +public: Item_sum_count(THD *thd, Item *item_par): - Item_sum_int(thd, item_par), count(0) + Item_sum_int(thd, item_par), direct_counted(FALSE), + direct_reseted_field(FALSE), count(0) {} /** @@ -831,12 +845,14 @@ class Item_sum_count :public Item_sum_int */ Item_sum_count(THD *thd, List &list): - Item_sum_int(thd, list), count(0) + Item_sum_int(thd, list), direct_counted(FALSE), + direct_reseted_field(FALSE), count(0) { set_distinct(TRUE); } Item_sum_count(THD *thd, Item_sum_count *item): - Item_sum_int(thd, item), count(item->count) + Item_sum_int(thd, item), direct_counted(FALSE), + direct_reseted_field(FALSE), count(item->count) {} enum Sumfunctype sum_func () const { @@ -851,6 +867,7 @@ class Item_sum_count :public Item_sum_int longlong val_int(); void reset_field(); void update_field(); + void direct_add(longlong add_count); const char *func_name() const { return has_with_distinct() ? "count(distinct " : "count("; @@ -1009,6 +1026,8 @@ class Item_cache; class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type { protected: + bool direct_added; + Item *direct_item; Item_cache *value, *arg_cache; Arg_comparator *cmp; int cmp_sign; @@ -1019,19 +1038,20 @@ protected: Item_sum_hybrid(THD *thd, Item *item_par,int sign): Item_sum(thd, item_par), Type_handler_hybrid_field_type(&type_handler_longlong), - value(0), arg_cache(0), cmp(0), + direct_added(FALSE), value(0), arg_cache(0), cmp(0), cmp_sign(sign), was_values(TRUE) { collation.set(&my_charset_bin); } Item_sum_hybrid(THD *thd, Item_sum_hybrid *item) :Item_sum(thd, item), Type_handler_hybrid_field_type(item), - value(item->value), arg_cache(0), + direct_added(FALSE), value(item->value), arg_cache(0), cmp_sign(item->cmp_sign), was_values(item->was_values) { } bool fix_fields(THD *, Item **); void fix_length_and_dec(); void setup_hybrid(THD *thd, Item *item, Item *value_arg); void clear(); + void direct_add(Item *item); double val_real(); longlong val_int(); my_decimal *val_decimal(my_decimal *); @@ -1204,6 +1224,132 @@ private: void set_bits_from_counters(); }; +class sp_head; +class sp_name; +class Query_arena; +struct st_sp_security_context; + +/* + Item_sum_sp handles STORED AGGREGATE FUNCTIONS + + Each Item_sum_sp represents a custom aggregate function. Inside the + function's body, we require at least one occurence of FETCH GROUP NEXT ROW + instruction. This cursor is what makes custom stored aggregates possible. + + During computation the function's add method is called. This in turn performs + an execution of the function. The function will execute from the current + function context (and instruction), if one exists, or from the start if not. + See Item_sp for more details. + + Upon encounter of FETCH GROUP NEXT ROW instruction, the function will pause + execution. We assume that the user has performed the necessary additions for + a row, between two encounters of FETCH GROUP NEXT ROW. + + Example: + create aggregate function f1(x INT) returns int + begin + declare continue handler for not found return s; + declare s int default 0 + loop + fetch group next row; + set s = s + x; + end loop; + end + + The function will always stop after an encounter of FETCH GROUP NEXT ROW, + except (!) on first encounter, as the value for the first row in the + group is already set in the argument x. This behaviour is done so when + a user writes a function, he should "logically" include FETCH GROUP NEXT ROW + before any "add" instructions in the stored function. This means however that + internally, the first occurence doesn't stop the function. See the + implementation of FETCH GROUP NEXT ROW for details as to how it happens. + + Either way, one should assume that after calling "Item_sum_sp::add()" that + the values for that particular row have been added to the aggregation. + + To produce values for val_xxx methods we need an extra syntactic construct. + We require a continue handler when "no more rows are available". val_xxx + methods force a function return by executing the function again, while + setting a server flag that no more rows have been found. This implies + that val_xxx methods should only be called once per group however. + + Example: + DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val; +*/ +class Item_sum_sp :public Item_sum, + public Item_sp +{ + private: + bool execute(); + +public: + Item_sum_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name, + sp_head *sp); + + Item_sum_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name, + sp_head *sp, List &list); + + enum Sumfunctype sum_func () const + { + return SP_AGGREGATE_FUNC; + } + void fix_length_and_dec(); + bool fix_fields(THD *thd, Item **ref); + const char *func_name() const; + const Type_handler *type_handler() const; + bool add(); + + /* val_xx functions */ + longlong val_int() + { + if(execute()) + return 0; + return sp_result_field->val_int(); + } + + double val_real() + { + if(execute()) + return 0.0; + return sp_result_field->val_real(); + } + + my_decimal *val_decimal(my_decimal *dec_buf) + { + if(execute()) + return NULL; + return sp_result_field->val_decimal(dec_buf); + } + + String *val_str(String *str) + { + String buf; + char buff[20]; + buf.set(buff, 20, str->charset()); + buf.length(0); + if (execute()) + return NULL; + /* + result_field will set buf pointing to internal buffer + of the resul_field. Due to this it will change any time + when SP is executed. In order to prevent occasional + corruption of returned value, we make here a copy. + */ + sp_result_field->val_str(&buf); + str->copy(buf); + return str; + } + void reset_field(){DBUG_ASSERT(0);} + void update_field(){DBUG_ASSERT(0);} + void clear(); + void cleanup(); + inline Field *get_sp_result_field() + { + return sp_result_field; + } + Item *get_copy(THD *thd) + { return get_item_copy(thd, this); } +}; /* Items to get the value of a stored sum function */ @@ -1601,6 +1747,16 @@ class Item_func_group_concat : public Item_sum bool always_null; bool force_copy_fields; bool no_appended; + /** Limits the rows in the result */ + Item *row_limit; + /** Skips a particular number of rows in from the result*/ + Item *offset_limit; + bool limit_clause; + /* copy of the offset limit */ + ulonglong copy_offset_limit; + /*copy of the row limit */ + ulonglong copy_row_limit; + /* Following is 0 normal object and pointer to original one for copy (to correctly free resources) @@ -1617,7 +1773,8 @@ class Item_func_group_concat : public Item_sum public: Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, bool is_distinct, List *is_select, - const SQL_I_List &is_order, String *is_separator); + const SQL_I_List &is_order, String *is_separator, + bool limit_clause, Item *row_limit, Item *offset_limit); Item_func_group_concat(THD *thd, Item_func_group_concat *item); ~Item_func_group_concat(); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 3a7684fe7b4..fd170a707c9 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2434,6 +2434,8 @@ void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen) THD *thd= current_thd; char char_type[40]; ErrConvString err(src); + bool save_abort_on_warning= thd->abort_on_warning; + thd->abort_on_warning&= !m_suppress_warning_to_error_escalation; my_snprintf(char_type, sizeof(char_type), "%s(%lu)", cast_cs == &my_charset_bin ? "BINARY" : "CHAR", (ulong) cast_length); @@ -2441,6 +2443,7 @@ void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen) ER_TRUNCATED_WRONG_VALUE, ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), char_type, err.ptr()); + thd->abort_on_warning= save_abort_on_warning; } } @@ -2551,7 +2554,7 @@ void Item_char_typecast::fix_length_and_dec_numeric() } -void Item_char_typecast::fix_length_and_dec_str() +void Item_char_typecast::fix_length_and_dec_generic() { fix_length_and_dec_internal(from_cs= args[0]->dynamic_result() ? 0 : diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index bf744cc24cd..adc7b2535a9 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -1089,6 +1089,7 @@ class Item_char_typecast :public Item_str_func CHARSET_INFO *cast_cs, *from_cs; bool charset_conversion; String tmp_value; + bool m_suppress_warning_to_error_escalation; bool has_explicit_length() const { return cast_length != ~0U; } String *reuse(String *src, uint32 length); String *copy(String *src, CHARSET_INFO *cs); @@ -1097,14 +1098,20 @@ class Item_char_typecast :public Item_str_func void fix_length_and_dec_internal(CHARSET_INFO *fromcs); public: Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg): - Item_str_func(thd, a), cast_length(length_arg), cast_cs(cs_arg) {} + Item_str_func(thd, a), cast_length(length_arg), cast_cs(cs_arg), + m_suppress_warning_to_error_escalation(false) {} enum Functype functype() const { return CHAR_TYPECAST_FUNC; } bool eq(const Item *item, bool binary_cmp) const; const char *func_name() const { return "cast_as_char"; } CHARSET_INFO *cast_charset() const { return cast_cs; } String *val_str(String *a); + void fix_length_and_dec_generic(); void fix_length_and_dec_numeric(); - void fix_length_and_dec_str(); + void fix_length_and_dec_str() + { + fix_length_and_dec_generic(); + m_suppress_warning_to_error_escalation= true; + } void fix_length_and_dec() { args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this); diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc index 8432ab43ad8..cd0fb5058a6 100644 --- a/sql/item_windowfunc.cc +++ b/sql/item_windowfunc.cc @@ -334,8 +334,8 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref) return TRUE; } Type_std_attributes::set(args[0]); - for (uint i= 0; i < arg_count && !with_subselect; i++) - with_subselect= with_subselect || args[i]->with_subselect; + for (uint i= 0; i < arg_count && !m_with_subquery; i++) + m_with_subquery|= args[i]->with_subquery(); Item *item2= args[0]->real_item(); if (item2->type() == Item::FIELD_ITEM) diff --git a/sql/lex.h b/sql/lex.h index 25b6b834a55..d31625292e3 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -181,6 +181,7 @@ static SYMBOL symbols[] = { { "DELAYED", SYM(DELAYED_SYM)}, { "DELAY_KEY_WRITE", SYM(DELAY_KEY_WRITE_SYM)}, { "DELETE", SYM(DELETE_SYM)}, + { "DELETE_DOMAIN_ID", SYM(DELETE_DOMAIN_ID_SYM)}, { "DESC", SYM(DESC)}, { "DESCRIBE", SYM(DESCRIBE)}, { "DES_KEY_FILE", SYM(DES_KEY_FILE)}, diff --git a/sql/log.cc b/sql/log.cc index be8b24da8df..e5ff85e4544 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2391,7 +2391,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg) *errmsg = "Could not open log file"; goto err; } - if (init_io_cache(log, file, binlog_file_cache_size, READ_CACHE, 0, 0, + if (init_io_cache(log, file, (size_t)binlog_file_cache_size, READ_CACHE, 0, 0, MYF(MY_WME|MY_DONT_CHECK_FILESIZE))) { sql_print_error("Failed to create a cache on log (file '%s')", @@ -4171,14 +4171,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, mysql_mutex_unlock(&LOCK_xid_list); } - /* - The following mutex is needed to ensure that no threads call - 'delete thd' as we would then risk missing a 'rollback' from this - thread. If the transaction involved MyISAM tables, it should go - into binlog even on rollback. - */ - mysql_mutex_lock(&LOCK_thread_count); - /* Save variables so that we can reopen the log */ save_name=name; name=0; // Protect against free @@ -4285,7 +4277,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, err: if (error == 1) name= const_cast(save_name); - mysql_mutex_unlock(&LOCK_thread_count); if (!is_relay_log) { @@ -6674,6 +6665,120 @@ void MYSQL_BIN_LOG::checkpoint_and_purge(ulong binlog_id) purge(); } + +/** + Searches for the first (oldest) binlog file name in in the binlog index. + + @param[in,out] buf_arg pointer to a buffer to hold found + the first binary log file name + @return NULL on success, otherwise error message +*/ +static const char* get_first_binlog(char* buf_arg) +{ + IO_CACHE *index_file; + size_t length; + char fname[FN_REFLEN]; + const char* errmsg= NULL; + + DBUG_ENTER("get_first_binlog"); + + DBUG_ASSERT(mysql_bin_log.is_open()); + + mysql_bin_log.lock_index(); + + index_file=mysql_bin_log.get_index_file(); + if (reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0)) + { + errmsg= "failed to create a cache on binlog index"; + goto end; + } + /* The file ends with EOF or empty line */ + if ((length=my_b_gets(index_file, fname, sizeof(fname))) <= 1) + { + errmsg= "empty binlog index"; + goto end; + } + else + { + fname[length-1]= 0; // Remove end \n + } + if (normalize_binlog_name(buf_arg, fname, false)) + { + errmsg= "cound not normalize the first file name in the binlog index"; + goto end; + } +end: + mysql_bin_log.unlock_index(); + + DBUG_RETURN(errmsg); +} + +/** + Check weather the gtid binlog state can safely remove gtid + domains passed as the argument. A safety condition is satisfied when + there are no events from the being deleted domains in the currently existing + binlog files. Upon successful check the supplied domains are removed + from @@gtid_binlog_state. The caller is supposed to rotate binlog so that + the active latest file won't have the deleted domains in its Gtid_list header. + + @param domain_drop_lex gtid domain id sequence from lex. + Passed as a pointer to dynamic array must be not empty + unless pointer value NULL. + @retval zero on success + @retval > 0 ineffective call none from the *non* empty + gtid domain sequence is deleted + @retval < 0 on error +*/ +static int do_delete_gtid_domain(DYNAMIC_ARRAY *domain_drop_lex) +{ + int rc= 0; + Gtid_list_log_event *glev= NULL; + char buf[FN_REFLEN]; + File file; + IO_CACHE cache; + const char* errmsg= NULL; + char errbuf[MYSQL_ERRMSG_SIZE]= {0}; + + if (!domain_drop_lex) + return 0; // still "effective" having empty domain sequence to delete + + DBUG_ASSERT(domain_drop_lex->elements > 0); + mysql_mutex_assert_owner(mysql_bin_log.get_log_lock()); + + if ((errmsg= get_first_binlog(buf)) != NULL) + goto end; + bzero((char*) &cache, sizeof(cache)); + if ((file= open_binlog(&cache, buf, &errmsg)) == (File) -1) + goto end; + errmsg= get_gtid_list_event(&cache, &glev); + end_io_cache(&cache); + mysql_file_close(file, MYF(MY_WME)); + + DBUG_EXECUTE_IF("inject_binlog_delete_domain_init_error", + errmsg= "injected error";); + if (errmsg) + goto end; + errmsg= rpl_global_gtid_binlog_state.drop_domain(domain_drop_lex, + glev, errbuf); + +end: + if (errmsg) + { + if (strlen(errmsg) > 0) + { + my_error(ER_BINLOG_CANT_DELETE_GTID_DOMAIN, MYF(0), errmsg); + rc= -1; + } + else + { + rc= 1; + } + } + delete glev; + + return rc; +} + /** The method is a shortcut of @c rotate() and @c purge(). LOCK_log is acquired prior to rotate and is released after it. @@ -6683,16 +6788,24 @@ void MYSQL_BIN_LOG::checkpoint_and_purge(ulong binlog_id) @retval nonzero - error in rotating routine. */ -int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate) +int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate, + DYNAMIC_ARRAY *domain_drop_lex) { - int error= 0; + int err_gtid=0, error= 0; ulong prev_binlog_id; DBUG_ENTER("MYSQL_BIN_LOG::rotate_and_purge"); bool check_purge= false; mysql_mutex_lock(&LOCK_log); prev_binlog_id= current_binlog_id; - if ((error= rotate(force_rotate, &check_purge))) + + if ((err_gtid= do_delete_gtid_domain(domain_drop_lex))) + { + // inffective attempt to delete merely skips rotate and purge + if (err_gtid < 0) + error= 1; // otherwise error is propagated the user + } + else if ((error= rotate(force_rotate, &check_purge))) check_purge= false; /* NOTE: Run purge_logs wo/ holding LOCK_log because it does not need @@ -7096,8 +7209,15 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, mode. Also, do not write the cached updates to binlog if binary logging is disabled (log-bin/sql_log_bin). */ - if (wsrep_emulate_bin_log || !(thd->variables.option_bits & OPTION_BIN_LOG)) + if (wsrep_emulate_bin_log) + { DBUG_RETURN(0); + } + else if (!(thd->variables.option_bits & OPTION_BIN_LOG)) + { + cache_mngr->need_unlog= false; + DBUG_RETURN(0); + } entry.thd= thd; entry.cache_mngr= cache_mngr; @@ -9398,11 +9518,19 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all, if (err) DBUG_RETURN(0); + + bool need_unlog= cache_mngr->need_unlog; + /* + The transaction won't need the flag anymore. + Todo/fixme: consider to move the statement into cache_mngr->reset() + relocated to the current or later point. + */ + cache_mngr->need_unlog= false; /* If using explicit user XA, we will not have XID. We must still return a non-zero cookie (as zero cookie signals error). */ - if (!xid || !cache_mngr->need_unlog) + if (!xid || !need_unlog) DBUG_RETURN(BINLOG_COOKIE_DUMMY(cache_mngr->delayed_error)); else DBUG_RETURN(BINLOG_COOKIE_MAKE(cache_mngr->binlog_id, @@ -9475,6 +9603,9 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) if (b->binlog_id == binlog_id) { --b->xid_count; + + DBUG_ASSERT(b->xid_count >= 0); // catch unmatched (++) decrement + break; } first= false; @@ -10248,6 +10379,73 @@ TC_LOG_BINLOG::set_status_variables(THD *thd) } } + +/* + Find the Gtid_list_log_event at the start of a binlog. + + NULL for ok, non-NULL error message for error. + + If ok, then the event is returned in *out_gtid_list. This can be NULL if we + get back to binlogs written by old server version without GTID support. If + so, it means we have reached the point to start from, as no GTID events can + exist in earlier binlogs. +*/ +const char * +get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list) +{ + Format_description_log_event init_fdle(BINLOG_VERSION); + Format_description_log_event *fdle; + Log_event *ev; + const char *errormsg = NULL; + + *out_gtid_list= NULL; + + if (!(ev= Log_event::read_log_event(cache, 0, &init_fdle, + opt_master_verify_checksum)) || + ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) + { + if (ev) + delete ev; + return "Could not read format description log event while looking for " + "GTID position in binlog"; + } + + fdle= static_cast(ev); + + for (;;) + { + Log_event_type typ; + + ev= Log_event::read_log_event(cache, 0, fdle, opt_master_verify_checksum); + if (!ev) + { + errormsg= "Could not read GTID list event while looking for GTID " + "position in binlog"; + break; + } + typ= ev->get_type_code(); + if (typ == GTID_LIST_EVENT) + break; /* Done, found it */ + if (typ == START_ENCRYPTION_EVENT) + { + if (fdle->start_decryption((Start_encryption_log_event*) ev)) + errormsg= "Could not set up decryption for binlog."; + } + delete ev; + if (typ == ROTATE_EVENT || typ == STOP_EVENT || + typ == FORMAT_DESCRIPTION_EVENT || typ == START_ENCRYPTION_EVENT) + continue; /* Continue looking */ + + /* We did not find any Gtid_list_log_event, must be old binlog. */ + ev= NULL; + break; + } + + delete fdle; + *out_gtid_list= static_cast(ev); + return errormsg; +} + struct st_mysql_storage_engine binlog_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; diff --git a/sql/log.h b/sql/log.h index 30829bdb33c..dffb6a80d54 100644 --- a/sql/log.h +++ b/sql/log.h @@ -759,7 +759,7 @@ public: int update_log_index(LOG_INFO* linfo, bool need_update_threads); int rotate(bool force_rotate, bool* check_purge); void checkpoint_and_purge(ulong binlog_id); - int rotate_and_purge(bool force_rotate); + int rotate_and_purge(bool force_rotate, DYNAMIC_ARRAY* drop_gtid_domain= NULL); /** Flush binlog cache and synchronize to disk. @@ -1169,4 +1169,9 @@ static inline TC_LOG *get_tc_log_implementation() return &tc_log_mmap; } + +class Gtid_list_log_event; +const char * +get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list); + #endif /* LOG_H */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e77184999dc..ad76d043cc7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -446,6 +446,7 @@ my_bool opt_replicate_annotate_row_events= 0; my_bool opt_mysql56_temporal_format=0, strict_password_validation= 1; my_bool opt_explicit_defaults_for_timestamp= 0; char *opt_slave_skip_errors; +char *opt_slave_transaction_retry_errors; /* Legacy global handlerton. These will be removed (please do not add more). @@ -501,6 +502,7 @@ ulong what_to_log; ulong slow_launch_time; ulong open_files_limit, max_binlog_size; ulong slave_trans_retries; +ulong slave_trans_retry_interval; uint slave_net_timeout; ulong slave_exec_mode_options; ulong slave_run_triggers_for_rbr= 0; @@ -2178,6 +2180,9 @@ static void mysqld_exit(int exit_code) (long) global_status_var.global_memory_used); if (!opt_debugging && !my_disable_leak_check && exit_code == 0) { +#ifdef SAFEMALLOC + sf_report_leaked_memory(0); +#endif DBUG_SLOW_ASSERT(global_status_var.global_memory_used == 0); } cleanup_tls(); @@ -5953,9 +5958,6 @@ int mysqld_main(int argc, char **argv) #ifdef __WIN__ if (!opt_console) { - if (reopen_fstreams(log_error_file, stdout, stderr)) - unireg_abort(1); - setbuf(stderr, NULL); FreeConsole(); // Remove window } @@ -7800,6 +7802,7 @@ struct my_option my_long_options[]= MYSQL_SUGGEST_ANALOG_OPTION("max-binlog-dump-events", "--debug-max-binlog-dump-events"), MYSQL_SUGGEST_ANALOG_OPTION("sporadic-binlog-dump-fail", "--debug-sporadic-binlog-dump-fail"), MYSQL_COMPATIBILITY_OPTION("new"), + MYSQL_COMPATIBILITY_OPTION("show_compatibility_56"), /* The following options were added after 5.6.10 */ MYSQL_TO_BE_IMPLEMENTED_OPTION("rpl-stop-slave-timeout"), @@ -9085,12 +9088,12 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) opt->name); break; case OPT_MYSQL_COMPATIBILITY: - sql_print_warning("'%s' is MySQL 5.6 compatible option. Not used or needed " - "in MariaDB.", opt->name); + sql_print_warning("'%s' is MySQL 5.6 / 5.7 compatible option. Not used or " + "needed in MariaDB.", opt->name); break; case OPT_MYSQL_TO_BE_IMPLEMENTED: - sql_print_warning("'%s' is MySQL 5.6 compatible option. To be implemented " - "in later versions.", opt->name); + sql_print_warning("'%s' is MySQL 5.6 / 5.7 compatible option. To be " + "implemented in later versions.", opt->name); break; case 'a': SYSVAR_AUTOSIZE(global_system_variables.sql_mode, MODE_ANSI); @@ -9678,8 +9681,10 @@ static int get_options(int *argc_ptr, char ***argv_ptr) flush_time= 0; #ifdef HAVE_REPLICATION - if (opt_slave_skip_errors) - init_slave_skip_errors(opt_slave_skip_errors); + if (init_slave_skip_errors(opt_slave_skip_errors)) + return 1; + if (init_slave_transaction_retry_errors(opt_slave_transaction_retry_errors)) + return 1; #endif if (global_system_variables.max_join_size == HA_POS_ERROR) diff --git a/sql/mysqld.h b/sql/mysqld.h index 4aaadcc618e..5c389e60e17 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -246,6 +246,7 @@ extern my_bool slave_allow_batching; extern my_bool allow_slave_start; extern LEX_CSTRING reason_slave_blocked; extern ulong slave_trans_retries; +extern ulong slave_trans_retry_interval; extern uint slave_net_timeout; extern int max_user_connections; extern volatile ulong cached_thread_count; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f261c5731cf..fba449e7ce2 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1236,7 +1236,8 @@ QUICK_SELECT_I::QUICK_SELECT_I() QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr, bool no_alloc, MEM_ROOT *parent_alloc, bool *create_error) - :free_file(0),cur_range(NULL),last_range(0),dont_free(0) + :thd(thd), no_alloc(no_alloc), parent_alloc(parent_alloc), + free_file(0),cur_range(NULL),last_range(0),dont_free(0) { my_bitmap_map *bitmap; DBUG_ENTER("QUICK_RANGE_SELECT::QUICK_RANGE_SELECT"); diff --git a/sql/opt_range.h b/sql/opt_range.h index b3eb25e5f65..bd85a12d4a1 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1047,6 +1047,10 @@ bool quick_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range); class QUICK_RANGE_SELECT : public QUICK_SELECT_I { protected: + THD *thd; + bool no_alloc; + MEM_ROOT *parent_alloc; + /* true if we enabled key only reads */ handler *file; @@ -1085,6 +1089,9 @@ public: QUICK_RANGE_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc, MEM_ROOT *parent_alloc, bool *create_err); ~QUICK_RANGE_SELECT(); + virtual QUICK_RANGE_SELECT *clone(bool *create_error) + { return new QUICK_RANGE_SELECT(thd, head, index, no_alloc, parent_alloc, + create_error); } void need_sorted_output(); int init(); @@ -1155,6 +1162,12 @@ public: :QUICK_RANGE_SELECT(thd, table, index_arg, no_alloc, parent_alloc, create_err) {}; + virtual QUICK_RANGE_SELECT *clone(bool *create_error) + { + DBUG_ASSERT(0); + return new QUICK_RANGE_SELECT_GEOM(thd, head, index, no_alloc, + parent_alloc, create_error); + } virtual int get_next(); }; @@ -1584,6 +1597,8 @@ class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT { public: QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts); + virtual QUICK_RANGE_SELECT *clone(bool *create_error) + { DBUG_ASSERT(0); return new QUICK_SELECT_DESC(this, used_key_parts); } int get_next(); bool reverse_sorted() { return 1; } int get_type() { return QS_TYPE_RANGE_DESC; } @@ -1690,6 +1705,8 @@ public: QUICK_RANGE_SELECT (thd, table, key, 1, NULL, create_err) { (void) init(); } ~FT_SELECT() { file->ft_end(); } + virtual QUICK_RANGE_SELECT *clone(bool *create_error) + { DBUG_ASSERT(0); return new FT_SELECT(thd, head, index, create_error); } int init() { return file->ft_init(); } int reset() { return 0; } int get_next() { return file->ha_ft_read(record); } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 72da68816ad..9cd2eedb55d 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1631,7 +1631,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) // The subqueries were replaced for Item_int(1) earlier subq_pred->reset_strategy(SUBS_SEMI_JOIN); // for subsequent executions - /*TODO: also reset the 'with_subselect' there. */ + /*TODO: also reset the 'm_with_subquery' there. */ /* n. Adjust the parent_join->table_count counter */ uint table_no= parent_join->table_count; diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 72b28473e15..43d1c2de7ad 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -398,6 +398,8 @@ int opt_sum_query(THD *thd, const_result= 0; break; } + longlong info_limit= 1; + table->file->info_push(INFO_KIND_FORCE_LIMIT_BEGIN, &info_limit); if (!(error= table->file->ha_index_init((uint) ref.key, 1))) error= (is_max ? get_index_max_value(table, &ref, range_fl) : @@ -410,6 +412,7 @@ int opt_sum_query(THD *thd, error= HA_ERR_KEY_NOT_FOUND; table->file->ha_end_keyread(); table->file->ha_index_end(); + table->file->info_push(INFO_KIND_FORCE_LIMIT_END, NULL); if (error) { if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE) diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 390afc575ca..ef9b07cca47 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -1810,6 +1810,7 @@ static void mark_as_eliminated(JOIN *join, TABLE_LIST *tbl) { DBUG_PRINT("info", ("Eliminated table %s", table->alias.c_ptr())); tab->type= JT_CONST; + tab->table->const_table= 1; join->eliminated_tables |= table->map; join->const_table_map|= table->map; set_position(join, join->const_tables++, tab, (KEYUSE*)0); diff --git a/sql/protocol.cc b/sql/protocol.cc index dbaa8ae6a1e..fae399e66e2 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1327,6 +1327,7 @@ bool Protocol_text::send_out_parameters(List *sp_params) continue; } + DBUG_ASSERT(sparam->get_item_param() == NULL); sparam->set_value(thd, thd->spcont, reinterpret_cast(&item_param)); } diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index d58a2ea4d3e..369b072ab47 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -26,7 +26,7 @@ #include "rpl_gtid.h" #include "rpl_rli.h" #include "slave.h" - +#include "log_event.h" const LEX_STRING rpl_gtid_slave_state_table_name= { C_STRING_WITH_LEN("gtid_slave_pos") }; @@ -1940,6 +1940,155 @@ end: return res; } +/** + Remove domains supplied by the first argument from binlog state. + Removal is done for any domain whose last gtids (from all its servers) match + ones in Gtid list event of the 2nd argument. + + @param ids gtid domain id sequence, may contain dups + @param glev pointer to Gtid list event describing + the match condition + @param errbuf [out] pointer to possible error message array + + @retval NULL as success when at least one domain is removed + @retval "" empty string to indicate ineffective call + when no domains removed + @retval NOT EMPTY string otherwise an error message +*/ +const char* +rpl_binlog_state::drop_domain(DYNAMIC_ARRAY *ids, + Gtid_list_log_event *glev, + char* errbuf) +{ + DYNAMIC_ARRAY domain_unique; // sequece (unsorted) of unique element*:s + rpl_binlog_state::element* domain_unique_buffer[16]; + ulong k, l; + const char* errmsg= NULL; + + DBUG_ENTER("rpl_binlog_state::drop_domain"); + + my_init_dynamic_array2(&domain_unique, + sizeof(element*), domain_unique_buffer, + sizeof(domain_unique_buffer) / sizeof(element*), 4, 0); + + mysql_mutex_lock(&LOCK_binlog_state); + + /* + Gtid list is supposed to come from a binlog's Gtid_list event and + therefore should be a subset of the current binlog state. That is + for every domain in the list the binlog state contains a gtid with + sequence number not less than that of the list. + Exceptions of this inclusion rule are: + A. the list may still refer to gtids from already deleted domains. + Files containing them must have been purged whereas the file + with the list is not yet. + B. out of order groups were injected + C. manually build list of binlog files violating the inclusion + constraint. + While A is a normal case (not necessarily distinguishable from C though), + B and C may require the user's attention so any (incl the A's suspected) + inconsistency is diagnosed and *warned*. + */ + for (l= 0, errbuf[0]= 0; l < glev->count; l++, errbuf[0]= 0) + { + rpl_gtid* rb_state_gtid= find_nolock(glev->list[l].domain_id, + glev->list[l].server_id); + if (!rb_state_gtid) + sprintf(errbuf, + "missing gtids from the '%u-%u' domain-server pair which is " + "referred to in the gtid list describing an earlier state. Ignore " + "if the domain ('%u') was already explicitly deleted", + glev->list[l].domain_id, glev->list[l].server_id, + glev->list[l].domain_id); + else if (rb_state_gtid->seq_no < glev->list[l].seq_no) + sprintf(errbuf, + "having a gtid '%u-%u-%llu' which is less than " + "the '%u-%u-%llu' of the gtid list describing an earlier state. " + "The state may have been affected by manually injecting " + "a lower sequence number gtid or via replication", + rb_state_gtid->domain_id, rb_state_gtid->server_id, + rb_state_gtid->seq_no, glev->list[l].domain_id, + glev->list[l].server_id, glev->list[l].seq_no); + if (strlen(errbuf)) // use strlen() as cheap flag + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_BINLOG_CANT_DELETE_GTID_DOMAIN, + "The current gtid binlog state is incompatible with " + "a former one %s.", errbuf); + } + + /* + For each domain_id from ids + when no such domain in binlog state + warn && continue + For each domain.server's last gtid + when not locate the last gtid in glev.list + error out binlog state can't change + otherwise continue + */ + for (ulong i= 0; i < ids->elements; i++) + { + rpl_binlog_state::element *elem= NULL; + ulong *ptr_domain_id; + bool not_match; + + ptr_domain_id= (ulong*) dynamic_array_ptr(ids, i); + elem= (rpl_binlog_state::element *) + my_hash_search(&hash, (const uchar *) ptr_domain_id, 0); + if (!elem) + { + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_BINLOG_CANT_DELETE_GTID_DOMAIN, + "The gtid domain being deleted ('%lu') is not in " + "the current binlog state", *ptr_domain_id); + continue; + } + + for (not_match= true, k= 0; k < elem->hash.records; k++) + { + rpl_gtid *d_gtid= (rpl_gtid *)my_hash_element(&elem->hash, k); + for (ulong l= 0; l < glev->count && not_match; l++) + not_match= !(*d_gtid == glev->list[l]); + } + + if (not_match) + { + sprintf(errbuf, "binlog files may contain gtids from the domain ('%lu') " + "being deleted. Make sure to first purge those files", + *ptr_domain_id); + errmsg= errbuf; + goto end; + } + // 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) + == elem) + break; // domain_id's elem has been already in + } + if (k == domain_unique.elements) // proven not to have duplicates + insert_dynamic(&domain_unique, (uchar*) &elem); + } + + // Domain removal from binlog state + for (k= 0; k < domain_unique.elements; k++) + { + rpl_binlog_state::element *elem= *(rpl_binlog_state::element**) + dynamic_array_ptr(&domain_unique, k); + my_hash_free(&elem->hash); + my_hash_delete(&hash, (uchar*) elem); + } + + DBUG_ASSERT(strlen(errbuf) == 0); + + if (domain_unique.elements == 0) + errmsg= ""; + +end: + mysql_mutex_unlock(&LOCK_binlog_state); + delete_dynamic(&domain_unique); + + DBUG_RETURN(errmsg); +} slave_connection_state::slave_connection_state() { diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index c473ff40ee9..d30bfa64b87 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -34,6 +34,13 @@ struct rpl_gtid uint64 seq_no; }; +inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs) +{ + return + lhs.domain_id == rhs.domain_id && + lhs.server_id == rhs.server_id && + lhs.seq_no == rhs.seq_no; +}; enum enum_gtid_skip_type { GTID_SKIP_NOT, GTID_SKIP_STANDALONE, GTID_SKIP_TRANSACTION @@ -93,6 +100,7 @@ struct gtid_waiting { class Relay_log_info; struct rpl_group_info; +class Gtid_list_log_event; /* Replication slave state. @@ -315,6 +323,7 @@ struct rpl_binlog_state rpl_gtid *find_nolock(uint32 domain_id, uint32 server_id); rpl_gtid *find(uint32 domain_id, uint32 server_id); rpl_gtid *find_most_recent(uint32 domain_id); + const char* drop_domain(DYNAMIC_ARRAY *ids, Gtid_list_log_event *glev, char*); }; diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 774f582b4b9..9c1892e0c6c 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -141,10 +141,10 @@ max_display_length_for_field(enum_field_types sql_type, unsigned int metadata) */ case MYSQL_TYPE_TINY_BLOB: - return my_set_bits(1 * 8); + return (uint32)my_set_bits(1 * 8); case MYSQL_TYPE_MEDIUM_BLOB: - return my_set_bits(3 * 8); + return (uint32)my_set_bits(3 * 8); case MYSQL_TYPE_BLOB: case MYSQL_TYPE_BLOB_COMPRESSED: @@ -153,11 +153,11 @@ max_display_length_for_field(enum_field_types sql_type, unsigned int metadata) blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look at the length instead to decide what the max display size is. */ - return my_set_bits(metadata * 8); + return (uint32)my_set_bits(metadata * 8); case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_GEOMETRY: - return my_set_bits(4 * 8); + return (uint32)my_set_bits(4 * 8); default: return ~(uint32) 0; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index cf0a673cb20..e12f6cb258b 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -1801,8 +1801,8 @@ ER_WRONG_AUTO_KEY 42000 S1009 spa "Puede ser solamente un campo automatico y este debe ser definido como una clave" swe "Det fÃ¥r finnas endast ett AUTO_INCREMENT-fält och detta mÃ¥ste vara en nyckel" ukr "Ðевірне Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ñ‚Ð°Ð±Ð»Ð¸Ñ†Ñ–; Може бути лише один автоматичний Ñтовбець, що повинен бути визначений Ñк ключ" -ER_UNUSED_9 - eng "You should never see it" +ER_BINLOG_CANT_DELETE_GTID_DOMAIN + eng "Could not delete gtid domain. Reason: %s." ER_NORMAL_SHUTDOWN cze "%s (%s): normální ukonÄení\n" dan "%s (%s): Normal nedlukning\n" @@ -7330,7 +7330,7 @@ ER_SUBQUERIES_NOT_SUPPORTED 42000 eng "%s does not support subqueries or stored functions" ER_SET_STATEMENT_NOT_SUPPORTED 42000 eng "The system variable %.200s cannot be set in SET STATEMENT." -ER_UNUSED_17 +ER_UNUSED_9 eng "You should never see it" ER_USER_CREATE_EXISTS eng "Can't create user '%-.64s'@'%-.64s'; it already exists" @@ -7747,6 +7747,9 @@ ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG ER_NET_OK_PACKET_TOO_LARGE eng "OK packet too large" +ER_GEOJSON_EMPTY_COORDINATES + eng "Incorrect GeoJSON format - empty 'coordinates' array." + ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION eng "Illegal parameter data types %s and %s for operation '%s'" ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION @@ -7800,6 +7803,12 @@ ER_ARGUMENT_OUT_OF_RANGE eng "Argument to the %s function does not belong to the range [0,1]" ER_WRONG_TYPE_OF_ARGUMENT eng "%s function only accepts arguments that can be converted to numerical types" +ER_NOT_AGGREGATE_FUNCTION + eng "Non-aggregate function contains aggregate specific instructions: (FETCH GROUP NEXT ROW)" +ER_INVALID_AGGREGATE_FUNCTION + eng "Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function" +ER_INVALID_VALUE_TO_LIMIT + eng "Limit only accepts integer values" # MariaDB error numbers related to System Versioning diff --git a/sql/slave.cc b/sql/slave.cc index 94e35bec4f8..1ee745ced6a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -72,6 +72,9 @@ bool use_slave_mask = 0; MY_BITMAP slave_error_mask; char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE]; +uint *slave_transaction_retry_errors; +uint slave_transaction_retry_error_length= 0; +char slave_transaction_retry_error_names[SHOW_VAR_FUNC_BUFF_SIZE]; char* slave_load_tmpdir = 0; Master_info *active_mi= 0; @@ -156,7 +159,8 @@ static bool wait_for_relay_log_space(Relay_log_info* rli); static bool io_slave_killed(Master_info* mi); static bool sql_slave_killed(rpl_group_info *rgi); static int init_slave_thread(THD*, Master_info *, SLAVE_THD_TYPE); -static void print_slave_skip_errors(void); +static void make_slave_skip_errors_printable(void); +static void make_slave_transaction_retry_errors_printable(void); static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); static int safe_reconnect(THD*, MYSQL*, Master_info*, bool); static int connect_to_master(THD*, MYSQL*, Master_info*, bool, bool); @@ -635,7 +639,6 @@ start_slave_background_thread() sql_print_error("Failed to create thread while initialising slave"); return 1; } - mysql_mutex_lock(&LOCK_slave_background); while (!slave_background_thread_gtid_loaded) mysql_cond_wait(&COND_slave_background, &LOCK_slave_background); @@ -706,15 +709,6 @@ int init_slave() goto err; } - /* - If --slave-skip-errors=... was not used, the string value for the - system variable has not been set up yet. Do it now. - */ - if (!use_slave_mask) - { - print_slave_skip_errors(); - } - /* If master_host is not specified, try to read it from the master_info file. If master_host is specified, create the master_info file if it doesn't @@ -812,12 +806,12 @@ int init_recovery(Master_info* mi, const char** errmsg) DBUG_RETURN(0); } - + /** Convert slave skip errors bitmap into a printable string. */ -static void print_slave_skip_errors(void) +static void make_slave_skip_errors_printable(void) { /* To be safe, we want 10 characters of room in the buffer for a number @@ -826,7 +820,7 @@ static void print_slave_skip_errors(void) plus a NUL terminator. That is a max 6 digit number. */ const size_t MIN_ROOM= 10; - DBUG_ENTER("print_slave_skip_errors"); + DBUG_ENTER("make_slave_skip_errors_printable"); DBUG_ASSERT(sizeof(slave_skip_error_names) > MIN_ROOM); DBUG_ASSERT(MAX_SLAVE_ERROR <= 999999); // 6 digits @@ -848,14 +842,14 @@ static void print_slave_skip_errors(void) else { char *buff= slave_skip_error_names; - char *bend= buff + sizeof(slave_skip_error_names); + char *bend= buff + sizeof(slave_skip_error_names) - MIN_ROOM; int errnum; for (errnum= 0; errnum < MAX_SLAVE_ERROR; errnum++) { if (bitmap_is_set(&slave_error_mask, errnum)) { - if (buff + MIN_ROOM >= bend) + if (buff >= bend) break; /* purecov: tested */ buff= int10_to_str(errnum, buff, 10); *buff++= ','; @@ -885,24 +879,24 @@ static void print_slave_skip_errors(void) Called from get_options() in mysqld.cc on start-up */ -void init_slave_skip_errors(const char* arg) +bool init_slave_skip_errors(const char* arg) { const char *p; DBUG_ENTER("init_slave_skip_errors"); + if (!arg || !*arg) // No errors defined + goto end; + if (my_bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0)) - { - fprintf(stderr, "Badly out of memory, please check your system status\n"); - exit(1); - } - use_slave_mask = 1; + DBUG_RETURN(1); + + use_slave_mask= 1; for (;my_isspace(system_charset_info,*arg);++arg) /* empty */; if (!my_strnncoll(system_charset_info,(uchar*)arg,4,(const uchar*)"all",4)) { bitmap_set_all(&slave_error_mask); - print_slave_skip_errors(); - DBUG_VOID_RETURN; + goto end; } for (p= arg ; *p; ) { @@ -914,11 +908,109 @@ void init_slave_skip_errors(const char* arg) while (!my_isdigit(system_charset_info,*p) && *p) p++; } - /* Convert slave skip errors bitmap into a printable string. */ - print_slave_skip_errors(); + +end: + make_slave_skip_errors_printable(); + DBUG_RETURN(0); +} + +/** + Make printable version if slave_transaction_retry_errors + This is never empty as at least ER_LOCK_DEADLOCK and ER_LOCK_WAIT_TIMEOUT + will be there +*/ + +static void make_slave_transaction_retry_errors_printable(void) +{ + /* + To be safe, we want 10 characters of room in the buffer for a number + plus terminators. Also, we need some space for constant strings. + 10 characters must be sufficient for a number plus {',' | '...'} + plus a NUL terminator. That is a max 6 digit number. + */ + const size_t MIN_ROOM= 10; + char *buff= slave_transaction_retry_error_names; + char *bend= buff + sizeof(slave_transaction_retry_error_names) - MIN_ROOM; + uint i; + DBUG_ENTER("make_slave_transaction_retry_errors_printable"); + DBUG_ASSERT(sizeof(slave_transaction_retry_error_names) > MIN_ROOM); + + /* Make @@slave_transaction_retry_errors show a human-readable value */ + opt_slave_transaction_retry_errors= slave_transaction_retry_error_names; + + for (i= 0; i < slave_transaction_retry_error_length && buff < bend; i++) + { + buff= int10_to_str(slave_transaction_retry_errors[i], buff, 10); + *buff++= ','; + } + if (buff != slave_transaction_retry_error_names) + buff--; // Remove last ',' + if (i < slave_transaction_retry_error_length) + { + /* Couldn't show all errors */ + buff= strmov(buff, "..."); /* purecov: tested */ + } + *buff=0; + DBUG_PRINT("exit", ("error_names: '%s'", + slave_transaction_retry_error_names)); DBUG_VOID_RETURN; } + +bool init_slave_transaction_retry_errors(const char* arg) +{ + const char *p; + long err_code; + uint i; + DBUG_ENTER("init_slave_transaction_retry_errors"); + + /* Handle empty strings */ + if (!arg) + arg= ""; + + slave_transaction_retry_error_length= 2; + for (;my_isspace(system_charset_info,*arg);++arg) + /* empty */; + for (p= arg; *p; ) + { + if (!(p= str2int(p, 10, 0, LONG_MAX, &err_code))) + break; + slave_transaction_retry_error_length++; + while (!my_isdigit(system_charset_info,*p) && *p) + p++; + } + + if (!(slave_transaction_retry_errors= + (uint *) my_once_alloc(sizeof(int) * + slave_transaction_retry_error_length, + MYF(MY_WME)))) + DBUG_RETURN(1); + + /* + Temporary error codes: + currently, InnoDB deadlock detected by InnoDB or lock + wait timeout (innodb_lock_wait_timeout exceeded + */ + slave_transaction_retry_errors[0]= ER_LOCK_DEADLOCK; + slave_transaction_retry_errors[1]= ER_LOCK_WAIT_TIMEOUT; + + /* Add user codes after this */ + for (p= arg, i= 2; *p; ) + { + if (!(p= str2int(p, 10, 0, LONG_MAX, &err_code))) + break; + if (err_code > 0 && err_code < ER_ERROR_LAST) + slave_transaction_retry_errors[i++]= (uint) err_code; + while (!my_isdigit(system_charset_info,*p) && *p) + p++; + } + slave_transaction_retry_error_length= i; + + make_slave_transaction_retry_errors_printable(); + DBUG_RETURN(0); +} + + int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) { DBUG_ENTER("terminate_slave_threads"); @@ -987,7 +1079,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) mysql_mutex_unlock(log_lock); } - DBUG_RETURN(retval); + DBUG_RETURN(retval); } @@ -3598,14 +3690,20 @@ static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings, DBUG_RETURN(len - 1); } -/* + +/** Check if the current error is of temporary nature of not. Some errors are temporary in nature, such as ER_LOCK_DEADLOCK and ER_LOCK_WAIT_TIMEOUT. + + @retval 0 if fatal error + @retval 1 temporary error, do retry */ + int has_temporary_error(THD *thd) { + uint current_errno; DBUG_ENTER("has_temporary_error"); DBUG_EXECUTE_IF("all_errors_are_temporary_errors", @@ -3623,14 +3721,12 @@ has_temporary_error(THD *thd) if (!thd->is_error()) DBUG_RETURN(0); - /* - Temporary error codes: - currently, InnoDB deadlock detected by InnoDB or lock - wait timeout (innodb_lock_wait_timeout exceeded - */ - if (thd->get_stmt_da()->sql_errno() == ER_LOCK_DEADLOCK || - thd->get_stmt_da()->sql_errno() == ER_LOCK_WAIT_TIMEOUT) - DBUG_RETURN(1); + current_errno= thd->get_stmt_da()->sql_errno(); + for (uint i= 0; i < slave_transaction_retry_error_length; i++) + { + if (current_errno == slave_transaction_retry_errors[i]) + DBUG_RETURN(1); + } DBUG_RETURN(0); } @@ -4281,8 +4377,9 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, exec_res= 0; serial_rgi->cleanup_context(thd, 1); /* chance for concurrent connection to get more locks */ - slave_sleep(thd, MY_MIN(serial_rgi->trans_retries, + slave_sleep(thd, MY_MAX(MY_MIN(serial_rgi->trans_retries, MAX_SLAVE_RETRY_PAUSE), + slave_trans_retry_interval), sql_slave_killed, serial_rgi); serial_rgi->trans_retries++; mysql_mutex_lock(&rli->data_lock); // because of SHOW STATUS @@ -4367,7 +4464,7 @@ static bool check_io_slave_killed(Master_info *mi, const char *info) @param[in] mysql MySQL connection. @param[in] mi Master connection information. @param[in,out] retry_count Number of attempts to reconnect. - @param[in] suppress_warnings TRUE when a normal net read timeout + @param[in] suppress_warnings TRUE when a normal net read timeout has caused to reconnecting. @param[in] messages Messages to print/log, see reconnect_messages[] array. @@ -4870,9 +4967,7 @@ err_during_init: // TODO: make rpl_status part of Master_info change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE); - mysql_mutex_lock(&LOCK_thread_count); - thd->unlink(); - mysql_mutex_unlock(&LOCK_thread_count); + thd->assert_not_linked(); delete thd; thread_safe_decrement32(&service_thread_count); signal_thd_deleted(); @@ -5551,11 +5646,7 @@ err_during_init: rpl_parallel_resize_pool_if_no_slaves(); - /* TODO: Check if this lock is needed */ - mysql_mutex_lock(&LOCK_thread_count); delete serial_rgi; - mysql_mutex_unlock(&LOCK_thread_count); - delete thd; thread_safe_decrement32(&service_thread_count); signal_thd_deleted(); diff --git a/sql/slave.h b/sql/slave.h index c856a6989ed..74bb4356dfb 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -132,6 +132,9 @@ extern ulong master_retry_count; extern MY_BITMAP slave_error_mask; extern char slave_skip_error_names[]; extern bool use_slave_mask; +extern char slave_transaction_retry_error_names[]; +extern uint *slave_transaction_retry_errors; +extern uint slave_transaction_retry_error_length; extern char *slave_load_tmpdir; extern char *master_info_file; extern MYSQL_PLUGIN_IMPORT char *relay_log_info_file; @@ -139,6 +142,7 @@ extern char *opt_relay_logname, *opt_relaylog_index_name; extern my_bool opt_skip_slave_start, opt_reckless_slave; extern my_bool opt_log_slave_updates; extern char *opt_slave_skip_errors; +extern char *opt_slave_transaction_retry_errors; extern my_bool opt_replicate_annotate_row_events; extern ulonglong relay_log_space_limit; extern ulonglong opt_read_binlog_speed_limit; @@ -184,7 +188,8 @@ extern const char *relay_log_basename; int init_slave(); int init_recovery(Master_info* mi, const char** errmsg); -void init_slave_skip_errors(const char* arg); +bool init_slave_skip_errors(const char* arg); +bool init_slave_transaction_retry_errors(const char* arg); int register_slave_on_master(MYSQL* mysql); int terminate_slave_threads(Master_info* mi, int thread_mask, bool skip_lock = 0); diff --git a/sql/sp.cc b/sql/sp.cc index e02283d1f17..58dd8cfee3d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -201,6 +201,11 @@ TABLE_FIELD_TYPE proc_table_fields[MYSQL_PROC_FIELD_COUNT] = { C_STRING_WITH_LEN("body_utf8") }, { C_STRING_WITH_LEN("longblob") }, { NULL, 0 } + }, + { + { C_STRING_WITH_LEN("aggregate") }, + { C_STRING_WITH_LEN("enum('NONE','GROUP')") }, + { NULL, 0 } } }; @@ -583,6 +588,22 @@ bool st_sp_chistics::read_from_mysql_proc_row(THD *thd, TABLE *table) return true; suid= str.str[0] == 'I' ? SP_IS_NOT_SUID : SP_IS_SUID; + if (table->field[MYSQL_PROC_FIELD_AGGREGATE]->val_str_nopad(thd->mem_root, + &str)) + return true; + + switch (str.str[0]) { + case 'N': + agg_type= NOT_AGGREGATE; + break; + case 'G': + agg_type= GROUP_AGGREGATE; + break; + default: + agg_type= DEFAULT_AGGREGATE; + } + + if (table->field[MYSQL_PROC_FIELD_COMMENT]->val_str_nopad(thd->mem_root, &comment)) return true; @@ -1183,6 +1204,13 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const table->field[MYSQL_PROC_FIELD_NAME]-> store(sp->m_name, system_charset_info); + if (sp->agg_type() != DEFAULT_AGGREGATE) + { + store_failed= store_failed || + table->field[MYSQL_PROC_FIELD_AGGREGATE]-> + store((longlong)sp->agg_type(),TRUE); + } + store_failed= store_failed || table->field[MYSQL_PROC_MYSQL_TYPE]-> store((longlong) type(), true); @@ -1494,6 +1522,9 @@ Sp_handler::sp_update_routine(THD *thd, const Database_qualified_name *name, if (chistics->comment.str) table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment, system_charset_info); + if (chistics->agg_type != DEFAULT_AGGREGATE) + table->field[MYSQL_PROC_FIELD_AGGREGATE]-> + store((longlong)chistics->agg_type, TRUE); if ((ret= table->file->ha_update_row(table->record[1],table->record[0])) && ret != HA_ERR_RECORD_IS_THE_SAME) ret= SP_WRITE_ROW_FAILED; @@ -2238,11 +2269,12 @@ Sp_handler::show_create_sp(THD *thd, String *buf, sql_mode_t sql_mode) const { sql_mode_t old_sql_mode= thd->variables.sql_mode; + size_t agglen= (chistics.agg_type == GROUP_AGGREGATE)? 10 : 0; /* Make some room to begin with */ if (buf->alloc(100 + db.length + 1 + name.length + params.length + returns.length + - chistics.comment.length + 10 /* length of " DEFINER= "*/ + - USER_HOST_BUFF_SIZE)) + chistics.comment.length + 10 /* length of " DEFINER= "*/ + + agglen + USER_HOST_BUFF_SIZE)) return true; thd->variables.sql_mode= sql_mode; @@ -2250,6 +2282,8 @@ Sp_handler::show_create_sp(THD *thd, String *buf, if (ddl_options.or_replace()) buf->append(STRING_WITH_LEN("OR REPLACE ")); append_definer(thd, buf, &definer.user, &definer.host); + if (chistics.agg_type == GROUP_AGGREGATE) + buf->append(STRING_WITH_LEN("AGGREGATE ")); buf->append(type_lex_cstring()); buf->append(STRING_WITH_LEN(" ")); if (ddl_options.if_not_exists()) diff --git a/sql/sp.h b/sql/sp.h index ab307a3064e..42b7fcb2c5c 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -370,6 +370,7 @@ enum MYSQL_PROC_FIELD_COLLATION_CONNECTION, MYSQL_PROC_FIELD_DB_COLLATION, MYSQL_PROC_FIELD_BODY_UTF8, + MYSQL_PROC_FIELD_AGGREGATE, MYSQL_PROC_FIELD_COUNT }; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index bd02762f5ab..28e4442dd0c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -999,6 +999,12 @@ sp_head::execute(THD *thd, bool merge_da_on_success) bool err_status= FALSE; uint ip= 0; sql_mode_t save_sql_mode; + + // TODO(cvicentiu) See if you can drop this bit. This is used to resume + // execution from where we left off. + if (m_chistics.agg_type == GROUP_AGGREGATE) + ip= thd->spcont->instr_ptr; + bool save_abort_on_warning; Query_arena *old_arena; /* per-instruction arena */ @@ -1022,6 +1028,19 @@ sp_head::execute(THD *thd, bool merge_da_on_success) if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); + /* + Normally the counter is not reset between parsing and first execution, + but it is possible in case of error to have parsing on one CALL and + first execution (where VIEW will be parsed and added). So we store the + counter after parsing and restore it before execution just to avoid + repeating SELECT numbers. + + Other problem is that it can be more SELECTs parsed in case of fixing + error causes previous interruption of the SP. So it is save not just + assign old value but add it. + */ + thd->select_number+= m_select_number; + /* init per-instruction memroot */ init_sql_alloc(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0)); @@ -1163,6 +1182,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) #if defined(ENABLED_PROFILING) thd->profiling.discard_current_query(); #endif + thd->spcont->quit_func= TRUE; break; } @@ -1232,7 +1252,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success) /* Reset sp_rcontext::end_partial_result_set flag. */ ctx->end_partial_result_set= FALSE; - } while (!err_status && !thd->killed && !thd->is_fatal_error); + } while (!err_status && !thd->killed && !thd->is_fatal_error && + !thd->spcont->pause_state); #if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); @@ -1248,9 +1269,14 @@ sp_head::execute(THD *thd, bool merge_da_on_success) thd->restore_active_arena(&execute_arena, &backup_arena); - thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error + /* Only pop cursors when we're done with group aggregate running. */ + if (m_chistics.agg_type != GROUP_AGGREGATE || + (m_chistics.agg_type == GROUP_AGGREGATE && thd->spcont->quit_func)) + thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error /* Restore all saved */ + if (m_chistics.agg_type == GROUP_AGGREGATE) + thd->spcont->instr_ptr= ip; thd->server_status= (thd->server_status & ~status_backup_mask) | old_server_status; old_packet.swap(thd->packet); DBUG_ASSERT(thd->change_list.is_empty()); @@ -1361,6 +1387,16 @@ sp_head::execute(THD *thd, bool merge_da_on_success) m_recursion_level + 1)); m_first_instance->m_first_free_instance= this; + /* + This execution of the SP was aborted with an error (e.g. "Table not + found"). However it might still have consumed some numbers from the + thd->select_number counter. The next sp->exec() call must not use the + consumed numbers, so we remember the first free number (We know that + nobody will use it as this execution has stopped with an error). + */ + if (err_status) + set_select_number(thd->select_number); + DBUG_RETURN(err_status); } @@ -1652,18 +1688,16 @@ err_with_cleanup: bool sp_head::execute_function(THD *thd, Item **argp, uint argcount, - Field *return_value_fld) + Field *return_value_fld, sp_rcontext **func_ctx, + Query_arena *call_arena) { ulonglong UNINIT_VAR(binlog_save_options); bool need_binlog_call= FALSE; uint arg_no; sp_rcontext *octx = thd->spcont; - sp_rcontext *nctx = NULL; char buf[STRING_BUFFER_USUAL_SIZE]; String binlog_buf(buf, sizeof(buf), &my_charset_bin); bool err_status= FALSE; - MEM_ROOT call_mem_root; - Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP); Query_arena backup_arena; DBUG_ENTER("sp_head::execute_function"); DBUG_PRINT("info", ("function %s", m_name.str)); @@ -1696,23 +1730,25 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, TODO: we should create sp_rcontext once per command and reuse it on subsequent executions of a function/trigger. */ - init_sql_alloc(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0)); - thd->set_n_backup_active_arena(&call_arena, &backup_arena); - - if (!(nctx= rcontext_create(thd, return_value_fld, argp, argcount))) + if (!(*func_ctx)) { - thd->restore_active_arena(&call_arena, &backup_arena); - err_status= TRUE; - goto err_with_cleanup; - } + thd->set_n_backup_active_arena(call_arena, &backup_arena); - /* - We have to switch temporarily back to callers arena/memroot. - Function arguments belong to the caller and so the may reference - memory which they will allocate during calculation long after - this function call will be finished (e.g. in Item::cleanup()). - */ - thd->restore_active_arena(&call_arena, &backup_arena); + if (!(*func_ctx= rcontext_create(thd, return_value_fld, argp, argcount))) + { + thd->restore_active_arena(call_arena, &backup_arena); + err_status= TRUE; + goto err_with_cleanup; + } + + /* + We have to switch temporarily back to callers arena/memroot. + Function arguments belong to the caller and so the may reference + memory which they will allocate during calculation long after + this function call will be finished (e.g. in Item::cleanup()). + */ + thd->restore_active_arena(call_arena, &backup_arena); + } /* Pass arguments. */ for (arg_no= 0; arg_no < argcount; arg_no++) @@ -1720,7 +1756,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, /* Arguments must be fixed in Item_func_sp::fix_fields */ DBUG_ASSERT(argp[arg_no]->fixed); - if ((err_status= nctx->set_variable(thd, arg_no, &(argp[arg_no])))) + if ((err_status= (*func_ctx)->set_variable(thd, arg_no, &(argp[arg_no])))) goto err_with_cleanup; } @@ -1752,7 +1788,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, if (arg_no) binlog_buf.append(','); - Item *item= nctx->get_item(arg_no); + Item *item= (*func_ctx)->get_item(arg_no); str_value= item->type_handler()->print_item_value(thd, item, &str_value_holder); if (str_value) @@ -1762,7 +1798,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, } binlog_buf.append(')'); } - thd->spcont= nctx; + thd->spcont= *func_ctx; #ifndef NO_EMBEDDED_ACCESS_CHECKS Security_context *save_security_ctx; @@ -1803,11 +1839,11 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, sp_rcontext and allocate all these objects (and sp_rcontext itself) on it directly rather than juggle with arenas. */ - thd->set_n_backup_active_arena(&call_arena, &backup_arena); + thd->set_n_backup_active_arena(call_arena, &backup_arena); err_status= execute(thd, TRUE); - thd->restore_active_arena(&call_arena, &backup_arena); + thd->restore_active_arena(call_arena, &backup_arena); if (need_binlog_call) { @@ -1833,11 +1869,11 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, } } - if (!err_status) + if (!err_status && thd->spcont->quit_func) { /* We need result only in function but not in trigger */ - if (!nctx->is_return_value_set()) + if (!(*func_ctx)->is_return_value_set()) { my_error(ER_SP_NORETURNEND, MYF(0), m_name.str); err_status= TRUE; @@ -1849,9 +1885,6 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, #endif err_with_cleanup: - delete nctx; - call_arena.free_items(); - free_root(&call_mem_root, MYF(0)); thd->spcont= octx; /* @@ -2065,26 +2098,7 @@ sp_head::execute_procedure(THD *thd, List *args) if (!err_status) { - /* - Normally the counter is not reset between parsing and first execution, - but it is possible in case of error to have parsing on one CALL and - first execution (where VIEW will be parsed and added). So we store the - counter after parsing and restore it before execution just to avoid - repeating SELECT numbers. - */ - thd->select_number= m_select_number; - err_status= execute(thd, TRUE); - DBUG_PRINT("info", ("execute returned %d", (int) err_status)); - /* - This execution of the SP was aborted with an error (e.g. "Table not - found"). However it might still have consumed some numbers from the - thd->select_number counter. The next sp->exec() call must not use the - consumed numbers, so we remember the first free number (We know that - nobody will use it as this execution has stopped with an error). - */ - if (err_status) - set_select_number(thd->select_number); } if (save_log_general) @@ -2481,7 +2495,6 @@ sp_head::set_chistics(const st_sp_chistics &chistics) m_chistics.comment.length); } - void sp_head::set_info(longlong created, longlong modified, const st_sp_chistics &chistics, sql_mode_t sql_mode) @@ -4178,7 +4191,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) Query_arena backup_arena; DBUG_ENTER("sp_instr_cfetch::execute"); - res= c ? c->fetch(thd, &m_varlist) : -1; + res= c ? c->fetch(thd, &m_varlist, m_error_on_no_data) : -1; *nextp= m_ip+1; DBUG_RETURN(res); @@ -4217,6 +4230,35 @@ sp_instr_cfetch::print(String *str) } } +int +sp_instr_agg_cfetch::execute(THD *thd, uint *nextp) +{ + DBUG_ENTER("sp_instr_cfetch::execute"); + int res= 0; + if (!thd->spcont->instr_ptr) + { + *nextp= m_ip+1; + thd->spcont->instr_ptr= m_ip + 1; + } + else if (!thd->spcont->pause_state) + thd->spcont->pause_state= TRUE; + else + { + thd->spcont->pause_state= FALSE; + if (thd->server_status == SERVER_STATUS_LAST_ROW_SENT) + { + my_message(ER_SP_FETCH_NO_DATA, + ER_THD(thd, ER_SP_FETCH_NO_DATA), MYF(0)); + res= -1; + thd->spcont->quit_func= TRUE; + } + else + *nextp= m_ip + 1; + } + DBUG_RETURN(res); +} + + /* sp_instr_cursor_copy_struct class functions @@ -4778,7 +4820,7 @@ bool sp_head::add_for_loop_open_cursor(THD *thd, sp_pcontext *spcont, sp_instr_cfetch *instr_cfetch= new (thd->mem_root) sp_instr_cfetch(instructions(), - spcont, coffset); + spcont, coffset, false); if (instr_cfetch == NULL || add_instr(instr_cfetch)) return true; instr_cfetch->add_to_varlist(index); diff --git a/sql/sp_head.h b/sql/sp_head.h index 815a68c922f..04b67941226 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -164,7 +164,10 @@ public: /* Marks routines that have column type references: DECLARE a t1.a%TYPE; */ - HAS_COLUMN_TYPE_REFS= 8192 + HAS_COLUMN_TYPE_REFS= 8192, + /* Set if has FETCH GROUP NEXT ROW instr. Used to ensure that only + functions with AGGREGATE keyword use the instr. */ + HAS_AGGREGATE_INSTR= 16384 }; const Sp_handler *m_handler; @@ -197,6 +200,7 @@ public: enum_sp_suid_behaviour suid() const { return m_chistics.suid; } bool detistic() const { return m_chistics.detistic; } enum_sp_data_access daccess() const { return m_chistics.daccess; } + enum_sp_aggregate_type agg_type() const { return m_chistics.agg_type; } /** Is this routine being executed? */ @@ -343,7 +347,8 @@ public: GRANT_INFO *grant_info); bool - execute_function(THD *thd, Item **args, uint argcount, Field *return_fld); + execute_function(THD *thd, Item **args, uint argcount, Field *return_fld, + sp_rcontext **nctx, Query_arena *call_arena); bool execute_procedure(THD *thd, List *args); @@ -719,6 +724,10 @@ public: const LEX_CSTRING &table); void set_chistics(const st_sp_chistics &chistics); + inline void set_chistics_agg_type(enum enum_sp_aggregate_type type) + { + m_chistics.agg_type= type; + } void set_info(longlong created, longlong modified, const st_sp_chistics &chistics, sql_mode_t sql_mode); @@ -1795,8 +1804,8 @@ class sp_instr_cfetch : public sp_instr public: - sp_instr_cfetch(uint ip, sp_pcontext *ctx, uint c) - : sp_instr(ip, ctx), m_cursor(c) + sp_instr_cfetch(uint ip, sp_pcontext *ctx, uint c, bool error_on_no_data) + : sp_instr(ip, ctx), m_cursor(c), m_error_on_no_data(error_on_no_data) { m_varlist.empty(); } @@ -1817,9 +1826,36 @@ private: uint m_cursor; List m_varlist; + bool m_error_on_no_data; }; // class sp_instr_cfetch : public sp_instr +/* +This class is created for the special fetch instruction +FETCH GROUP NEXT ROW, used in the user-defined aggregate +functions +*/ + +class sp_instr_agg_cfetch : public sp_instr +{ + sp_instr_agg_cfetch(const sp_instr_cfetch &); /**< Prevent use of these */ + void operator=(sp_instr_cfetch &); + +public: + + sp_instr_agg_cfetch(uint ip, sp_pcontext *ctx) + : sp_instr(ip, ctx){} + + virtual ~sp_instr_agg_cfetch() + {} + + virtual int execute(THD *thd, uint *nextp); + + virtual void print(String *str){}; +}; // class sp_instr_agg_cfetch : public sp_instr + + + class sp_instr_error : public sp_instr { diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 6716aa54170..740941937e8 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -40,6 +40,7 @@ sp_rcontext::sp_rcontext(const sp_head *owner, Field *return_value_fld, bool in_sub_stmt) :end_partial_result_set(false), + pause_state(false), quit_func(false), instr_ptr(0), m_sp(owner), m_root_parsing_ctx(root_parsing_ctx), m_var_table(NULL), @@ -800,7 +801,13 @@ int sp_cursor::open_view_structure_only(THD *thd) if (!(thd->lex->limit_rows_examined= new (thd->mem_root) Item_uint(thd, 0))) return -1; thd->no_errors= true; // Suppress ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT + DBUG_ASSERT(!thd->killed); res= open(thd); + /* + The query possibly exited on LIMIT ROWS EXAMINED and set thd->killed. + Reset it now. + */ + thd->reset_killed(); thd->no_errors= thd_no_errors_save; thd->lex->limit_rows_examined= limit_rows_examined; return res; @@ -829,7 +836,7 @@ void sp_cursor::destroy() } -int sp_cursor::fetch(THD *thd, List *vars) +int sp_cursor::fetch(THD *thd, List *vars, bool error_on_no_data) { if (! server_side_cursor) { @@ -866,7 +873,7 @@ int sp_cursor::fetch(THD *thd, List *vars) if (! server_side_cursor->is_open()) { m_found= false; - if (thd->variables.sql_mode & MODE_ORACLE) + if (!error_on_no_data) return 0; my_message(ER_SP_FETCH_NO_DATA, ER_THD(thd, ER_SP_FETCH_NO_DATA), MYF(0)); return -1; diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 658972ece40..0999271ebde 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -178,6 +178,9 @@ public: /// (if one is found). Otherwise the client will hang due to a violation /// of the client/server protocol. bool end_partial_result_set; + bool pause_state; + bool quit_func; + uint instr_ptr; /// The stored program for which this runtime context is created. Used for /// checking if correct runtime context is used for variable handling. @@ -455,7 +458,7 @@ public: ulonglong fetch_count() const { return m_fetch_count; } - int fetch(THD *, List *vars); + int fetch(THD *, List *vars, bool error_on_no_data); bool export_structure(THD *thd, Row_definition_list *list); diff --git a/sql/spatial.cc b/sql/spatial.cc index 19035a4e882..2a07ef2ecbe 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -1041,7 +1041,7 @@ bool Gis_line_string::init_from_json(json_engine_t *je, bool er_on_3D, } if (n_points < 1) { - je->s.error= GEOJ_TOO_FEW_POINTS; + je->s.error= Geometry::GEOJ_TOO_FEW_POINTS; return TRUE; } wkb->write_at_position(np_pos, n_points); @@ -1440,6 +1440,15 @@ bool Gis_polygon::init_from_json(json_engine_t *je, bool er_on_3D, String *wkb) } n_linear_rings++; } + + if (je->s.error) + return TRUE; + + if (n_linear_rings == 0) + { + je->s.error= Geometry::GEOJ_EMPTY_COORDINATES; + return TRUE; + } wkb->write_at_position(lr_pos, n_linear_rings); return FALSE; } @@ -1945,6 +1954,14 @@ bool Gis_multi_point::init_from_json(json_engine_t *je, bool er_on_3D, n_points++; } + if (je->s.error) + return TRUE; + if (n_points == 0) + { + je->s.error= Geometry::GEOJ_EMPTY_COORDINATES; + return TRUE; + } + wkb->write_at_position(np_pos, n_points); return FALSE; } @@ -2214,6 +2231,15 @@ bool Gis_multi_line_string::init_from_json(json_engine_t *je, bool er_on_3D, n_line_strings++; } + if (je->s.error) + return TRUE; + + if (n_line_strings == 0) + { + je->s.error= Geometry::GEOJ_EMPTY_COORDINATES; + return TRUE; + } + wkb->write_at_position(ls_pos, n_line_strings); return FALSE; } @@ -2603,6 +2629,13 @@ bool Gis_multi_polygon::init_from_json(json_engine_t *je, bool er_on_3D, n_polygons++; } + if (je->s.error) + return TRUE; + if (n_polygons == 0) + { + je->s.error= Geometry::GEOJ_EMPTY_COORDINATES; + return TRUE; + } wkb->write_at_position(np_pos, n_polygons); return FALSE; } diff --git a/sql/spatial.h b/sql/spatial.h index 78e850dc2d7..901544b6916 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -256,6 +256,7 @@ public: GEOJ_TOO_FEW_POINTS= 2, GEOJ_POLYGON_NOT_CLOSED= 3, GEOJ_DIMENSION_NOT_SUPPORTED= 4, + GEOJ_EMPTY_COORDINATES= 5, }; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 78fd44c86a4..307a6badd70 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7375,9 +7375,8 @@ static bool grant_load(THD *thd, continue; } } - uint type= procs_priv.routine_type()->val_int(); - const Sp_handler *sph= Sp_handler::handler((stored_procedure_type) - type); + stored_procedure_type type= (stored_procedure_type)procs_priv.routine_type()->val_int(); + const Sp_handler *sph= Sp_handler::handler(type); if (!sph || !(hash= sph->get_priv_hash())) { sql_print_warning("'procs_priv' entry '%s' " @@ -7605,6 +7604,11 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, INSERT_ACL : SELECT_ACL); } + if (tl->with || + (tl->select_lex && + (tl->with= tl->select_lex->find_table_def_in_with_clauses(tl)))) + continue; + const ACL_internal_table_access *access= get_cached_table_access(&t_ref->grant.m_internal, t_ref->get_db_name(), diff --git a/sql/sql_alter.h b/sql/sql_alter.h index 5c651b0c91b..75435c7f275 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -408,13 +408,15 @@ public: /** Sql_cmd_alter_sequence represents the ALTER SEQUENCE statement. */ -class Sql_cmd_alter_sequence : public Sql_cmd +class Sql_cmd_alter_sequence : public Sql_cmd, + public DDL_options { public: /** Constructor, used to represent a ALTER TABLE statement. */ - Sql_cmd_alter_sequence() + Sql_cmd_alter_sequence(const DDL_options &options) + :DDL_options(options) {} ~Sql_cmd_alter_sequence() diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2a3a2903b35..4f4ea2a864c 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -878,6 +878,12 @@ void close_thread_table(THD *thd, TABLE **table_ptr) table->file->update_global_index_stats(); } + /* + This look is needed to allow THD::notify_shared_lock() to + traverse the thd->open_tables list without having to worry that + some of the tables are removed from under it + */ + mysql_mutex_lock(&thd->LOCK_thd_data); *table_ptr=table->next; mysql_mutex_unlock(&thd->LOCK_thd_data); @@ -1096,14 +1102,32 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, table= table->find_table_for_update(); - if (table->table && table->table->file->ht->db_type == DB_TYPE_MRG_MYISAM) + if (table->table && + table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) { TABLE_LIST *child; dup= NULL; /* Check duplicates of all merge children. */ - for (child= table->next_global; child && child->parent_l == table; + for (child= table->next_global; child; child= child->next_global) { + if (child->table && + child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) + continue; + + /* + Ensure that the child has one parent that is the table that is + updated. + */ + TABLE_LIST *tmp_parent= child; + while ((tmp_parent= tmp_parent->parent_l)) + { + if (tmp_parent == table) + break; + } + if (!tmp_parent) + break; + if ((dup= find_dup_table(thd, child, child->next_global, check_alias))) break; } @@ -1112,6 +1136,8 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, dup= find_dup_table(thd, table, table_list, check_alias); return dup; } + + /* Issue correct error message in case we found 2 duplicate tables which prevent some update operation @@ -4089,7 +4115,7 @@ restart: continue; /* Schema tables may not have a TABLE object here. */ - if (tbl->file->ht->db_type == DB_TYPE_MRG_MYISAM) + if (tbl->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) { /* MERGE tables need to access parent and child TABLE_LISTs. */ DBUG_ASSERT(tbl->pos_in_table_list == tables); @@ -4636,7 +4662,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type, */ DBUG_ASSERT(table_list->table); table= table_list->table; - if (table->file->ht->db_type == DB_TYPE_MRG_MYISAM) + if (table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) { /* A MERGE table must not come here. */ /* purecov: begin tested */ @@ -8449,84 +8475,6 @@ my_bool mysql_rm_tmp_tables(void) unireg support functions *****************************************************************************/ -/** - A callback to the server internals that is used to address - special cases of the locking protocol. - Invoked when acquiring an exclusive lock, for each thread that - has a conflicting shared metadata lock. - - This function: - - aborts waiting of the thread on a data lock, to make it notice - the pending exclusive lock and back off. - - if the thread is an INSERT DELAYED thread, sends it a KILL - signal to terminate it. - - @note This function does not wait for the thread to give away its - locks. Waiting is done outside for all threads at once. - - @param thd Current thread context - @param in_use The thread to wake up - @param needs_thr_lock_abort Indicates that to wake up thread - this call needs to abort its waiting - on table-level lock. - - @retval TRUE if the thread was woken up - @retval FALSE otherwise. - - @note It is one of two places where border between MDL and the - rest of the server is broken. -*/ - -bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use, - bool needs_thr_lock_abort) -{ - bool signalled= FALSE; - if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && - !in_use->killed) - { - in_use->set_killed(KILL_SYSTEM_THREAD); - mysql_mutex_lock(&in_use->mysys_var->mutex); - if (in_use->mysys_var->current_cond) - { - mysql_mutex_lock(in_use->mysys_var->current_mutex); - mysql_cond_broadcast(in_use->mysys_var->current_cond); - mysql_mutex_unlock(in_use->mysys_var->current_mutex); - } - mysql_mutex_unlock(&in_use->mysys_var->mutex); - signalled= TRUE; - } - - if (needs_thr_lock_abort) - { - mysql_mutex_lock(&in_use->LOCK_thd_data); - for (TABLE *thd_table= in_use->open_tables; - thd_table ; - thd_table= thd_table->next) - { - /* - Check for TABLE::needs_reopen() is needed since in some places we call - handler::close() for table instance (and set TABLE::db_stat to 0) - and do not remove such instances from the THD::open_tables - for some time, during which other thread can see those instances - (e.g. see partitioning code). - */ - if (!thd_table->needs_reopen()) - { - signalled|= mysql_lock_abort_for_thread(thd, thd_table); - if (thd && WSREP(thd) && wsrep_thd_is_BF(thd, true)) - { - WSREP_DEBUG("remove_table_from_cache: %llu", - (unsigned long long) thd->real_id); - wsrep_abort_thd((void *)thd, (void *)in_use, FALSE); - } - } - } - mysql_mutex_unlock(&in_use->LOCK_thd_data); - } - return signalled; -} - - int setup_ftfuncs(SELECT_LEX *select_lex) { List_iterator li(*(select_lex->ftfunc_list)), diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 94898628827..051b7366372 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4775,19 +4775,6 @@ extern "C" int thd_slave_thread(const MYSQL_THD thd) return(thd->slave_thread); } -/* Returns true for a worker thread in parallel replication. */ -extern "C" int thd_rpl_is_parallel(const MYSQL_THD thd) -{ - return thd->rgi_slave && thd->rgi_slave->is_parallel_exec; -} - -/* Returns high resolution timestamp for the start - of the current query. */ -extern "C" time_t thd_start_time(const MYSQL_THD thd) -{ - return thd->start_time; -} - /* Returns high resolution timestamp for the start of the current query. */ extern "C" unsigned long long thd_start_utime(const MYSQL_THD thd) @@ -5035,17 +5022,14 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd) extern "C" int thd_binlog_format(const MYSQL_THD thd) { -#ifdef WITH_WSREP if (WSREP(thd)) { /* for wsrep binlog format is meaningful also when binlogging is off */ - return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format); + return (int) thd->wsrep_binlog_format(); } -#endif /* WITH_WSREP */ if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG)) return (int) thd->variables.binlog_format; - else - return BINLOG_FORMAT_UNSPEC; + return BINLOG_FORMAT_UNSPEC; } extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all) diff --git a/sql/sql_class.h b/sql/sql_class.h index f7fbda7dc61..3cc114bd366 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5262,10 +5262,11 @@ public: select_unit(THD *thd_arg): select_result_interceptor(thd_arg), - curr_step(0), prev_step(0), curr_sel(UINT_MAX), - step(UNION_TYPE), intersect_mark(0), write_err(0), table(0), - records(0) - { tmp_table_param.init(); } + intersect_mark(0), table(0) + { + init(); + tmp_table_param.init(); + } int prepare(List &list, SELECT_LEX_UNIT *u); /** Do prepare() and prepare2() if they have been postponed until @@ -5289,6 +5290,14 @@ public: bool keep_row_order, uint hidden); TMP_TABLE_PARAM *get_tmp_table_param() { return &tmp_table_param; } + void init() + { + curr_step= prev_step= 0; + curr_sel= UINT_MAX; + step= UNION_TYPE; + write_err= 0; + records= 0; + } void change_select(); }; diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 487c2b3a0bb..ff80e198023 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -839,9 +839,10 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd, tbl; tbl= tbl->next_global) { - tbl->grant.privilege= with_table->grant.privilege; spec_tables_tail= tbl; } + if (check_table_access(thd, SELECT_ACL, spec_tables, FALSE, UINT_MAX, FALSE)) + goto err; if (spec_tables) { if (with_table->next_global) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 2c5f109e2ed..2ea2af73743 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -274,7 +274,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_I_List *order_list, ha_rows limit, ulonglong options, select_result *result) { - bool will_batch; + bool will_batch= FALSE; int error, loc_error; TABLE *table; SQL_SELECT *select=0; @@ -286,11 +286,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, bool return_error= 0; ha_rows deleted= 0; bool reverse= FALSE; + bool has_triggers; ORDER *order= (ORDER *) ((order_list && order_list->elements) ? order_list->first : NULL); SELECT_LEX *select_lex= &thd->lex->select_lex; killed_state killed_status= NOT_KILLED; THD::enum_binlog_query_type query_type= THD::ROW_QUERY_TYPE; + bool binlog_is_row; bool with_select= !select_lex->item_list.is_empty(); Explain_delete *explain; Delete_plan query_plan(thd->mem_root); @@ -413,9 +415,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, - We should not be binlogging this statement in row-based, and - there should be no delete triggers associated with the table. */ + + has_triggers= (table->triggers && + table->triggers->has_delete_triggers()); if (!with_select && !using_limit && const_cond_result && (!thd->is_current_stmt_binlog_format_row() && - !(table->triggers && table->triggers->has_delete_triggers())) + !has_triggers) && !table->versioned_by_sql()) { /* Update the table->file->stats.records number */ @@ -565,14 +570,59 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (!(select && select->quick)) status_var_increment(thd->status_var.delete_scan_count); + binlog_is_row= thd->is_current_stmt_binlog_format_row(); + DBUG_PRINT("info", ("binlog_is_row: %s", binlog_is_row ? "TRUE" : "FALSE")); + + /* + We can use direct delete (delete that is done silently in the handler) + if none of the following conditions are true: + - There are triggers + - There is binary logging + - There is a virtual not stored column in the WHERE clause + - ORDER BY or LIMIT + - As this requires the rows to be deleted in a specific order + - Note that Spider can handle ORDER BY and LIMIT in a cluster with + one data node. These conditions are therefore checked in + direct_delete_rows_init(). + + Direct delete does not require a WHERE clause + + Later we also ensure that we are only using one table (no sub queries) + */ + + if ((table->file->ha_table_flags() & HA_CAN_DIRECT_UPDATE_AND_DELETE) && + !has_triggers && !binlog_is_row && !with_select) + { + table->mark_columns_needed_for_delete(); + if (!table->check_virtual_columns_marked_for_read()) + { + DBUG_PRINT("info", ("Trying direct delete")); + if (select && select->cond && + (select->cond->used_tables() == table->map)) + { + DBUG_ASSERT(!table->file->pushed_cond); + if (!table->file->cond_push(select->cond)) + table->file->pushed_cond= select->cond; + } + if (!table->file->direct_delete_rows_init()) + { + /* Direct deleting is supported */ + DBUG_PRINT("info", ("Using direct delete")); + THD_STAGE_INFO(thd, stage_updating); + if (!(error= table->file->ha_direct_delete_rows(&deleted))) + error= -1; + goto terminate_delete; + } + } + } + if (query_plan.using_filesort) { - { Filesort fsort(order, HA_POS_ERROR, true, select); DBUG_ASSERT(query_plan.index == MAX_KEY); - Filesort_tracker *fs_tracker= + Filesort_tracker *fs_tracker= thd->lex->explain->get_upd_del_plan()->filesort_tracker; if (!(file_sort= filesort(thd, table, &fsort, fs_tracker))) @@ -611,15 +661,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (init_ftfuncs(thd, select_lex, 1)) goto got_error; - if (table->prepare_triggers_for_delete_stmt_or_event()) - { - will_batch= FALSE; - } - else - will_batch= !table->file->start_bulk_delete(); - table->mark_columns_needed_for_delete(); + if ((table->file->ha_table_flags() & HA_CAN_FORCE_BULK_DELETE) && + !table->prepare_triggers_for_delete_stmt_or_event()) + will_batch= !table->file->start_bulk_delete(); + if (with_select) { if (result->send_result_set_metadata(select_lex->item_list, @@ -727,6 +774,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, else break; } + terminate_delete: killed_status= thd->killed; if (killed_status != NOT_KILLED || thd->is_error()) @@ -815,6 +863,8 @@ cleanup: } delete file_sort; free_underlaid_joins(thd, select_lex); + if (table->file->pushed_cond) + table->file->cond_pop(); DBUG_RETURN(error >= 0 || thd->is_error()); /* Special exits */ @@ -836,7 +886,8 @@ send_nothing_and_leave: delete select; delete file_sort; free_underlaid_joins(thd, select_lex); - //table->set_keyread(false); + if (table->file->pushed_cond) + table->file->cond_pop(); DBUG_ASSERT(!return_error || thd->is_error() || thd->killed); DBUG_RETURN((return_error || thd->is_error() || thd->killed) ? 1 : 0); diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 660d68427d1..fed38a5f4f4 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -1813,9 +1813,9 @@ const char * extra_tag_text[]= "Using join buffer", // special handling - "const row not found", - "unique row not found", - "Impossible ON condition" + "Const row not found", + "Unique row not found", + "Impossible ON condition", }; diff --git a/sql/sql_get_diagnostics.cc b/sql/sql_get_diagnostics.cc index 76973b4daa2..e7ab6cc3c75 100644 --- a/sql/sql_get_diagnostics.cc +++ b/sql/sql_get_diagnostics.cc @@ -110,6 +110,9 @@ Diagnostics_information_item::set_value(THD *thd, Item **value) DBUG_ASSERT(srp); + /* GET DIAGNOSTICS is not allowed in prepared statements */ + DBUG_ASSERT(srp->get_item_param() == NULL); + /* Set variable/parameter value. */ rv= srp->set_value(thd, thd->spcont, value); diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 947c41e461e..eecfd5ad0b6 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -139,6 +139,48 @@ static void mysql_ha_hash_free(SQL_HANDLER *table) delete table; } +static void mysql_ha_close_childs(THD *thd, TABLE_LIST *current_table_list, + TABLE_LIST **next_global) +{ + TABLE_LIST *table_list; + DBUG_ENTER("mysql_ha_close_childs"); + DBUG_PRINT("info",("current_table_list: %p", current_table_list)); + DBUG_PRINT("info",("next_global: %p", *next_global)); + for (table_list = *next_global; table_list; table_list = *next_global) + { + *next_global = table_list->next_global; + DBUG_PRINT("info",("table_name: %s.%s", table_list->table->s->db.str, + table_list->table->s->table_name.str)); + DBUG_PRINT("info",("parent_l: %p", table_list->parent_l)); + if (table_list->parent_l == current_table_list) + { + DBUG_PRINT("info",("found child")); + TABLE *table = table_list->table; + if (table) + { + table->open_by_handler= 0; + if (!table->s->tmp_table) + { + (void) close_thread_table(thd, &table); + thd->mdl_context.release_lock(table_list->mdl_request.ticket); + } + else + { + thd->mark_tmp_table_as_free_for_reuse(table); + } + } + mysql_ha_close_childs(thd, table_list, next_global); + } + else + { + /* the end of child tables */ + *next_global = table_list; + break; + } + } + DBUG_VOID_RETURN; +} + /** Close a HANDLER table. @@ -155,11 +197,16 @@ static void mysql_ha_close_table(SQL_HANDLER *handler) { THD *thd= handler->thd; TABLE *table= handler->table; + TABLE_LIST *current_table_list= NULL, *next_global; /* check if table was already closed */ if (!table) return; + if ((next_global= table->file->get_next_global_for_child())) + current_table_list= next_global->parent_l; + + table->open_by_handler= 0; if (!table->s->tmp_table) { /* Non temporary table. */ @@ -170,15 +217,17 @@ static void mysql_ha_close_table(SQL_HANDLER *handler) } table->file->ha_index_or_rnd_end(); - table->open_by_handler= 0; close_thread_table(thd, &table); + if (current_table_list) + mysql_ha_close_childs(thd, current_table_list, &next_global); thd->mdl_context.release_lock(handler->mdl_request.ticket); } else { /* Must be a temporary table */ table->file->ha_index_or_rnd_end(); - table->open_by_handler= 0; + if (current_table_list) + mysql_ha_close_childs(thd, current_table_list, &next_global); thd->mark_tmp_table_as_free_for_reuse(table); } my_free(handler->lock); @@ -309,15 +358,24 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) goto err; } - if (tables->mdl_request.ticket && - thd->mdl_context.has_lock(mdl_savepoint, tables->mdl_request.ticket)) + DBUG_PRINT("info",("clone_tickets start")); + for (TABLE_LIST *table_list= tables; table_list; + table_list= table_list->next_global) { + DBUG_PRINT("info",("table_list %s.%s", table_list->table->s->db.str, + table_list->table->s->table_name.str)); + if (table_list->mdl_request.ticket && + thd->mdl_context.has_lock(mdl_savepoint, table_list->mdl_request.ticket)) + { + DBUG_PRINT("info",("clone_tickets")); /* The ticket returned is within a savepoint. Make a copy. */ - error= thd->mdl_context.clone_ticket(&tables->mdl_request); - tables->table->mdl_ticket= tables->mdl_request.ticket; + error= thd->mdl_context.clone_ticket(&table_list->mdl_request); + table_list->table->mdl_ticket= table_list->mdl_request.ticket; if (error) goto err; } + } + DBUG_PRINT("info",("clone_tickets end")); if (! reopen) { @@ -378,26 +436,37 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) /* Restore the state. */ thd->set_open_tables(backup_open_tables); + DBUG_PRINT("info",("set_lock_duration start")); if (sql_handler->mdl_request.ticket) { thd->mdl_context.set_lock_duration(sql_handler->mdl_request.ticket, MDL_EXPLICIT); thd->mdl_context.set_needs_thr_lock_abort(TRUE); } + for (TABLE_LIST *table_list= tables->next_global; table_list; + table_list= table_list->next_global) + { + DBUG_PRINT("info",("table_list %s.%s", table_list->table->s->db.str, + table_list->table->s->table_name.str)); + if (table_list->mdl_request.ticket) + { + thd->mdl_context.set_lock_duration(table_list->mdl_request.ticket, + MDL_EXPLICIT); + thd->mdl_context.set_needs_thr_lock_abort(TRUE); + } + } + DBUG_PRINT("info",("set_lock_duration end")); - /* - Assert that the above check prevents opening of views and merge tables. - For temporary tables, TABLE::next can be set even if only one table - was opened for HANDLER as it is used to link them together. - */ - DBUG_ASSERT(sql_handler->table->next == NULL || - sql_handler->table->s->tmp_table); /* If it's a temp table, don't reset table->query_id as the table is being used by this handler. For non-temp tables we use this flag in asserts. */ - table->open_by_handler= 1; + for (TABLE_LIST *table_list= tables; table_list; + table_list= table_list->next_global) + { + table_list->table->open_by_handler= 1; + } /* Safety, cleanup the pointer to satisfy MDL assertions. */ tables->mdl_request.ticket= NULL; @@ -707,8 +776,14 @@ retry: { int lock_error; - if (handler->lock->lock_count > 0) - handler->lock->locks[0]->type= handler->lock->locks[0]->org_type; + THR_LOCK_DATA **pos,**end; + for (pos= handler->lock->locks, + end= handler->lock->locks + handler->lock->lock_count; + pos < end; + pos++) + { + pos[0]->type= pos[0]->org_type; + } /* save open_tables state */ TABLE* backup_open_tables= thd->open_tables; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4a42d8dc156..950635d74e3 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2530,8 +2530,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) The thread could be killed with an error message if di->handle_inserts() or di->open_and_lock_table() fails. The thread could be killed without an error message if - killed using mysql_notify_thread_having_shared_lock() or - kill_delayed_threads_for_table(). + killed using kill_delayed_threads_for_table(). */ if (!thd.is_error()) my_message(ER_QUERY_INTERRUPTED, ER_THD(&thd, ER_QUERY_INTERRUPTED), diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index f6894c6727d..12c278dae85 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -1325,6 +1325,10 @@ public: JOIN_CACHE_BKA(JOIN *j, JOIN_TAB *tab, uint flags, JOIN_CACHE *prev) :JOIN_CACHE(j, tab, prev), mrr_mode(flags) {} + JOIN_CACHE_BKA(JOIN_CACHE_BKA *bka) + :JOIN_CACHE(bka->join, bka->join_tab, bka->prev_cache), + mrr_mode(bka->mrr_mode) {} + uchar **get_curr_association_ptr() { return &curr_association; } /* Initialize the BKA cache */ @@ -1421,6 +1425,10 @@ public: JOIN_CACHE_BKAH(JOIN *j, JOIN_TAB *tab, uint flags, JOIN_CACHE *prev) :JOIN_CACHE_BNLH(j, tab, prev), mrr_mode(flags) {} + JOIN_CACHE_BKAH(JOIN_CACHE_BKAH *bkah) + :JOIN_CACHE_BNLH(bkah->join, bkah->join_tab, bkah->prev_cache), + mrr_mode(bkah->mrr_mode) {} + uchar **get_curr_association_ptr() { return &curr_matching_chain; } /* Initialize the BKAH cache */ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6f79d443345..db22669d287 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -829,6 +829,7 @@ void lex_end_stage2(LEX *lex) /* Reset LEX_MASTER_INFO */ lex->mi.reset(lex->sql_command == SQLCOM_CHANGE_MASTER); + delete_dynamic(&lex->delete_gtid_domain); DBUG_VOID_RETURN; } @@ -3060,6 +3061,10 @@ LEX::LEX() INITIAL_LEX_PLUGIN_LIST_SIZE, 0); reset_query_tables_list(TRUE); mi.init(); + init_dynamic_array2(&delete_gtid_domain, sizeof(ulong*), + gtid_domain_static_buffer, + initial_gtid_domain_buffer_size, + initial_gtid_domain_buffer_size, 0); } @@ -5623,6 +5628,35 @@ sp_variable *LEX::sp_add_for_loop_variable(THD *thd, const LEX_CSTRING *name, } +bool LEX::sp_for_loop_implicit_cursor_statement(THD *thd, + Lex_for_loop_bounds_st *bounds, + sp_lex_cursor *cur) +{ + Item *item; + DBUG_ASSERT(sphead); + LEX_CSTRING name= {STRING_WITH_LEN("[implicit_cursor]") }; + if (sp_declare_cursor(thd, &name, cur, NULL, true)) + return true; + DBUG_ASSERT(thd->lex == this); + if (!(bounds->m_index= new (thd->mem_root) sp_assignment_lex(thd, this))) + return true; + bounds->m_index->sp_lex_in_use= true; + sphead->reset_lex(thd, bounds->m_index); + DBUG_ASSERT(thd->lex != this); + if (!(item= new (thd->mem_root) Item_field(thd, + thd->lex->current_context(), + NullS, NullS, &name))) + return true; + bounds->m_index->set_item_and_free_list(item, NULL); + if (thd->lex->sphead->restore_lex(thd)) + return true; + DBUG_ASSERT(thd->lex == this); + bounds->m_direction= 1; + bounds->m_upper_bound= NULL; + bounds->m_implicit_cursor= true; + return false; +} + sp_variable * LEX::sp_add_for_loop_cursor_variable(THD *thd, const LEX_CSTRING *name, @@ -5834,7 +5868,7 @@ bool LEX::sp_for_loop_cursor_finalize(THD *thd, const Lex_for_loop_st &loop) { sp_instr_cfetch *instr= new (thd->mem_root) sp_instr_cfetch(sphead->instructions(), - spcont, loop.m_cursor_offset); + spcont, loop.m_cursor_offset, false); if (instr == NULL || sphead->add_instr(instr)) return true; instr->add_to_varlist(loop.m_index); @@ -6481,6 +6515,11 @@ Item *LEX::create_and_link_Item_trigger_field(THD *thd, Item_param *LEX::add_placeholder(THD *thd, const LEX_CSTRING *name, const char *start, const char *end) { + if (!thd->m_parser_state->m_lip.stmt_prepare_mode) + { + thd->parse_error(ER_SYNTAX_ERROR, start); + return NULL; + } if (!parsing_options.allows_variable) { my_error(ER_VIEW_SELECT_VARIABLE, MYF(0)); @@ -7321,7 +7360,8 @@ bool LEX::sp_add_cfetch(THD *thd, const LEX_CSTRING *name) return true; } i= new (thd->mem_root) - sp_instr_cfetch(sphead->instructions(), spcont, offset); + sp_instr_cfetch(sphead->instructions(), spcont, offset, + !(thd->variables.sql_mode & MODE_ORACLE)); if (i == NULL || sphead->add_instr(i)) return true; return false; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index a58bd9725ea..94fdc6442ab 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -226,6 +226,13 @@ enum enum_sp_data_access SP_MODIFIES_SQL_DATA }; +enum enum_sp_aggregate_type +{ + DEFAULT_AGGREGATE= 0, + NOT_AGGREGATE, + GROUP_AGGREGATE +}; + const LEX_STRING sp_data_access_name[]= { { C_STRING_WITH_LEN("") }, @@ -1305,6 +1312,7 @@ struct st_sp_chistics enum enum_sp_suid_behaviour suid; bool detistic; enum enum_sp_data_access daccess; + enum enum_sp_aggregate_type agg_type; void init() { bzero(this, sizeof(*this)); } void set(const st_sp_chistics &other) { *this= other; } bool read_from_mysql_proc_row(THD *thd, TABLE *table); @@ -2976,6 +2984,13 @@ public: */ Item *limit_rows_examined; ulonglong limit_rows_examined_cnt; + /** + Holds a set of domain_ids for deletion at FLUSH..DELETE_DOMAIN_ID + */ + DYNAMIC_ARRAY delete_gtid_domain; + static const ulong initial_gtid_domain_buffer_size= 16; + ulong gtid_domain_static_buffer[initial_gtid_domain_buffer_size]; + inline void set_limit_rows_examined() { if (limit_rows_examined) @@ -3503,6 +3518,9 @@ public: uint coffset, sp_assignment_lex *param_lex, Item_args *parameters); + bool sp_for_loop_implicit_cursor_statement(THD *thd, + Lex_for_loop_bounds_st *bounds, + sp_lex_cursor *cur); bool sp_for_loop_cursor_condition_test(THD *thd, const Lex_for_loop_st &loop); bool sp_for_loop_cursor_finalize(THD *thd, const Lex_for_loop_st &); diff --git a/sql/sql_list.h b/sql/sql_list.h index 422b7943aa9..c708ed6d2f9 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -622,6 +622,10 @@ struct ilink { DBUG_ASSERT(prev != 0 && next != 0); } + inline void assert_not_linked() + { + DBUG_ASSERT(prev == 0 && next == 0); + } virtual ~ilink() { unlink(); } /*lint -e1740 */ }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 590fe245d7d..a255c477cee 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3735,6 +3735,14 @@ mysql_execute_command(THD *thd) ulong privileges_requested= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL; + /* + The same function must be called for DML commands + when CTEs are supported in DML statements + */ + res= check_dependencies_in_with_clauses(thd->lex->with_clauses_list); + if (res) + break; + if (all_tables) res= check_table_access(thd, privileges_requested, @@ -6290,6 +6298,24 @@ finish: THD_STAGE_INFO(thd, stage_rollback); trans_rollback_stmt(thd); } +#ifdef WITH_WSREP + else if (thd->spcont && + (thd->wsrep_conflict_state == MUST_ABORT || + thd->wsrep_conflict_state == CERT_FAILURE)) + { + /* + The error was cleared, but THD was aborted by wsrep and + wsrep_conflict_state is still set accordingly. This + situation is expected if we are running a stored procedure + that declares a handler that catches ER_LOCK_DEADLOCK error. + In which case the error may have been cleared in method + sp_rcontext::handle_sql_condition(). + */ + trans_rollback_stmt(thd); + thd->wsrep_conflict_state= NO_CONFLICT; + thd->killed= NOT_KILLED; + } +#endif /* WITH_WSREP */ else { /* If commit fails, we should be able to reset the OK status. */ diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 9478db8e6d5..462829a255b 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1155,6 +1155,7 @@ static bool plugin_add(MEM_ROOT *tmp_root, report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf); goto err; } + if (plugin_maturity_map[plugin->maturity] < plugin_maturity) { char buf[256]; @@ -1167,6 +1168,14 @@ static bool plugin_add(MEM_ROOT *tmp_root, report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf); goto err; } + else if (plugin_maturity_map[plugin->maturity] < SERVER_MATURITY_LEVEL) + { + sql_print_warning("Plugin '%s' is of maturity level %s while the server is %s", + tmp.name.str, + plugin_maturity_names[plugin->maturity], + plugin_maturity_names[SERVER_MATURITY_LEVEL]); + } + tmp.plugin= plugin; tmp.ref_count= 0; tmp.state= PLUGIN_IS_UNINITIALIZED; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 775717fe62b..243d9d524c2 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -489,24 +489,23 @@ static ulong get_param_length(uchar **packet, ulong len) (i.e. when input types altered) and for all subsequent executions we don't read any values for this. - @param param parameter item @param pos input data buffer @param len length of data in the buffer */ -static void set_param_tiny(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_tiny(uchar **pos, ulong len) { #ifndef EMBEDDED_LIBRARY if (len < 1) return; #endif int8 value= (int8) **pos; - param->set_int(param->unsigned_flag ? (longlong) ((uint8) value) : - (longlong) value, 4); + set_int(unsigned_flag ? (longlong) ((uint8) value) : + (longlong) value, 4); *pos+= 1; } -static void set_param_short(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_short(uchar **pos, ulong len) { int16 value; #ifndef EMBEDDED_LIBRARY @@ -516,12 +515,12 @@ static void set_param_short(Item_param *param, uchar **pos, ulong len) #else shortget(value, *pos); #endif - param->set_int(param->unsigned_flag ? (longlong) ((uint16) value) : - (longlong) value, 6); + set_int(unsigned_flag ? (longlong) ((uint16) value) : + (longlong) value, 6); *pos+= 2; } -static void set_param_int32(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_int32(uchar **pos, ulong len) { int32 value; #ifndef EMBEDDED_LIBRARY @@ -531,12 +530,12 @@ static void set_param_int32(Item_param *param, uchar **pos, ulong len) #else longget(value, *pos); #endif - param->set_int(param->unsigned_flag ? (longlong) ((uint32) value) : - (longlong) value, 11); + set_int(unsigned_flag ? (longlong) ((uint32) value) : + (longlong) value, 11); *pos+= 4; } -static void set_param_int64(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_int64(uchar **pos, ulong len) { longlong value; #ifndef EMBEDDED_LIBRARY @@ -546,11 +545,11 @@ static void set_param_int64(Item_param *param, uchar **pos, ulong len) #else longlongget(value, *pos); #endif - param->set_int(value, 21); + set_int(value, 21); *pos+= 8; } -static void set_param_float(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_float(uchar **pos, ulong len) { float data; #ifndef EMBEDDED_LIBRARY @@ -560,11 +559,11 @@ static void set_param_float(Item_param *param, uchar **pos, ulong len) #else floatget(data, *pos); #endif - param->set_double((double) data); + set_double((double) data); *pos+= 4; } -static void set_param_double(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_double(uchar **pos, ulong len) { double data; #ifndef EMBEDDED_LIBRARY @@ -574,14 +573,14 @@ static void set_param_double(Item_param *param, uchar **pos, ulong len) #else doubleget(data, *pos); #endif - param->set_double((double) data); + set_double((double) data); *pos+= 8; } -static void set_param_decimal(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_decimal(uchar **pos, ulong len) { ulong length= get_param_length(pos, len); - param->set_decimal((char*)*pos, length); + set_decimal((char*)*pos, length); *pos+= length; } @@ -597,7 +596,7 @@ static void set_param_decimal(Item_param *param, uchar **pos, ulong len) @todo Add warning 'Data truncated' here */ -static void set_param_time(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_time(uchar **pos, ulong len) { MYSQL_TIME tm; ulong length= get_param_length(pos, len); @@ -624,11 +623,11 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len) } else set_zero_time(&tm, MYSQL_TIMESTAMP_TIME); - param->set_time(&tm, MYSQL_TIMESTAMP_TIME, MAX_TIME_FULL_WIDTH); + set_time(&tm, MYSQL_TIMESTAMP_TIME, MAX_TIME_FULL_WIDTH); *pos+= length; } -static void set_param_datetime(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_datetime(uchar **pos, ulong len) { MYSQL_TIME tm; ulong length= get_param_length(pos, len); @@ -654,13 +653,12 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len) } else set_zero_time(&tm, MYSQL_TIMESTAMP_DATETIME); - param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME, - MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); + set_time(&tm, MYSQL_TIMESTAMP_DATETIME, MAX_DATETIME_WIDTH); *pos+= length; } -static void set_param_date(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_date(uchar **pos, ulong len) { MYSQL_TIME tm; ulong length= get_param_length(pos, len); @@ -679,8 +677,7 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len) } else set_zero_time(&tm, MYSQL_TIMESTAMP_DATE); - param->set_time(&tm, MYSQL_TIMESTAMP_DATE, - MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); + set_time(&tm, MYSQL_TIMESTAMP_DATE, MAX_DATE_WIDTH); *pos+= length; } @@ -689,7 +686,7 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len) @todo Add warning 'Data truncated' here */ -void set_param_time(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_time(uchar **pos, ulong len) { MYSQL_TIME tm= *((MYSQL_TIME*)*pos); tm.hour+= tm.day * 24; @@ -701,145 +698,81 @@ void set_param_time(Item_param *param, uchar **pos, ulong len) tm.minute= 59; tm.second= 59; } - param->set_time(&tm, MYSQL_TIMESTAMP_TIME, - MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); - + set_time(&tm, MYSQL_TIMESTAMP_TIME, MAX_TIME_WIDTH); } -void set_param_datetime(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_datetime(uchar **pos, ulong len) { MYSQL_TIME tm= *((MYSQL_TIME*)*pos); tm.neg= 0; - - param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME, - MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); + set_time(&tm, MYSQL_TIMESTAMP_DATETIME, MAX_DATETIME_WIDTH); } -void set_param_date(Item_param *param, uchar **pos, ulong len) +void Item_param::set_param_date(uchar **pos, ulong len) { MYSQL_TIME *to= (MYSQL_TIME*)*pos; - - param->set_time(to, MYSQL_TIMESTAMP_DATE, - MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); + set_time(to, MYSQL_TIMESTAMP_DATE, MAX_DATE_WIDTH); } #endif /*!EMBEDDED_LIBRARY*/ -static void set_param_str_or_null(Item_param *param, uchar **pos, ulong len, - bool empty_string_is_null) +void Item_param::set_param_str(uchar **pos, ulong len) { ulong length= get_param_length(pos, len); - if (length == 0 && empty_string_is_null) - param->set_null(); + if (length == 0 && m_empty_string_is_null) + set_null(); else { if (length > len) length= len; - param->set_str((const char *) *pos, length); + /* + We use &my_charset_bin here. Conversion and setting real character + sets will be done in Item_param::convert_str_value(), after the + original value is appended to the query used for logging. + */ + set_str((const char *) *pos, length, &my_charset_bin, &my_charset_bin); *pos+= length; } } -static void set_param_str(Item_param *param, uchar **pos, ulong len) -{ - set_param_str_or_null(param, pos, len, false); -} - - -/* - set_param_str_empty_is_null : bind empty string as null value - when sql_mode=MODE_EMPTY_STRING_IS_NULL -*/ -static void set_param_str_empty_is_null(Item_param *param, uchar **pos, - ulong len) -{ - set_param_str_or_null(param, pos, len, true); -} - - #undef get_param_length -static void setup_one_conversion_function(THD *thd, Item_param *param, - uchar param_type) + +void Item_param::setup_conversion(THD *thd, uchar param_type) { - switch (param_type) { - case MYSQL_TYPE_TINY: - param->set_param_func= set_param_tiny; - break; - case MYSQL_TYPE_SHORT: - param->set_param_func= set_param_short; - break; - case MYSQL_TYPE_LONG: - param->set_param_func= set_param_int32; - break; - case MYSQL_TYPE_LONGLONG: - param->set_param_func= set_param_int64; - break; - case MYSQL_TYPE_FLOAT: - param->set_param_func= set_param_float; - break; - case MYSQL_TYPE_DOUBLE: - param->set_param_func= set_param_double; - break; - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: - param->set_param_func= set_param_decimal; - break; - case MYSQL_TYPE_TIME: - param->set_param_func= set_param_time; - break; - case MYSQL_TYPE_DATE: - param->set_param_func= set_param_date; - break; - case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_TIMESTAMP: - param->set_param_func= set_param_datetime; - break; - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_BLOB: - param->set_param_func= set_param_str; - param->value.cs_info.character_set_of_placeholder= &my_charset_bin; - param->value.cs_info.character_set_client= - thd->variables.character_set_client; - DBUG_ASSERT(thd->variables.character_set_client); - param->value.cs_info.final_character_set_of_str_value= &my_charset_bin; - break; - default: - /* - The client library ensures that we won't get any other typecodes - except typecodes above and typecodes for string types. Marking - label as 'default' lets us to handle malformed packets as well. - */ - { - CHARSET_INFO *fromcs= thd->variables.character_set_client; - CHARSET_INFO *tocs= thd->variables.collation_connection; - uint32 dummy_offset; + const Type_handler *h= + Type_handler::get_handler_by_field_type((enum_field_types) param_type); + /* + The client library ensures that we won't get any unexpected typecodes + in the bound parameter. Translating unknown typecodes to + &type_handler_string lets us to handle malformed packets as well. + */ + if (!h) + h= &type_handler_string; + set_handler(h); + h->Item_param_setup_conversion(thd, this); +} - param->value.cs_info.character_set_of_placeholder= fromcs; - param->value.cs_info.character_set_client= fromcs; - /* - Setup source and destination character sets so that they - are different only if conversion is necessary: this will - make later checks easier. - */ - param->value.cs_info.final_character_set_of_str_value= - String::needs_conversion(0, fromcs, tocs, &dummy_offset) ? - tocs : fromcs; +void Item_param::setup_conversion_blob(THD *thd) +{ + value.cs_info.character_set_of_placeholder= &my_charset_bin; + value.cs_info.character_set_client= thd->variables.character_set_client; + DBUG_ASSERT(thd->variables.character_set_client); + value.cs_info.final_character_set_of_str_value= &my_charset_bin; + m_empty_string_is_null= thd->variables.sql_mode & MODE_EMPTY_STRING_IS_NULL; +} - param->set_param_func= - (thd->variables.sql_mode & MODE_EMPTY_STRING_IS_NULL) ? - set_param_str_empty_is_null : set_param_str; - /* - Exact value of max_length is not known unless data is converted to - charset of connection, so we have to set it later. - */ - } - } - param->set_handler_by_field_type((enum enum_field_types) param_type); + +void Item_param::setup_conversion_string(THD *thd, CHARSET_INFO *fromcs) +{ + value.cs_info.set(thd, fromcs); + m_empty_string_is_null= thd->variables.sql_mode & MODE_EMPTY_STRING_IS_NULL; + /* + Exact value of max_length is not known unless data is converted to + charset of connection, so we have to set it later. + */ } #ifndef EMBEDDED_LIBRARY @@ -903,14 +836,13 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); + param->set_param_func(&read_pos, (uint) (data_end - read_pos)); if (param->has_no_value()) DBUG_RETURN(1); if (param->limit_clause_param && !param->has_int_value()) { - param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS); - if (!param->unsigned_flag && param->value.integer < 0) + if (param->set_limit_clause_param(param->val_int())) DBUG_RETURN(1); } } @@ -958,7 +890,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); + param->set_param_func(&read_pos, (uint) (data_end - read_pos)); if (param->has_no_value()) DBUG_RETURN(1); } @@ -1002,7 +934,7 @@ static bool insert_bulk_params(Prepared_statement *stmt, case STMT_INDICATOR_NONE: if ((*read_pos) >= data_end) DBUG_RETURN(1); - param->set_param_func(param, read_pos, (uint) (data_end - (*read_pos))); + param->set_param_func(read_pos, (uint) (data_end - (*read_pos))); if (param->has_no_value()) DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) @@ -1048,7 +980,7 @@ static bool set_conversion_functions(Prepared_statement *stmt, typecode= sint2korr(read_pos); read_pos+= 2; (**it).unsigned_flag= MY_TEST(typecode & signed_bit); - setup_one_conversion_function(thd, *it, (uchar) (typecode & 0xff)); + (*it)->setup_conversion(thd, (uchar) (typecode & 0xff)); } *data= read_pos; DBUG_RETURN(0); @@ -1103,7 +1035,7 @@ static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query) for (; it < end; ++it, ++client_param) { Item_param *param= *it; - setup_one_conversion_function(thd, param, client_param->buffer_type); + param->setup_conversion(thd, client_param->buffer_type); if (!param->has_long_data_value()) { if (*client_param->is_null) @@ -1112,7 +1044,7 @@ static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query) { uchar *buff= (uchar*) client_param->buffer; param->unsigned_flag= client_param->is_unsigned; - param->set_param_func(param, &buff, + param->set_param_func(&buff, client_param->length ? *client_param->length : client_param->buffer_length); @@ -1139,7 +1071,7 @@ static bool emb_insert_params_with_log(Prepared_statement *stmt, String *query) for (; it < end; ++it, ++client_param) { Item_param *param= *it; - setup_one_conversion_function(thd, param, client_param->buffer_type); + param->setup_conversion(thd, client_param->buffer_type); if (!param->has_long_data_value()) { if (*client_param->is_null) @@ -1148,7 +1080,7 @@ static bool emb_insert_params_with_log(Prepared_statement *stmt, String *query) { uchar *buff= (uchar*)client_param->buffer; param->unsigned_flag= client_param->is_unsigned; - param->set_param_func(param, &buff, + param->set_param_func(&buff, client_param->length ? *client_param->length : client_param->buffer_length); @@ -1281,12 +1213,6 @@ insert_params_from_actual_params_with_log(Prepared_statement *stmt, { Item_param *param= *it; Item *ps_param= param_it++; - /* - We have to call the setup_one_conversion_function() here to set - the parameter's members that might be needed further - (e.g. value.cs_info.character_set_client is used in the query_val_str()). - */ - setup_one_conversion_function(thd, param, param->field_type()); if (ps_param->save_in_param(thd, param)) DBUG_RETURN(1); diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 057d1a9f46c..93db089b24a 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -153,7 +153,10 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, tmp_write_to_binlog= 0; if (mysql_bin_log.is_open()) { - if (mysql_bin_log.rotate_and_purge(true)) + DYNAMIC_ARRAY *drop_gtid_domain= + (thd && (thd->lex->delete_gtid_domain.elements > 0)) ? + &thd->lex->delete_gtid_domain : NULL; + if (mysql_bin_log.rotate_and_purge(true, drop_gtid_domain)) *write_to_binlog= -1; if (WSREP_ON) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 839b98dc785..d978a2d58ee 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -30,7 +30,7 @@ #include #include "rpl_handler.h" #include "debug_sync.h" - +#include "log.h" // get_gtid_list_event enum enum_gtid_until_state { GTID_UNTIL_NOT_DONE, @@ -875,72 +875,6 @@ get_binlog_list(MEM_ROOT *memroot) DBUG_RETURN(current_list); } -/* - Find the Gtid_list_log_event at the start of a binlog. - - NULL for ok, non-NULL error message for error. - - If ok, then the event is returned in *out_gtid_list. This can be NULL if we - get back to binlogs written by old server version without GTID support. If - so, it means we have reached the point to start from, as no GTID events can - exist in earlier binlogs. -*/ -static const char * -get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list) -{ - Format_description_log_event init_fdle(BINLOG_VERSION); - Format_description_log_event *fdle; - Log_event *ev; - const char *errormsg = NULL; - - *out_gtid_list= NULL; - - if (!(ev= Log_event::read_log_event(cache, 0, &init_fdle, - opt_master_verify_checksum)) || - ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) - { - if (ev) - delete ev; - return "Could not read format description log event while looking for " - "GTID position in binlog"; - } - - fdle= static_cast(ev); - - for (;;) - { - Log_event_type typ; - - ev= Log_event::read_log_event(cache, 0, fdle, opt_master_verify_checksum); - if (!ev) - { - errormsg= "Could not read GTID list event while looking for GTID " - "position in binlog"; - break; - } - typ= ev->get_type_code(); - if (typ == GTID_LIST_EVENT) - break; /* Done, found it */ - if (typ == START_ENCRYPTION_EVENT) - { - if (fdle->start_decryption((Start_encryption_log_event*) ev)) - errormsg= "Could not set up decryption for binlog."; - } - delete ev; - if (typ == ROTATE_EVENT || typ == STOP_EVENT || - typ == FORMAT_DESCRIPTION_EVENT || typ == START_ENCRYPTION_EVENT) - continue; /* Continue looking */ - - /* We did not find any Gtid_list_log_event, must be old binlog. */ - ev= NULL; - break; - } - - delete fdle; - *out_gtid_list= static_cast(ev); - return errormsg; -} - /* Check if every GTID requested by the slave is contained in this (or a later) diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 4105bdddf4e..8d9a127bca7 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -81,7 +81,6 @@ int rpl_append_gtid_state(String *dest, bool use_binlog); int rpl_load_gtid_state(slave_connection_state *state, bool use_binlog); bool rpl_gtid_pos_check(THD *thd, char *str, size_t len); bool rpl_gtid_pos_update(THD *thd, char *str, size_t len); - #else struct LOAD_FILE_IO_CACHE : public IO_CACHE { }; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 87c56b3e3f5..e0e160b45aa 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2767,20 +2767,22 @@ bool JOIN::make_aggr_tables_info() /* All optimization is done. Check if we can use the storage engines - group by handler to evaluate the group by + group by handler to evaluate the group by. + Some storage engines, like spider can also do joins, group by and + distinct in the engine, so we do this for all queries, not only + GROUP BY queries. */ - if (tables_list && (tmp_table_param.sum_func_count || group_list) && - !procedure) + if (tables_list && !procedure) { /* At the moment we only support push down for queries where all tables are in the same storage engine */ TABLE_LIST *tbl= tables_list; - handlerton *ht= tbl && tbl->table ? tbl->table->file->ht : 0; + handlerton *ht= tbl && tbl->table ? tbl->table->file->partition_ht() : 0; for (tbl= tbl->next_local; ht && tbl; tbl= tbl->next_local) { - if (!tbl->table || tbl->table->file->ht != ht) + if (!tbl->table || tbl->table->file->partition_ht() != ht) ht= 0; } @@ -4572,6 +4574,7 @@ make_join_statistics(JOIN *join, List &tables_list, keyuse->val->is_null() && keyuse->null_rejecting) { s->type= JT_CONST; + s->table->const_table= 1; mark_as_null_row(table); found_const_table_map|= table->map; join->const_table_map|= table->map; @@ -4677,6 +4680,7 @@ make_join_statistics(JOIN *join, List &tables_list, s->type= JT_CONST; join->const_table_map|=table->map; set_position(join,const_count++,s,start_keyuse); + /* create_ref_for_key will set s->table->const_table */ if (create_ref_for_key(join, s, start_keyuse, FALSE, found_const_table_map)) goto error; @@ -4882,12 +4886,12 @@ make_join_statistics(JOIN *join, List &tables_list, join->const_table_map|= s->table->map; set_position(join,const_count++,s,(KEYUSE*) 0); s->type= JT_CONST; + s->table->const_table= 1; if (*s->on_expr_ref) { /* Generate empty row */ s->info= ET_IMPOSSIBLE_ON_CONDITION; found_const_table_map|= s->table->map; - s->type= JT_CONST; mark_as_null_row(s->table); // All fields are NULL } } @@ -13231,7 +13235,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { - if (order->item[0]->has_subquery()) + if (order->item[0]->with_subquery()) { /* Delay the evaluation of constant ORDER and/or GROUP expressions that @@ -13269,8 +13273,37 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, can be used without tmp. table. */ bool can_subst_to_first_table= false; + bool first_is_in_sjm_nest= false; + if (first_is_base_table) + { + TABLE_LIST *tbl_for_first= + join->join_tab[join->const_tables].table->pos_in_table_list; + first_is_in_sjm_nest= tbl_for_first->sj_mat_info && + tbl_for_first->sj_mat_info->is_used; + } + /* + Currently we do not employ the optimization that uses multiple + equalities for ORDER BY to remove tmp table in the case when + the first table happens to be the result of materialization of + a semi-join nest ( <=> first_is_in_sjm_nest == true). + + When a semi-join nest is materialized and scanned to look for + possible matches in the remaining tables for every its row + the fields from the result of materialization are copied + into the record buffers of tables from the semi-join nest. + So these copies are used to access the remaining tables rather + than the fields from the result of materialization. + + Unfortunately now this so-called 'copy back' technique is + supported only if the rows are scanned with the rr_sequential + function, but not with other rr_* functions that are employed + when the result of materialization is required to be sorted. + + TODO: either to support 'copy back' technique for the above case, + or to get rid of this technique altogether. + */ if (optimizer_flag(join->thd, OPTIMIZER_SWITCH_ORDERBY_EQ_PROP) && - first_is_base_table && + first_is_base_table && !first_is_in_sjm_nest && order->item[0]->real_item()->type() == Item::FIELD_ITEM && join->cond_equal) { @@ -19925,6 +19958,7 @@ join_read_system(JOIN_TAB *tab) { if (error != HA_ERR_END_OF_FILE) return report_error(table, error); + table->const_table= 1; mark_as_null_row(tab->table); empty_record(table); // Make empty record return -1; @@ -22533,7 +22567,7 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort) table->file->ha_end_keyread(); if (tab->type == JT_FT) - table->file->ft_end(); + table->file->ha_ft_end(); else table->file->ha_index_or_rnd_end(); diff --git a/sql/sql_select.h b/sql/sql_select.h index 36b1669b49f..659bc4e7827 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1436,7 +1436,7 @@ public: table_count= 0; top_join_tab_count= 0; const_tables= 0; - const_table_map= 0; + const_table_map= found_const_table_map= 0; aggr_tables= 0; eliminated_tables= 0; join_list= 0; diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 1af37fe1fad..de4cd3522a5 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -113,7 +113,7 @@ bool sequence_definition::check_and_adjust(bool set_reserved_until) /* To ensure that cache * real_increment will never overflow */ max_increment= (real_increment ? - labs(real_increment) : + llabs(real_increment) : MAX_AUTO_INCREMENT_VALUE); if (max_value >= start && @@ -852,10 +852,10 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) if (check_grant(thd, ALTER_ACL, first_table, FALSE, 1, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ - if (lex->check_exists) + if (if_exists()) thd->push_internal_handler(&no_such_table_handler); error= open_and_lock_tables(thd, first_table, FALSE, 0); - if (lex->check_exists) + if (if_exists()) { trapped_errors= no_such_table_handler.safely_trapped_errors(); thd->pop_internal_handler(); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 0b417017423..dd4d9178b35 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5326,12 +5326,13 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, if (share->tmp_table == SYSTEM_TMP_TABLE) table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs); - else if (share->tmp_table) - table->field[3]->store(STRING_WITH_LEN("LOCAL TEMPORARY"), cs); else if (share->table_type == TABLE_TYPE_SEQUENCE) table->field[3]->store(STRING_WITH_LEN("SEQUENCE"), cs); else + { + DBUG_ASSERT(share->tmp_table == NO_TMP_TABLE); table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs); + } for (int i= 4; i < 20; i++) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 24b9fa619ca..ba5eb36173b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5235,7 +5235,7 @@ static bool vers_reset_alter_copy(THD *thd, TABLE *table) READ_RECORD info; int error= 0; bool will_batch= false; - uint dup_key_found= 0; + ha_rows dup_key_found= 0; if (init_read_record(&info, thd, table, NULL, NULL, 0, 1, true)) goto err; diff --git a/sql/sql_type.cc b/sql/sql_type.cc index d1e4641253c..b4860176c0c 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -4392,7 +4392,7 @@ bool Type_handler:: bool Type_handler:: Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const { - item->fix_length_and_dec_str(); + item->fix_length_and_dec_generic(); return false; } @@ -4405,6 +4405,14 @@ bool Type_handler_numeric:: } +bool Type_handler_string_result:: + Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const +{ + item->fix_length_and_dec_str(); + return false; +} + + bool Type_handler:: Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const { @@ -5060,7 +5068,6 @@ bool Type_handler_real_result:: { param->unsigned_flag= attr->unsigned_flag; param->set_double(val->value.m_double); - param->set_handler(&type_handler_double); return false; } @@ -5072,8 +5079,7 @@ bool Type_handler_int_result:: const st_value *val) const { param->unsigned_flag= attr->unsigned_flag; - param->set_int(val->value.m_longlong, MY_INT64_NUM_DECIMAL_DIGITS); - param->set_handler(&type_handler_longlong); + param->set_int(val->value.m_longlong, attr->max_length); return false; } @@ -5086,7 +5092,6 @@ bool Type_handler_decimal_result:: { param->unsigned_flag= attr->unsigned_flag; param->set_decimal(&val->m_decimal, attr->unsigned_flag); - param->set_handler(&type_handler_newdecimal); return false; } @@ -5098,13 +5103,14 @@ bool Type_handler_string_result:: const st_value *val) const { param->unsigned_flag= false; - param->value.cs_info.set(thd, attr->collation.collation); + param->setup_conversion_string(thd, attr->collation.collation); /* Exact value of max_length is not known unless data is converted to charset of connection, so we have to set it later. */ - param->set_handler(&type_handler_varchar); - return param->set_str(val->m_string.ptr(), val->m_string.length()); + return param->set_str(val->m_string.ptr(), val->m_string.length(), + attr->collation.collation, + attr->collation.collation); } @@ -5116,7 +5122,6 @@ bool Type_handler_temporal_result:: { param->unsigned_flag= attr->unsigned_flag; param->set_time(&val->value.m_time, attr->max_length, attr->decimals); - param->set_handler(this); return false; } @@ -5129,10 +5134,10 @@ bool Type_handler_geometry:: const st_value *val) const { param->unsigned_flag= false; - param->value.cs_info.set(thd, &my_charset_bin); - param->set_handler(&type_handler_geometry); + param->setup_conversion_blob(thd); param->set_geometry_type(attr->uint_geometry_type()); - return param->set_str(val->m_string.ptr(), val->m_string.length()); + return param->set_str(val->m_string.ptr(), val->m_string.length(), + &my_charset_bin, &my_charset_bin); } #endif @@ -5518,3 +5523,139 @@ Item *Type_handler_long_blob:: } /***************************************************************************/ + +void Type_handler_string_result::Item_param_setup_conversion(THD *thd, + Item_param *param) + const +{ + param->setup_conversion_string(thd, thd->variables.character_set_client); +} + + +void Type_handler_blob_common::Item_param_setup_conversion(THD *thd, + Item_param *param) + const +{ + param->setup_conversion_blob(thd); +} + + +void Type_handler_tiny::Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const +{ + param->set_param_tiny(pos, len); +} + + +void Type_handler_short::Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const +{ + param->set_param_short(pos, len); +} + + +void Type_handler_long::Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const +{ + param->set_param_int32(pos, len); +} + + +void Type_handler_longlong::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_int64(pos, len); +} + + +void Type_handler_float::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_float(pos, len); +} + + +void Type_handler_double::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_double(pos, len); +} + + +void Type_handler_decimal_result::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_decimal(pos, len); +} + + +void Type_handler_string_result::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_str(pos, len); +} + + +void Type_handler_time_common::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_time(pos, len); +} + + +void Type_handler_date_common::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_date(pos, len); +} + + +void Type_handler_datetime_common::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_datetime(pos, len); +} + + +void Type_handler_timestamp_common::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_param_datetime(pos, len); +} + + +void Type_handler::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_null(); // Not possible type code in the client-server protocol +} + + +void Type_handler_typelib::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_null(); // Not possible type code in the client-server protocol +} + + +#ifdef HAVE_SPATIAL +void Type_handler_geometry::Item_param_set_param_func(Item_param *param, + uchar **pos, + ulong len) const +{ + param->set_null(); // Not possible type code in the client-server protocol +} +#endif + +/***************************************************************************/ diff --git a/sql/sql_type.h b/sql/sql_type.h index 3c52c70289a..c400420586e 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -804,6 +804,9 @@ public: virtual uint32 max_display_length(const Item *item) const= 0; virtual uint32 calc_pack_length(uint32 length) const= 0; virtual bool Item_save_in_value(Item *item, st_value *value) const= 0; + virtual void Item_param_setup_conversion(THD *thd, Item_param *) const {} + virtual void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; virtual bool Item_param_set_from_value(THD *thd, Item_param *param, const Type_all_attributes *attr, @@ -1422,6 +1425,8 @@ public: const Type_cast_attributes &attr) const; uint Item_decimal_precision(const Item *item) const; bool Item_save_in_value(Item *item, st_value *value) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; bool Item_param_set_from_value(THD *thd, Item_param *param, const Type_all_attributes *attr, @@ -1658,6 +1663,9 @@ public: } uint Item_decimal_precision(const Item *item) const; bool Item_save_in_value(Item *item, st_value *value) const; + void Item_param_setup_conversion(THD *thd, Item_param *) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; bool Item_param_set_from_value(THD *thd, Item_param *param, const Type_all_attributes *attr, @@ -1716,6 +1724,7 @@ public: MYSQL_TIME *, ulonglong fuzzydate) const; bool Item_func_between_fix_length_and_dec(Item_func_between *func) const; longlong Item_func_between_val_int(Item_func_between *func) const; + bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const; in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const; bool Item_func_in_fix_comparator_compatible_types(THD *thd, @@ -1783,6 +1792,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -1810,6 +1821,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -1840,6 +1853,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -1871,6 +1886,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2005,6 +2022,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2035,6 +2054,8 @@ public: const Record_addr &addr, const Type_all_attributes &attr, TABLE *table) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2079,6 +2100,8 @@ public: bool set_comparator_func(Arg_comparator *cmp) const; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const; in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2162,6 +2185,8 @@ public: Type_handler_hybrid_field_type *, Type_all_attributes *atrr, Item **items, uint nitems) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; class Type_handler_date: public Type_handler_date_common @@ -2236,6 +2261,8 @@ public: Type_handler_hybrid_field_type *, Type_all_attributes *atrr, Item **items, uint nitems) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2316,6 +2343,8 @@ public: Type_handler_hybrid_field_type *, Type_all_attributes *atrr, Item **items, uint nitems) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2584,6 +2613,7 @@ public: Type_handler_hybrid_field_type *, Type_all_attributes *atrr, Item **items, uint nitems) const; + void Item_param_setup_conversion(THD *thd, Item_param *) const; }; @@ -2685,6 +2715,8 @@ public: { return false; // Materialization does not work with GEOMETRY columns } + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; bool Item_param_set_from_value(THD *thd, Item_param *param, const Type_all_attributes *attr, @@ -2764,6 +2796,8 @@ public: const handler *file, const Schema_specification_st *schema) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2832,6 +2866,10 @@ public: Type_handler_hybrid_field_type(const Type_handler_hybrid_field_type *other) :m_type_handler(other->m_type_handler), m_vers_trx_id(other->m_vers_trx_id) { } + void swap(Type_handler_hybrid_field_type &other) + { + swap_variables(const Type_handler *, m_type_handler, other.m_type_handler); + } const Type_handler *type_handler() const { return m_type_handler; } enum_field_types real_field_type() const { diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ecc2a54bdd8..b3a7227678d 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -303,7 +303,8 @@ int select_union_recursive::send_data(List &values) { int rc= select_unit::send_data(values); - if (write_err != HA_ERR_FOUND_DUPP_KEY && + if (rc == 0 && + write_err != HA_ERR_FOUND_DUPP_KEY && write_err != HA_ERR_FOUND_DUPP_UNIQUE) { int err; @@ -1360,6 +1361,9 @@ bool st_select_lex_unit::exec() if (saved_error) DBUG_RETURN(saved_error); + if (union_result) + union_result->init(); + if (uncacheable || !item || !item->assigned() || describe) { if (!fake_select_lex && !(with_element && with_element->is_recursive)) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 96aec4b9afa..d14d50267fd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -275,11 +275,12 @@ int mysql_update(THD *thd, { bool using_limit= limit != HA_POS_ERROR; bool safe_update= thd->variables.option_bits & OPTION_SAFE_UPDATES; - bool used_key_is_modified= FALSE, transactional_table, will_batch; + bool used_key_is_modified= FALSE, transactional_table; + bool will_batch= FALSE; bool can_compare_record; int res; int error, loc_error; - uint dup_key_found; + ha_rows dup_key_found; bool need_sort= TRUE; bool reverse= FALSE; #ifndef NO_EMBEDDED_ACCESS_CHECKS @@ -296,6 +297,7 @@ int mysql_update(THD *thd, ulonglong id; List all_fields; killed_state killed_status= NOT_KILLED; + bool has_triggers, binlog_is_row, do_direct_update= FALSE; Update_plan query_plan(thd->mem_root); Explain_update *explain; TABLE_LIST *update_source_table; @@ -311,7 +313,7 @@ int mysql_update(THD *thd, if (open_tables(thd, &table_list, &table_count, 0)) DBUG_RETURN(1); - //Prepare views so they are handled correctly. + /* Prepare views so they are handled correctly */ if (mysql_handle_derived(thd->lex, DT_INIT)) DBUG_RETURN(1); @@ -543,7 +545,6 @@ int mysql_update(THD *thd, query_plan.using_io_buffer= true; } - /* Ok, we have generated a query plan for the UPDATE. - if we're running EXPLAIN UPDATE, goto produce explain output @@ -558,10 +559,68 @@ int mysql_update(THD *thd, DBUG_EXECUTE_IF("show_explain_probe_update_exec_start", dbug_serve_apcs(thd, 1);); - + + has_triggers= (table->triggers && + (table->triggers->has_triggers(TRG_EVENT_UPDATE, + TRG_ACTION_BEFORE) || + table->triggers->has_triggers(TRG_EVENT_UPDATE, + TRG_ACTION_AFTER))); + DBUG_PRINT("info", ("has_triggers: %s", has_triggers ? "TRUE" : "FALSE")); + binlog_is_row= thd->is_current_stmt_binlog_format_row(); + DBUG_PRINT("info", ("binlog_is_row: %s", binlog_is_row ? "TRUE" : "FALSE")); + if (!(select && select->quick)) status_var_increment(thd->status_var.update_scan_count); + /* + We can use direct update (update that is done silently in the handler) + if none of the following conditions are true: + - There are triggers + - There is binary logging + - using_io_buffer + - This means that the partition changed or the key we want + to use for scanning the table is changed + - ignore is set + - Direct updates don't return the number of ignored rows + - There is a virtual not stored column in the WHERE clause + - Changing a field used by a stored virtual column, which + would require the column to be recalculated. + - ORDER BY or LIMIT + - As this requires the rows to be updated in a specific order + - Note that Spider can handle ORDER BY and LIMIT in a cluster with + one data node. These conditions are therefore checked in + direct_update_rows_init(). + + Direct update does not require a WHERE clause + + Later we also ensure that we are only using one table (no sub queries) + */ + if ((table->file->ha_table_flags() & HA_CAN_DIRECT_UPDATE_AND_DELETE) && + !has_triggers && !binlog_is_row && + !query_plan.using_io_buffer && !ignore && + !table->check_virtual_columns_marked_for_read() && + !table->check_virtual_columns_marked_for_write()) + { + DBUG_PRINT("info", ("Trying direct update")); + if (select && select->cond && + (select->cond->used_tables() == table->map)) + { + DBUG_ASSERT(!table->file->pushed_cond); + if (!table->file->cond_push(select->cond)) + table->file->pushed_cond= select->cond; + } + + if (!table->file->info_push(INFO_KIND_UPDATE_FIELDS, &fields) && + !table->file->info_push(INFO_KIND_UPDATE_VALUES, &values) && + !table->file->direct_update_rows_init()) + { + do_direct_update= TRUE; + + /* Direct update is not using_filesort and is not using_io_buffer */ + goto update_begin; + } + } + if (query_plan.using_filesort || query_plan.using_io_buffer) { /* @@ -721,6 +780,7 @@ int mysql_update(THD *thd, } } +update_begin: if (ignore) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); @@ -740,11 +800,20 @@ int mysql_update(THD *thd, transactional_table= table->file->has_transactions(); thd->abort_on_warning= !ignore && thd->is_strict_mode(); - if (table->prepare_triggers_for_update_stmt_or_event()) + + if (do_direct_update) { - will_batch= FALSE; + /* Direct updating is supported */ + DBUG_PRINT("info", ("Using direct update")); + table->reset_default_fields(); + if (!(error= table->file->ha_direct_update_rows(&updated))) + error= -1; + found= updated; + goto update_end; } - else + + if ((table->file->ha_table_flags() & HA_CAN_FORCE_BULK_UPDATE) && + !table->prepare_triggers_for_update_stmt_or_event()) will_batch= !table->file->start_bulk_update(); /* @@ -838,6 +907,7 @@ int mysql_update(THD *thd, call then it should be included in the count of dup_key_found and error should be set to 0 (only if these errors are ignored). */ + DBUG_PRINT("info", ("Batched update")); error= table->file->ha_bulk_update_row(table->record[1], table->record[0], &dup_key_found); @@ -1002,6 +1072,8 @@ int mysql_update(THD *thd, updated-= dup_key_found; if (will_batch) table->file->end_bulk_update(); + +update_end: table->file->try_semi_consistent_read(0); if (!transactional_table && updated > 0) @@ -1060,6 +1132,11 @@ int mysql_update(THD *thd, DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table); free_underlaid_joins(thd, select_lex); delete file_sort; + if (table->file->pushed_cond) + { + table->file->pushed_cond= 0; + table->file->cond_pop(); + } /* If LAST_INSERT_ID(X) was used, report X */ id= thd->arg_of_last_insert_id_function ? @@ -1091,7 +1168,6 @@ int mysql_update(THD *thd, *found_return= found; *updated_return= updated; - if (thd->lex->analyze_stmt) goto emit_explain_and_leave; @@ -1102,6 +1178,8 @@ err: delete file_sort; free_underlaid_joins(thd, select_lex); table->file->ha_end_keyread(); + if (table->file->pushed_cond) + table->file->cond_pop(); thd->abort_on_warning= 0; DBUG_RETURN(1); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 551ce4020af..6e34e1974a1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -896,10 +896,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %parse-param { THD *thd } %lex-param { THD *thd } /* - Currently there are 123 shift/reduce conflicts. + Currently there are 125 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 123 +%expect 125 /* Comments for TOKENS. @@ -1058,6 +1058,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token DEFINER_SYM %token DELAYED_SYM %token DELAY_KEY_WRITE_SYM +%token DELETE_DOMAIN_ID_SYM %token DELETE_SYM /* SQL-2003-R */ %token DENSE_RANK_SYM %token DESC /* SQL-2003-N */ @@ -1659,11 +1660,15 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text IDENT_sys TEXT_STRING_sys TEXT_STRING_literal opt_component key_cache_name - sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty - opt_constraint constraint opt_ident + sp_opt_label BIN_NUM TEXT_STRING_filesystem ident_or_empty + opt_constraint constraint opt_ident ident_table_alias sp_decl_ident sp_block_label opt_place opt_db +%type + label_ident + sp_label + %type TEXT_STRING NCHAR_STRING @@ -1711,7 +1716,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type order_dir lock_option udf_type opt_local opt_no_write_to_binlog - opt_temporary all_or_any opt_distinct + opt_temporary all_or_any opt_distinct opt_glimit_clause opt_ignore_leaves fulltext_options union_option opt_not select_derived_init transaction_access_mode_types @@ -1804,6 +1809,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type assignment_source_lex assignment_source_expr + for_loop_bound_expr %type cursor_actual_parameters @@ -1850,7 +1856,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type precision opt_precision float_options -%type keyword keyword_sp +%type keyword keyword_sp keyword_alias keyword_sp_data_type keyword_sp_not_data_type @@ -1942,7 +1948,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_field_or_var_spec fields_or_vars opt_load_data_set_spec view_list_opt view_list view_select trigger_tail sp_tail sf_tail event_tail - udf_tail create_function_tail + udf_tail create_function_tail create_aggregate_function_tail install uninstall partition_entry binlog_base64_event normal_key_options normal_key_opts all_key_opt spatial_key_options fulltext_key_options normal_key_opt @@ -1956,7 +1962,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); parse_vcol_expr vcol_opt_specifier vcol_opt_attribute vcol_opt_attribute_list vcol_attribute opt_serial_attribute opt_serial_attribute_list serial_attribute - explainable_command opt_lock_wait_timeout asrow_attribute + explainable_command + opt_lock_wait_timeout + opt_delete_gtid_domain + asrow_attribute END_OF_INPUT %type call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt @@ -1982,6 +1991,9 @@ END_OF_INPUT %type sp_decls sp_decl sp_decl_body sp_decl_variable_list %type sp_name %type sp_param_name sp_param_name_and_type +%type sp_for_loop_index_and_bounds +%type sp_for_loop_bounds +%type opt_sp_for_loop_direction %type sp_opt_inout %type index_hint_type %type index_hint_clause normal_join inner_join @@ -2667,8 +2679,16 @@ create: event_tail { } | create_or_replace definer FUNCTION_SYM - { Lex->create_info.set($1); } - sf_tail + { + Lex->create_info.set($1); + } + sf_tail_not_aggregate + { } + | create_or_replace definer AGGREGATE_SYM FUNCTION_SYM + { + Lex->create_info.set($1); + } + sf_tail_aggregate { } | create_or_replace no_definer FUNCTION_SYM { Lex->create_info.set($1); } @@ -2677,9 +2697,8 @@ create: | create_or_replace no_definer AGGREGATE_SYM FUNCTION_SYM { Lex->create_info.set($1); - Lex->udf.type= UDFTYPE_AGGREGATE; } - udf_tail + create_aggregate_function_tail { } | create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list opt_require_clause opt_resource_options @@ -2706,11 +2725,36 @@ create: { } ; +sf_tail_not_aggregate: + sf_tail + { + if (Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR) + { + my_yyabort_error((ER_NOT_AGGREGATE_FUNCTION, MYF(0), "")); + } + Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE); + } + +sf_tail_aggregate: + sf_tail + { + if (!(Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR)) + { + my_yyabort_error((ER_INVALID_AGGREGATE_FUNCTION, MYF(0), "")); + } + Lex->sphead->set_chistics_agg_type(GROUP_AGGREGATE); + } + create_function_tail: - sf_tail { } + sf_tail_not_aggregate { } | udf_tail { Lex->udf.type= UDFTYPE_FUNCTION; } ; +create_aggregate_function_tail: + sf_tail_aggregate + { } + | udf_tail { Lex->udf.type= UDFTYPE_AGGREGATE; } + ; opt_sequence: /* empty */ { } | sequence_defs @@ -3978,6 +4022,22 @@ assignment_source_expr: } ; +for_loop_bound_expr: + assignment_source_lex + { + Lex->sphead->reset_lex(thd, $1); + } + expr + { + DBUG_ASSERT($1 == thd->lex); + $$= $1; + $$->sp_lex_in_use= true; + $$->set_item_and_free_list($3, NULL); + if ($$->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + ; + cursor_actual_parameters: assignment_source_expr { @@ -4024,7 +4084,19 @@ sp_proc_stmt_fetch_head: ; sp_proc_stmt_fetch: - sp_proc_stmt_fetch_head sp_fetch_list { } + sp_proc_stmt_fetch_head sp_fetch_list { } + | FETCH_SYM GROUP_SYM NEXT_SYM ROW_SYM + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + lex->sphead->m_flags|= sp_head::HAS_AGGREGATE_INSTR; + sp_instr_agg_cfetch *i= + new (thd->mem_root) sp_instr_agg_cfetch(sp->instructions(), + lex->spcont); + if (i == NULL || + sp->add_instr(i)) + MYSQL_YYABORT; + } ; sp_proc_stmt_close: @@ -4277,13 +4349,17 @@ else_clause_opt: | ELSE sp_proc_stmts1 ; +sp_label: + label_ident ':' { $$= $1; } + ; + sp_opt_label: /* Empty */ { $$= null_clex_str; } | label_ident { $$= $1; } ; sp_block_label: - label_ident ':' + sp_label { if (Lex->spcont->block_label_declare(&$1)) MYSQL_YYABORT; @@ -4337,6 +4413,43 @@ sp_unlabeled_block_not_atomic: } ; +/* This adds one shift/reduce conflict */ +opt_sp_for_loop_direction: + /* Empty */ { $$= 1; } + | REVERSE_SYM { $$= -1; } + ; + +sp_for_loop_index_and_bounds: + ident sp_for_loop_bounds + { + if (Lex->sp_for_loop_declarations(thd, &$$, &$1, $2)) + MYSQL_YYABORT; + } + ; + +sp_for_loop_bounds: + IN_SYM opt_sp_for_loop_direction for_loop_bound_expr + DOT_DOT_SYM for_loop_bound_expr + { + $$.m_direction= $2; + $$.m_index= $3; + $$.m_upper_bound= $5; + $$.m_implicit_cursor= false; + } + | IN_SYM opt_sp_for_loop_direction for_loop_bound_expr + { + $$.m_direction= $2; + $$.m_index= $3; + $$.m_upper_bound= NULL; + $$.m_implicit_cursor= false; + } + | IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')' + { + if (Lex->sp_for_loop_implicit_cursor_statement(thd, &$$, $4)) + MYSQL_YYABORT; + } + ; + loop_body: sp_proc_stmts1 END LOOP_SYM { @@ -4396,14 +4509,14 @@ pop_sp_loop_label: ; sp_labeled_control: - label_ident ':' LOOP_SYM + sp_label LOOP_SYM { if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; } loop_body pop_sp_loop_label { } - | label_ident ':' WHILE_SYM + | sp_label WHILE_SYM { if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; @@ -4411,7 +4524,33 @@ sp_labeled_control: } while_body pop_sp_loop_label { } - | label_ident ':' REPEAT_SYM + | sp_label FOR_SYM + { + // See "The FOR LOOP statement" comments in sql_lex.cc + Lex->sp_block_init(thd); // The outer DECLARE..BEGIN..END block + } + sp_for_loop_index_and_bounds + { + if (Lex->sp_push_loop_label(thd, &$1)) // The inner WHILE block + MYSQL_YYABORT; + if (Lex->sp_for_loop_condition_test(thd, $4)) + MYSQL_YYABORT; + } + DO_SYM + sp_proc_stmts1 + END FOR_SYM + { + if (Lex->sp_for_loop_finalize(thd, $4)) + MYSQL_YYABORT; + } + pop_sp_loop_label // The inner WHILE block + { + Lex_spblock tmp; + tmp.curs= MY_TEST($4.m_implicit_cursor); + if (Lex->sp_block_finalize(thd, tmp)) // The outer DECLARE..BEGIN..END + MYSQL_YYABORT; + } + | sp_label REPEAT_SYM { if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; @@ -4440,6 +4579,32 @@ sp_unlabeled_control: { Lex->sp_pop_loop_empty_label(thd); } + | FOR_SYM + { + // See "The FOR LOOP statement" comments in sql_lex.cc + if (Lex->maybe_start_compound_statement(thd)) + MYSQL_YYABORT; + Lex->sp_block_init(thd); // The outer DECLARE..BEGIN..END block + } + sp_for_loop_index_and_bounds + { + if (Lex->sp_push_loop_empty_label(thd)) // The inner WHILE block + MYSQL_YYABORT; + if (Lex->sp_for_loop_condition_test(thd, $3)) + MYSQL_YYABORT; + } + DO_SYM + sp_proc_stmts1 + END FOR_SYM + { + Lex_spblock tmp; + tmp.curs= MY_TEST($3.m_implicit_cursor); + if (Lex->sp_for_loop_finalize(thd, $3)) + MYSQL_YYABORT; + Lex->sp_pop_loop_empty_label(thd); // The inner WHILE block + if (Lex->sp_block_finalize(thd, tmp)) // The outer DECLARE..BEGIN..END + MYSQL_YYABORT; + } | REPEAT_SYM { if (Lex->sp_push_loop_empty_label(thd)) @@ -7602,7 +7767,7 @@ alter: Lex->create_info.set($2); Lex->sql_command= SQLCOM_ALTER_USER; } - | ALTER SEQUENCE_SYM opt_if_exists_table_element + | ALTER SEQUENCE_SYM opt_if_exists { LEX *lex= Lex; lex->name= null_clex_str; @@ -7625,7 +7790,7 @@ alter: sequence_defs { /* Create a generic ALTER SEQUENCE statment. */ - Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence(); + Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3); if (Lex->m_sql_cmd == NULL) MYSQL_YYABORT; } @@ -10931,16 +11096,22 @@ sum_expr: | GROUP_CONCAT_SYM '(' opt_distinct { Select->in_sum_expr++; } expr_list opt_gorder_clause - opt_gconcat_separator + opt_gconcat_separator opt_glimit_clause ')' { SELECT_LEX *sel= Select; sel->in_sum_expr--; $$= new (thd->mem_root) - Item_func_group_concat(thd, Lex->current_context(), $3, $5, - sel->gorder_list, $7); + Item_func_group_concat(thd, Lex->current_context(), + $3, $5, + sel->gorder_list, $7, $8, + sel->select_limit, + sel->offset_limit); if ($$ == NULL) MYSQL_YYABORT; + sel->select_limit= NULL; + sel->offset_limit= NULL; + sel->explicit_limit= 0; $5->empty(); sel->gorder_list.empty(); } @@ -11230,6 +11401,48 @@ gorder_list: { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } ; +opt_glimit_clause: + /* empty */ { $$ = 0; } + | glimit_clause { $$ = 1; } + ; + +glimit_clause_init: + LIMIT{} + ; + +glimit_clause: + glimit_clause_init glimit_options + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + ; + +glimit_options: + limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= 0; + sel->explicit_limit= 1; + } + | limit_option ',' limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $3; + sel->offset_limit= $1; + sel->explicit_limit= 1; + } + | limit_option OFFSET_SYM limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= $3; + sel->explicit_limit= 1; + } + ; + + + in_sum_expr: opt_all { @@ -12005,7 +12218,7 @@ table_alias: opt_table_alias: /* empty */ { $$=0; } - | table_alias ident + | table_alias ident_table_alias { $$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING)); if ($$ == NULL) @@ -13993,7 +14206,7 @@ flush_option: { Lex->type|= REFRESH_GENERAL_LOG; } | SLOW LOGS_SYM { Lex->type|= REFRESH_SLOW_LOG; } - | BINARY LOGS_SYM + | BINARY LOGS_SYM opt_delete_gtid_domain { Lex->type|= REFRESH_BINARY_LOG; } | RELAY LOGS_SYM optional_connection_name { @@ -14050,6 +14263,24 @@ opt_table_list: | table_list {} ; +opt_delete_gtid_domain: + /* empty */ {} + | DELETE_DOMAIN_ID_SYM '=' '(' delete_domain_id_list ')' + {} + ; +delete_domain_id_list: + /* Empty */ + | delete_domain_id + | delete_domain_id_list ',' delete_domain_id + ; + +delete_domain_id: + ulong_num + { + insert_dynamic(&Lex->delete_gtid_domain, (uchar*) &($1)); + } + ; + optional_flush_tables_arguments: /* empty */ {$$= 0;} | AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; } @@ -14934,6 +15165,16 @@ TEXT_STRING_filesystem: $$.length= to.length; } } + +ident_table_alias: + IDENT_sys { $$= $1; } + | keyword_alias + { + $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; + $$.length= $1.length; + } ; ident: @@ -15048,8 +15289,8 @@ user: user_maybe_role } ; -/* Keyword that we allow for identifiers (except SP labels) */ -keyword: +/* Keywords which we allow as table aliases. */ +keyword_alias: keyword_sp {} | keyword_sp_verb_clause{} | ASCII_SYM {} @@ -15114,6 +15355,10 @@ keyword: | UPGRADE_SYM {} ; + +/* Keyword that we allow for identifiers (except SP labels) */ +keyword: keyword_alias | WINDOW_SYM {}; + /* * Keywords that we allow for labels in SPs. * Anything that's the beginning of a statement or characteristics diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 945f2e33028..3ea1dc25595 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -436,6 +436,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token DEFINER_SYM %token DELAYED_SYM %token DELAY_KEY_WRITE_SYM +%token DELETE_DOMAIN_ID_SYM %token DELETE_SYM /* SQL-2003-R */ %token DENSE_RANK_SYM %token DESC /* SQL-2003-N */ @@ -1037,13 +1038,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text IDENT_sys TEXT_STRING_sys TEXT_STRING_literal opt_component key_cache_name - sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty + sp_opt_label BIN_NUM TEXT_STRING_filesystem ident_or_empty opt_constraint constraint opt_ident - label_declaration_oracle labels_declaration_oracle ident_directly_assignable sp_decl_ident sp_block_label opt_place opt_db +%type + label_ident + label_declaration_oracle + labels_declaration_oracle + %type TEXT_STRING NCHAR_STRING @@ -1094,7 +1099,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type order_dir lock_option udf_type opt_local opt_no_write_to_binlog - opt_temporary all_or_any opt_distinct + opt_temporary all_or_any opt_distinct opt_glimit_clause opt_ignore_leaves fulltext_options union_option opt_not select_derived_init transaction_access_mode_types @@ -4097,25 +4102,8 @@ sp_for_loop_bounds: } | IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')' { - Item *item; - DBUG_ASSERT(Lex->sphead); - LEX_CSTRING name= {STRING_WITH_LEN("[implicit_cursor]") }; - if (Lex->sp_declare_cursor(thd, &name, $4, NULL, true)) + if (Lex->sp_for_loop_implicit_cursor_statement(thd, &$$, $4)) MYSQL_YYABORT; - if (!($$.m_index= new (thd->mem_root) sp_assignment_lex(thd, thd->lex))) - MYSQL_YYABORT; - $$.m_index->sp_lex_in_use= true; - Lex->sphead->reset_lex(thd, $$.m_index); - if (!(item= new (thd->mem_root) Item_field(thd, - Lex->current_context(), - NullS, NullS, &name))) - MYSQL_YYABORT; - $$.m_index->set_item_and_free_list(item, NULL); - if (Lex->sphead->restore_lex(thd)) - MYSQL_YYABORT; - $$.m_direction= 1; - $$.m_upper_bound= NULL; - $$.m_implicit_cursor= true; } ; @@ -7325,7 +7313,7 @@ alter: Lex->create_info.set($2); Lex->sql_command= SQLCOM_ALTER_USER; } - | ALTER SEQUENCE_SYM opt_if_exists_table_element + | ALTER SEQUENCE_SYM opt_if_exists { LEX *lex= Lex; lex->name= null_clex_str; @@ -7348,7 +7336,7 @@ alter: sequence_defs { /* Create a generic ALTER SEQUENCE statment. */ - Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence(); + Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3); if (Lex->m_sql_cmd == NULL) MYSQL_YYABORT; } @@ -10590,16 +10578,22 @@ sum_expr: | GROUP_CONCAT_SYM '(' opt_distinct { Select->in_sum_expr++; } expr_list opt_gorder_clause - opt_gconcat_separator + opt_gconcat_separator opt_glimit_clause ')' { SELECT_LEX *sel= Select; sel->in_sum_expr--; $$= new (thd->mem_root) - Item_func_group_concat(thd, Lex->current_context(), $3, $5, - sel->gorder_list, $7); + Item_func_group_concat(thd, Lex->current_context(), + $3, $5, + sel->gorder_list, $7, $8, + sel->select_limit, + sel->offset_limit); if ($$ == NULL) MYSQL_YYABORT; + sel->select_limit= NULL; + sel->offset_limit= NULL; + sel->explicit_limit= 0; $5->empty(); sel->gorder_list.empty(); } @@ -10885,6 +10879,46 @@ gorder_list: { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } ; +opt_glimit_clause: + /* empty */ { $$ = 0; } + | glimit_clause { $$ = 1; } + ; + +glimit_clause_init: + LIMIT{} + ; + +glimit_clause: + glimit_clause_init glimit_options + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + ; + +glimit_options: + limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= 0; + sel->explicit_limit= 1; + } + | limit_option ',' limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $3; + sel->offset_limit= $1; + sel->explicit_limit= 1; + } + | limit_option OFFSET_SYM limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= $3; + sel->explicit_limit= 1; + } + ; + in_sum_expr: opt_all { diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index a30d202db63..adef93ef205 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -622,8 +622,7 @@ static Sys_var_mybool Sys_explicit_defaults_for_timestamp( "explicit_defaults_for_timestamp", "This option causes CREATE TABLE to create all TIMESTAMP columns " "as NULL with DEFAULT NULL attribute, Without this option, " - "TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. " - "The old behavior is deprecated.", + "TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.", READ_ONLY GLOBAL_VAR(opt_explicit_defaults_for_timestamp), CMD_LINE(OPT_ARG), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG); @@ -4922,6 +4921,14 @@ static Sys_var_ulonglong Sys_read_binlog_speed_limit( GLOBAL_VAR(opt_read_binlog_speed_limit), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1)); +static Sys_var_charptr Sys_slave_transaction_retry_errors( + "slave_transaction_retry_errors", "Tells the slave thread to retry " + "transaction for replication when a query event returns an error from " + "the provided list. Deadlock and elapsed lock wait timeout errors are " + "automatically added to this list", + READ_ONLY GLOBAL_VAR(opt_slave_transaction_retry_errors), CMD_LINE(REQUIRED_ARG), + IN_SYSTEM_CHARSET, DEFAULT(0)); + static Sys_var_ulonglong Sys_relay_log_space_limit( "relay_log_space_limit", "Maximum space to use for all relay logs", READ_ONLY GLOBAL_VAR(relay_log_space_limit), CMD_LINE(REQUIRED_ARG), @@ -4956,10 +4963,19 @@ static Sys_var_uint Sys_sync_masterinfo_period( #ifdef HAVE_REPLICATION static Sys_var_ulong Sys_slave_trans_retries( "slave_transaction_retries", "Number of times the slave SQL " - "thread will retry a transaction in case it failed with a deadlock " - "or elapsed lock wait timeout, before giving up and stopping", + "thread will retry a transaction in case it failed with a deadlock, " + "elapsed lock wait timeout or listed in " + "slave_transaction_retry_errors, before giving up and stopping", GLOBAL_VAR(slave_trans_retries), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX), DEFAULT(10), BLOCK_SIZE(1)); + +static Sys_var_ulong Sys_slave_trans_retry_interval( + "slave_transaction_retry_interval", "Interval of the slave SQL " + "thread will retry a transaction in case it failed with a deadlock " + "or elapsed lock wait timeout or listed in " + "slave_transaction_retry_errors", + GLOBAL_VAR(slave_trans_retry_interval), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(0, 3600), DEFAULT(0), BLOCK_SIZE(1)); #endif static bool check_locale(sys_var *self, THD *thd, set_var *var) @@ -5415,7 +5431,9 @@ static Sys_var_enum Sys_plugin_maturity( "The lowest desirable plugin maturity. " "Plugins less mature than that will not be installed or loaded", READ_ONLY GLOBAL_VAR(plugin_maturity), CMD_LINE(REQUIRED_ARG), - plugin_maturity_names, DEFAULT(MariaDB_PLUGIN_MATURITY_UNKNOWN)); + plugin_maturity_names, + DEFAULT(SERVER_MATURITY_LEVEL > 0 ? + SERVER_MATURITY_LEVEL - 1 : SERVER_MATURITY_LEVEL)); static Sys_var_ulong Sys_deadlock_search_depth_short( "deadlock_search_depth_short", diff --git a/sql/table.cc b/sql/table.cc index a421697e341..72acfc5a9ee 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -6781,6 +6781,58 @@ bool TABLE::mark_virtual_columns_for_write(bool insert_fl) DBUG_RETURN(bitmap_updated); } + +/** + Check if a virtual not stored column field is in read set + + @retval FALSE No virtual not stored column is used + @retval TRUE At least one virtual not stored column is used +*/ + +bool TABLE::check_virtual_columns_marked_for_read() +{ + if (vfield) + { + Field **vfield_ptr; + for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++) + { + Field *tmp_vfield= *vfield_ptr; + if (bitmap_is_set(read_set, tmp_vfield->field_index) && + !tmp_vfield->vcol_info->stored_in_db) + return TRUE; + } + } + return FALSE; +} + + +/** + Check if a stored virtual column field is marked for write + + This can be used to check if any column that is part of a virtual + stored column is changed + + @retval FALSE No stored virtual column is used + @retval TRUE At least one stored virtual column is used +*/ + +bool TABLE::check_virtual_columns_marked_for_write() +{ + if (vfield) + { + Field **vfield_ptr; + for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++) + { + Field *tmp_vfield= *vfield_ptr; + if (bitmap_is_set(write_set, tmp_vfield->field_index) && + tmp_vfield->vcol_info->stored_in_db) + return TRUE; + } + } + return FALSE; +} + + /* Mark fields used by check constraints. This is done once for the TABLE_SHARE the first time the table is opened. @@ -6838,6 +6890,7 @@ void TABLE::mark_default_fields_for_write(bool is_insert) DBUG_VOID_RETURN; } + void TABLE::move_fields(Field **ptr, const uchar *to, const uchar *from) { my_ptrdiff_t diff= to - from; diff --git a/sql/table.h b/sql/table.h index 45505efc9dd..1dad990edab 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1371,6 +1371,8 @@ public: void mark_columns_per_binlog_row_image(void); bool mark_virtual_col(Field *field); bool mark_virtual_columns_for_write(bool insert_fl); + bool check_virtual_columns_marked_for_read(); + bool check_virtual_columns_marked_for_write(); void mark_default_fields_for_write(bool insert_fl); void mark_columns_used_by_check_constraints(void); void mark_check_constraint_columns_for_read(void); diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 3fdaff0504f..4ff6d5f2cfb 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -28,11 +28,19 @@ #endif #ifdef HAVE_IOCP -#define OPTIONAL_IO_POLL_READ_PARAM &overlapped +#define OPTIONAL_IO_POLL_READ_PARAM this #else #define OPTIONAL_IO_POLL_READ_PARAM 0 #endif +#ifdef _WIN32 +typedef HANDLE TP_file_handle; +#else +typedef int TP_file_handle; +#define INVALID_HANDLE_VALUE -1 +#endif + + #include #include #include @@ -59,10 +67,10 @@ typedef OVERLAPPED_ENTRY native_event; #pragma warning (disable : 4312) #endif -static void io_poll_close(int fd) +static void io_poll_close(TP_file_handle fd) { #ifdef _WIN32 - CloseHandle((HANDLE)fd); + CloseHandle(fd); #else close(fd); #endif @@ -151,14 +159,17 @@ struct TP_connection_generic:public TP_connection TP_connection_generic **prev_in_queue; ulonglong abs_wait_timeout; ulonglong dequeue_time; + TP_file_handle fd; bool bound_to_poll_descriptor; int waiting; #ifdef HAVE_IOCP OVERLAPPED overlapped; #endif +#ifdef _WIN32 + enum_vio_type vio_type; +#endif }; -typedef TP_connection_generic TP_connection_generic; typedef I_P_Listoverlapped; + if (con->vio_type == VIO_TYPE_NAMEDPIPE) + { + if (ReadFile(fd, &c, 0, NULL, overlapped)) + return 0; + } + else + { + WSABUF buf; + buf.buf= &c; + buf.len= 0; + DWORD flags=0; - WSABUF buf; - buf.buf= &c; - buf.len= 0; - DWORD flags=0; - - if (WSARecv((SOCKET)fd, &buf, 1, &num_bytes, &flags, (OVERLAPPED *)opt, NULL) == 0) - return 0; + if (WSARecv((SOCKET)fd, &buf, 1,NULL, &flags,overlapped, NULL) == 0) + return 0; + } if (GetLastError() == ERROR_IO_PENDING) return 0; @@ -478,26 +496,26 @@ int io_poll_start_read(int pollfd, int fd, void *, void *opt) } -static int io_poll_associate_fd(int pollfd, int fd, void *data, void *opt) +static int io_poll_associate_fd(TP_file_handle pollfd, TP_file_handle fd, void *data, void *opt) { - HANDLE h= CreateIoCompletionPort(IntToPtr(fd), IntToPtr(pollfd), (ULONG_PTR)data, 0); + HANDLE h= CreateIoCompletionPort(fd, pollfd, (ULONG_PTR)data, 0); if (!h) return -1; return io_poll_start_read(pollfd,fd, 0, opt); } -int io_poll_disassociate_fd(int pollfd, int fd) +int io_poll_disassociate_fd(TP_file_handle pollfd, TP_file_handle fd) { /* Not possible to unbind/rebind file descriptor in IOCP. */ return 0; } -int io_poll_wait(int pollfd, native_event *events, int maxevents, int timeout_ms) +int io_poll_wait(TP_file_handle pollfd, native_event *events, int maxevents, int timeout_ms) { ULONG n; - BOOL ok = GetQueuedCompletionStatusEx((HANDLE)pollfd, events, + BOOL ok = GetQueuedCompletionStatusEx(pollfd, events, maxevents, &n, timeout_ms, FALSE); return ok ? (int)n : -1; @@ -1038,7 +1056,7 @@ int thread_group_init(thread_group_t *thread_group, pthread_attr_t* thread_attr) DBUG_ENTER("thread_group_init"); thread_group->pthread_attr = thread_attr; mysql_mutex_init(key_group_mutex, &thread_group->mutex, NULL); - thread_group->pollfd= -1; + thread_group->pollfd= INVALID_HANDLE_VALUE; thread_group->shutdown_pipe[0]= -1; thread_group->shutdown_pipe[1]= -1; queue_init(thread_group); @@ -1049,10 +1067,10 @@ int thread_group_init(thread_group_t *thread_group, pthread_attr_t* thread_attr) void thread_group_destroy(thread_group_t *thread_group) { mysql_mutex_destroy(&thread_group->mutex); - if (thread_group->pollfd != -1) + if (thread_group->pollfd != INVALID_HANDLE_VALUE) { io_poll_close(thread_group->pollfd); - thread_group->pollfd= -1; + thread_group->pollfd= INVALID_HANDLE_VALUE; } #ifndef HAVE_IOCP for(int i=0; i < 2; i++) @@ -1109,7 +1127,7 @@ static int wake_listener(thread_group_t *thread_group) if (write(thread_group->shutdown_pipe[1], &c, 1) < 0) return -1; #else - PostQueuedCompletionStatus((HANDLE)thread_group->pollfd, 0, 0, 0); + PostQueuedCompletionStatus(thread_group->pollfd, 0, 0, 0); #endif return 0; } @@ -1432,6 +1450,16 @@ TP_connection_generic::TP_connection_generic(CONNECT *c): , overlapped() #endif { + DBUG_ASSERT(c->vio); + +#ifdef _WIN32 + vio_type= c->vio->type; + fd= (vio_type == VIO_TYPE_NAMEDPIPE) ? + c->vio->hPipe: (TP_file_handle)mysql_socket_getfd(c->vio->mysql_socket); +#else + fd= mysql_socket_getfd(c->vio->mysql_socket); +#endif + /* Assign connection to a group. */ thread_group_t *group= &all_groups[c->thread_id%group_count]; @@ -1486,7 +1514,6 @@ static int change_group(TP_connection_generic *c, thread_group_t *new_group) { int ret= 0; - int fd= (int)mysql_socket_getfd(c->thd->net.vio->mysql_socket); DBUG_ASSERT(c->thread_group == old_group); @@ -1494,7 +1521,7 @@ static int change_group(TP_connection_generic *c, mysql_mutex_lock(&old_group->mutex); if (c->bound_to_poll_descriptor) { - io_poll_disassociate_fd(old_group->pollfd,fd); + io_poll_disassociate_fd(old_group->pollfd,c->fd); c->bound_to_poll_descriptor= false; } c->thread_group->connection_count--; @@ -1513,9 +1540,7 @@ static int change_group(TP_connection_generic *c, int TP_connection_generic::start_io() -{ - int fd= (int)mysql_socket_getfd(thd->net.vio->mysql_socket); - +{ #ifndef HAVE_IOCP /* Usually, connection will stay in the same group for the entire @@ -1666,10 +1691,10 @@ int TP_pool_generic::set_pool_size(uint size) { thread_group_t *group= &all_groups[i]; mysql_mutex_lock(&group->mutex); - if (group->pollfd == -1) + if (group->pollfd == INVALID_HANDLE_VALUE) { group->pollfd= io_poll_create(); - success= (group->pollfd >= 0); + success= (group->pollfd != INVALID_HANDLE_VALUE); if(!success) { sql_print_error("io_poll_create() failed, errno=%d\n", errno); @@ -1707,7 +1732,7 @@ int TP_pool_generic::set_stall_limit(uint limit) int TP_pool_generic::get_idle_thread_count() { int sum=0; - for (uint i= 0; i < threadpool_max_size && all_groups[i].pollfd >= 0; i++) + for (uint i= 0; i < threadpool_max_size && all_groups[i].pollfd != INVALID_HANDLE_VALUE; i++) { sum+= (all_groups[i].thread_count - all_groups[i].active_thread_count); } diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index 50ecacd9960..35a0020ef44 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -509,6 +509,9 @@ wsrep_run_wsrep_commit(THD *thd, bool all) } mysql_mutex_lock(&thd->LOCK_wsrep_thd); + + DEBUG_SYNC(thd, "wsrep_after_replication"); + switch(rcode) { case 0: /* diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index fd759717aaf..2f41e939ee4 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2022,7 +2022,7 @@ static bool abort_replicated(THD *thd) bool ret_code= false; if (thd->wsrep_query_state== QUERY_COMMITTING) { - WSREP_DEBUG("aborting replicated trx: %lu", (ulong) thd->real_id); + WSREP_DEBUG("aborting replicated trx: %llu", (ulonglong)(thd->real_id)); (void)wsrep_abort_thd(thd, thd, TRUE); ret_code= true; @@ -2739,6 +2739,7 @@ my_bool wsrep_aborting_thd_contains(THD *thd) void wsrep_aborting_thd_enqueue(THD *thd) { + mysql_mutex_assert_owner(&LOCK_wsrep_rollback); wsrep_aborting_thd_t aborting = (wsrep_aborting_thd_t) my_malloc(sizeof(struct wsrep_aborting_thd), MYF(0)); aborting->aborting_thd = thd; diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 8107ab12c6b..188fa3e292b 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -327,8 +327,9 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) if (wsrep_inited == 1) wsrep_deinit(false); - char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider + char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider //when fails + if (wsrep_init()) { my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed"); diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 2cf6c0528c0..88bdcfca565 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -61,7 +61,7 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fexceptions -fPIC ") get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES) - SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.c) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.cpp) SET(IPHLPAPI_LIBRARY "") ELSE(NOT UNIX) SET(CONNECT_SOURCES ${CONNECT_SOURCES} diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp old mode 100755 new mode 100644 diff --git a/storage/connect/global.h b/storage/connect/global.h index de7a9fb3c03..e4b00786efa 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -217,7 +217,8 @@ DllExport int PlugExit(PGLOBAL); // Plug global termination DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR); DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir); DllExport BOOL PlugIsAbsolutePath(LPCSTR path); -DllExport void *PlugAllocMem(PGLOBAL, uint); +DllExport bool AllocSarea(PGLOBAL, uint); +DllExport void FreeSarea(PGLOBAL); DllExport BOOL PlugSubSet(PGLOBAL, void *, uint); DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t); DllExport char *PlugDup(PGLOBAL g, const char *str); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 51fcf87470c..a4677f47d10 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -3010,7 +3010,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) return NULL; if (!x) { + const char *p; char *s = (ishav) ? havg : body; + uint j, k, n; // Append the value to the filter switch (args[i]->field_type()) { @@ -3066,16 +3068,38 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strcat(s, "'}"); break; default: - strcat(s, "'"); - strncat(s, res->ptr(), res->length()); - strcat(s, "'"); - } // endswitch field type + j = strlen(s); + s[j++] = '\''; + p = res->ptr(); + n = res->length(); + + for (k = 0; k < n; k++) { + if (p[k] == '\'') + s[j++] = '\''; + + s[j++] = p[k]; + } // endfor k + + s[j++] = '\''; + s[j] = 0; + } // endswitch field type } else { - strcat(s, "'"); - strncat(s, res->ptr(), res->length()); - strcat(s, "'"); - } // endif tty + j = strlen(s); + s[j++] = '\''; + p = res->ptr(); + n = res->length(); + + for (k = 0; k < n; k++) { + if (p[k] == '\'') + s[j++] = '\''; + + s[j++] = p[k]; + } // endfor k + + s[j++] = '\''; + s[j] = 0; + } // endif tty break; default: diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.cpp similarity index 97% rename from storage/connect/inihandl.c rename to storage/connect/inihandl.cpp index 0ce0eb9fa0d..96ae0a67a6b 100644 --- a/storage/connect/inihandl.c +++ b/storage/connect/inihandl.cpp @@ -37,7 +37,7 @@ // The types and variables used locally //typedef int bool; typedef unsigned int uint; -#define SVP(S) ((S) ? S : "") +//#define SVP(S) ((S) ? S : "") #define _strlwr(P) strlwr(P) //OB: changed this line #define MAX_PATHNAME_LEN 256 #define N_CACHED_PROFILES 10 @@ -61,8 +61,8 @@ void htrc(char const *fmt, ...) } /* end of htrc */ #else // !TEST_MODULE // Normal included functions -extern int trace; -void htrc(char const *fmt, ...); +//extern int trace; +//void htrc(char const *fmt, ...); #endif // !TEST MODULE @@ -112,10 +112,11 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL}; //static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect"); -static const char hex[16] = "0123456789ABCDEF"; +static const char hex[17] = "0123456789ABCDEF"; BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry, - LPCSTR string, LPCSTR filename ); + LPCSTR string, LPCSTR filename); + /*********************************************************************** * PROFILE_CopyEntry * @@ -254,7 +255,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) PROFILESECTION* *next_section; PROFILEKEY *key, *prev_key, **next_key; - first_section = malloc(sizeof(*section)); + first_section = (PROFILESECTION*)malloc(sizeof(*section)); if (first_section == NULL) return NULL; @@ -281,7 +282,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) *p2 = '\0'; p++; - if (!(section = malloc(sizeof(*section) + strlen(p)))) + if (!(section = (PROFILESECTION*)malloc(sizeof(*section) + strlen(p)))) break; strcpy(section->name, p); @@ -319,13 +320,13 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) } // endif p2 if (*p || !prev_key || *prev_key->name) { - if (!(key = malloc(sizeof(*key) + strlen(p)))) + if (!(key = (PROFILEKEY*)malloc(sizeof(*key) + strlen(p)))) break; strcpy(key->name, p); if (p2) { - key->value = malloc(strlen(p2)+1); + key->value = (char*)malloc(strlen(p2)+1); strcpy(key->value, p2); } else key->value = NULL; @@ -452,7 +453,7 @@ static BOOL PROFILE_Open(LPCSTR filename) /* First time around */ if (!CurProfile) for (i = 0; i < N_CACHED_PROFILES; i++) { - MRUProfile[i] = malloc(sizeof(PROFILE)); + MRUProfile[i] = (PROFILE*)malloc(sizeof(PROFILE)); if (MRUProfile[i] == NULL) break; @@ -520,7 +521,7 @@ static BOOL PROFILE_Open(LPCSTR filename) // strcpy(newdos_name, filename); // CurProfile->dos_name = newdos_name; - CurProfile->filename = malloc(strlen(filename) + 1); + CurProfile->filename = (char*)malloc(strlen(filename) + 1); strcpy(CurProfile->filename, filename); /* Try to open the profile file, first in $HOME/.wine */ @@ -783,7 +784,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, if (!create) return NULL; - if (!(*key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) + if (!(*key = (PROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) return NULL; strcpy((*key)->name, key_name); @@ -798,7 +799,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, if (!create) return NULL; - *section = malloc(sizeof(PROFILESECTION) + strlen(section_name)); + *section = (PROFILESECTION*)malloc(sizeof(PROFILESECTION) + strlen(section_name)); if (*section == NULL) return NULL; @@ -806,7 +807,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, strcpy((*section)->name, section_name); (*section)->next = NULL; - if (!((*section)->key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) { + if (!((*section)->key = (tagPROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) { free(*section); return NULL; } // endif malloc @@ -1052,7 +1053,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, } else if (trace > 1) htrc(" creating key\n" ); - key->value = malloc(strlen(value) + 1); + key->value = (char*)malloc(strlen(value) + 1); strcpy(key->value, value); CurProfile->changed = TRUE; } // endelse @@ -1125,7 +1126,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry, if (*p == ' ') { /* ouch, contained trailing ' ' */ int len = p - (LPSTR)def_val; - pDefVal = malloc(len + 1); + pDefVal = (LPSTR)malloc(len + 1); strncpy(pDefVal, def_val, len); pDefVal[len] = '\0'; } // endif *p @@ -1277,7 +1278,7 @@ BOOL WritePrivateProfileSection(LPCSTR section, ret = TRUE; while (*string) { - LPSTR buf = malloc(strlen(string) + 1); + LPSTR buf = (LPSTR)malloc(strlen(string) + 1); strcpy(buf, string); if ((p = strchr(buf, '='))) { diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index a79fd0a7124..91917b48a23 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -1507,23 +1507,16 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n, ml += g->More; if (ml > g->Sarea_Size) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size); + FreeSarea(g); - free(g->Sarea); - - if (!(g->Sarea = PlugAllocMem(g, ml))) { + if (AllocSarea(g, ml)) { char errmsg[MAX_STR]; snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); - g->Sarea_Size = 0; return true; - } // endif Alloc + } // endif SareaAlloc - g->Sarea_Size = ml; g->Createas = 0; g->Xchk = NULL; initid->max_length = rl; diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 5602861df59..8c2842f8e41 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -334,7 +334,7 @@ PDBUSER PlgMakeUser(PGLOBAL g) { PDBUSER dbuserp; - if (!(dbuserp = (PDBUSER)PlugAllocMem(g, (uint)sizeof(DBUSERBLK)))) { + if (!(dbuserp = (PDBUSER)malloc(sizeof(DBUSERBLK)))) { sprintf(g->Message, MSG(MALLOC_ERROR), "PlgMakeUser"); return NULL; } // endif dbuserp diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 0367aacd050..57215b2f745 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -138,7 +138,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) if (trace > 1) htrc("PlugInit: Language='%s'\n", - ((!Language) ? "Null" : (char*)Language)); + ((!Language) ? "Null" : (char*)Language)); try { g = new GLOBAL; @@ -160,13 +160,11 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) /*******************************************************************/ /* Allocate the main work segment. */ /*******************************************************************/ - if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) { + if (worksize && AllocSarea(g, worksize)) { char errmsg[MAX_STR]; snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); - g->Sarea_Size = 0; - } else - g->Sarea_Size = worksize; + } // endif Sarea g->jump_level = -1; /* New setting to allow recursive call of Plug */ return(g); @@ -183,15 +181,7 @@ int PlugExit(PGLOBAL g) if (dup) free(dup); - if (g->Sarea) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size); - - free(g->Sarea); - } // endif Sarea - + FreeSarea(g); delete g; } // endif g @@ -459,30 +449,65 @@ short GetLineLength(PGLOBAL g) /***********************************************************************/ /* Program for memory allocation of work and language areas. */ /***********************************************************************/ -void *PlugAllocMem(PGLOBAL g, uint size) +bool AllocSarea(PGLOBAL g, uint size) { - void *areap; /* Pointer to allocated area */ - /*********************************************************************/ /* This is the allocation routine for the WIN32/UNIX/AIX version. */ /*********************************************************************/ - if (!(areap = malloc(size))) - sprintf(g->Message, MSG(MALLOC_ERROR), "malloc"); +#if defined(__WIN__) + if (size >= 1048576) // 1M + g->Sarea = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + else +#endif + g->Sarea = malloc(size); + + if (!g->Sarea) { + sprintf(g->Message, MSG(MALLOC_ERROR), "malloc"); + g->Sarea_Size = 0; + } else + g->Sarea_Size = size; #if defined(DEVELOPMENT) if (true) { #else if (trace) { #endif - if (areap) - htrc("Memory of %u allocated at %p\n", size, areap); + if (g->Sarea) + htrc("Work area of %u allocated at %p\n", size, g->Sarea); else - htrc("PlugAllocMem: %s\n", g->Message); + htrc("SareaAlloc: %s\n", g->Message); } // endif trace - return (areap); -} // end of PlugAllocMem + return (!g->Sarea); +} // end of AllocSarea + +/***********************************************************************/ +/* Program for memory freeing the work area. */ +/***********************************************************************/ +void FreeSarea(PGLOBAL g) +{ + if (g->Sarea) { +#if defined(__WIN__) + if (g->Sarea_Size >= 1048576) // 1M + VirtualFree(g->Sarea, 0, MEM_RELEASE); + else +#endif + free(g->Sarea); + +#if defined(DEVELOPMENT) + if (true) +#else + if (trace) +#endif + htrc("Freeing Sarea at %p size = %d\n", g->Sarea, g->Sarea_Size); + + g->Sarea = NULL; + g->Sarea_Size = 0; + } // endif Sarea + + return; +} // end of FreeSarea /***********************************************************************/ /* Program for SubSet initialization of memory pools. */ diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 031fdebe650..0fb24baa785 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -547,14 +547,12 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) } // endif dladdr #endif // 0 - // Is the library already loaded? - if (!Hdll && !(Hdll = dlopen(soname, RTLD_NOLOAD))) - // Load the desired shared library - if (!(Hdll = dlopen(soname, RTLD_LAZY))) { - error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); - return NULL; - } // endif Hdll + // Load the desired shared library + if (!Hdll && !(Hdll = dlopen(soname, RTLD_LAZY))) { + error = dlerror(); + sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + return NULL; + } // endif Hdll // The exported name is always in uppercase for (int i = 0; ; i++) { diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index 36436931d59..ad7c21a6b40 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -157,29 +157,20 @@ void user_connect::SetHandler(ha_connect *hc) bool user_connect::CheckCleanup(bool force) { if (thdp->query_id > last_query_id || force) { - uint worksize= GetWorkSize(); + uint worksize= GetWorkSize(), size = g->Sarea_Size; PlugCleanup(g, true); - if (g->Sarea_Size != worksize) { - if (g->Sarea) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("CheckCleanup: Free Sarea at %p size=%d\n", - g->Sarea, g->Sarea_Size); - - free(g->Sarea); - } // endif Size + if (size != worksize) { + FreeSarea(g); // Check whether the work area could be allocated - if (!(g->Sarea = PlugAllocMem(g, worksize))) { - g->Sarea = PlugAllocMem(g, g->Sarea_Size); + if (AllocSarea(g, worksize)) { + AllocSarea(g, size); SetWorkSize(g->Sarea_Size); // Was too big - } else - g->Sarea_Size = worksize; // Ok + } // endif sarea - } // endif worksize + } // endif worksize PlugSubSet(g, g->Sarea, g->Sarea_Size); g->Xchk = NULL; diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp old mode 100755 new mode 100644 diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 70444ca1830..cdbe47d48f8 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -751,6 +751,8 @@ DECLARE_THREAD(btr_defragment_thread)(void*) buf_block_t* first_block; buf_block_t* last_block; + trx_t* trx = trx_allocate_for_background(); + while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { ut_ad(btr_defragment_thread_active); @@ -826,31 +828,35 @@ DECLARE_THREAD(btr_defragment_thread)(void*) /* Update the last_processed time of this index. */ item->last_processed = now; } else { - dberr_t err = DB_SUCCESS; mtr_commit(&mtr); /* Reaching the end of the index. */ dict_stats_empty_defrag_stats(index); - err = dict_stats_save_defrag_stats(index); - if (err != DB_SUCCESS) { - ib::error() << "Saving defragmentation stats for table " - << index->table->name.m_name - << " index " << index->name() - << " failed with error " << err; - } else { - err = dict_stats_save_defrag_summary(index); - - if (err != DB_SUCCESS) { - ib::error() << "Saving defragmentation summary for table " - << index->table->name.m_name - << " index " << index->name() - << " failed with error " << err; - } + ut_d(trx->persistent_stats = true); + ++trx->will_lock; + dberr_t err = dict_stats_save_defrag_stats(index, trx); + if (err == DB_SUCCESS) { + err = dict_stats_save_defrag_summary( + index, trx); } + if (err != DB_SUCCESS) { + trx_rollback_to_savepoint(trx, NULL); + ib::error() << "Saving defragmentation stats for table " + << index->table->name + << " index " << index->name + << " failed with error " + << ut_strerr(err); + } else if (trx->state != TRX_STATE_NOT_STARTED) { + trx_commit_for_mysql(trx); + } + + ut_d(trx->persistent_stats = false); btr_defragment_remove_item(item); } } + trx_free_for_background(trx); + btr_defragment_thread_active = false; os_thread_exit(); OS_THREAD_DUMMY_RETURN; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 53f92927b28..df47a49152c 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -138,10 +138,13 @@ inline void* aligned_malloc(size_t size, size_t align) { void *result; #ifdef _MSC_VER result = _aligned_malloc(size, align); -#else +#elif defined (HAVE_POSIX_MEMALIGN) if(posix_memalign(&result, align, size)) { result = 0; } +#else + /* Use unaligned malloc as fallback */ + result = malloc(size); #endif return result; } @@ -2205,7 +2208,7 @@ buf_resize_status( va_start(ap, fmt); - ut_vsnprintf( + vsnprintf( export_vars.innodb_buffer_pool_resize_status, sizeof(export_vars.innodb_buffer_pool_resize_status), fmt, ap); @@ -4291,10 +4294,8 @@ loop: case BUF_GET_IF_IN_POOL_OR_WATCH: case BUF_PEEK_IF_IN_POOL: case BUF_EVICT_IF_IN_POOL: -#ifdef UNIV_SYNC_DEBUG ut_ad(!rw_lock_own(hash_lock, RW_LOCK_X)); ut_ad(!rw_lock_own(hash_lock, RW_LOCK_S)); -#endif /* UNIV_SYNC_DEBUG */ return(NULL); } diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 945a1543b72..6cd8111e902 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -47,7 +47,6 @@ Created April 08, 2011 Vasil Dimov #include "mysql/service_wsrep.h" /* wsrep_recovery */ enum status_severity { - STATUS_VERBOSE, STATUS_INFO, STATUS_ERR }; @@ -120,7 +119,7 @@ buf_dump_status( va_start(ap, fmt); - ut_vsnprintf( + vsnprintf( export_vars.innodb_buffer_pool_dump_status, sizeof(export_vars.innodb_buffer_pool_dump_status), fmt, ap); @@ -133,9 +132,6 @@ buf_dump_status( case STATUS_ERR: ib::error() << export_vars.innodb_buffer_pool_dump_status; break; - - case STATUS_VERBOSE: - break; } va_end(ap); @@ -162,7 +158,7 @@ buf_load_status( va_start(ap, fmt); - ut_vsnprintf( + vsnprintf( export_vars.innodb_buffer_pool_load_status, sizeof(export_vars.innodb_buffer_pool_load_status), fmt, ap); @@ -175,9 +171,6 @@ buf_load_status( case STATUS_ERR: ib::error() << export_vars.innodb_buffer_pool_load_status; break; - - case STATUS_VERBOSE: - break; } va_end(ap); @@ -213,8 +206,8 @@ buf_dump_generate_path( { char buf[FN_REFLEN]; - ut_snprintf(buf, sizeof(buf), "%s%c%s", get_buf_dump_dir(), - OS_PATH_SEPARATOR, srv_buf_dump_filename); + snprintf(buf, sizeof(buf), "%s%c%s", get_buf_dump_dir(), + OS_PATH_SEPARATOR, srv_buf_dump_filename); os_file_type_t type; bool exists = false; @@ -240,14 +233,14 @@ buf_dump_generate_path( if (srv_data_home_full[strlen(srv_data_home_full) - 1] == OS_PATH_SEPARATOR) { - ut_snprintf(path, path_size, "%s%s", - srv_data_home_full, - srv_buf_dump_filename); + snprintf(path, path_size, "%s%s", + srv_data_home_full, + srv_buf_dump_filename); } else { - ut_snprintf(path, path_size, "%s%c%s", - srv_data_home_full, - OS_PATH_SEPARATOR, - srv_buf_dump_filename); + snprintf(path, path_size, "%s%c%s", + srv_data_home_full, + OS_PATH_SEPARATOR, + srv_buf_dump_filename); } } } @@ -276,8 +269,8 @@ buf_dump( buf_dump_generate_path(full_filename, sizeof(full_filename)); - ut_snprintf(tmp_filename, sizeof(tmp_filename), - "%s.incomplete", full_filename); + snprintf(tmp_filename, sizeof(tmp_filename), + "%s.incomplete", full_filename); buf_dump_status(STATUS_INFO, "Dumping buffer pool(s) to %s", full_filename); @@ -298,8 +291,6 @@ buf_dump( buf_dump_t* dump; ulint n_pages; ulint j; - ulint limit; - ulint counter; buf_pool = buf_pool_from_array(i); @@ -368,9 +359,6 @@ buf_dump( buf_pool_mutex_exit(buf_pool); - limit = (ulint)((double)n_pages * ((double)srv_buf_dump_status_frequency / (double)100)); - counter = 0; - for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) { ret = fprintf(f, ULINTPF "," ULINTPF "\n", BUF_DUMP_SPACE(dump[j]), @@ -384,23 +372,6 @@ buf_dump( /* leave tmp_filename to exist */ return; } - - counter++; - - /* Print buffer pool dump status only if - srv_buf_dump_status_frequency is > 0 and - we have processed that amount of pages. */ - if (srv_buf_dump_status_frequency && - counter == limit) { - counter = 0; - buf_dump_status( - STATUS_VERBOSE, - "Dumping buffer pool" - " " ULINTPF "/%lu," - " page " ULINTPF "/" ULINTPF, - i + 1, srv_buf_pool_instances, - j + 1, n_pages); - } } ut_free(dump); @@ -718,21 +689,6 @@ buf_load() os_aio_simulated_wake_handler_threads(); } - /* Update the progress every 32 MiB, which is every Nth page, - where N = 32*1024^2 / page_size. */ - static const ulint update_status_every_n_mb = 32; - static const ulint update_status_every_n_pages - = update_status_every_n_mb * 1024 * 1024 - / page_size.physical(); - - if (i % update_status_every_n_pages == 0) { - buf_load_status(STATUS_VERBOSE, - "Loaded " ULINTPF "/" ULINTPF " pages", - i + 1, dump_n); - /* mysql_stage_set_work_completed(pfs_stage_progress, - i); */ - } - if (buf_load_abort_flag) { if (space != NULL) { fil_space_release(space); @@ -805,9 +761,6 @@ DECLARE_THREAD(buf_dump_thread)(void*) pfs_register_thread(buf_dump_thread_key); #endif */ /* UNIV_PFS_THREAD */ - buf_dump_status(STATUS_VERBOSE, "Dumping of buffer pool not started"); - buf_load_status(STATUS_VERBOSE, "Loading of buffer pool not started"); - if (srv_buffer_pool_load_at_startup) { #ifdef WITH_WSREP diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 043328902ee..636216159ff 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -28,6 +28,7 @@ Created 11/11/1995 Heikki Tuuri #include "ha_prototypes.h" #include #include +#include #include "buf0flu.h" #include "buf0buf.h" @@ -2683,21 +2684,21 @@ than a second @retval OS_SYNC_TIME_EXCEEDED if timeout was exceeded @param next_loop_time time when next loop iteration should start @param sig_count zero or the value returned by previous call of - os_event_reset() */ + os_event_reset() +@param cur_time current time as in ut_time_ms() */ static ulint pc_sleep_if_needed( /*===============*/ ulint next_loop_time, - int64_t sig_count) + int64_t sig_count, + ulint cur_time) { /* No sleep if we are cleaning the buffer pool during the shutdown with everything else finished */ if (srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE) return OS_SYNC_TIME_EXCEEDED; - ulint cur_time = ut_time_ms(); - if (next_loop_time > cur_time) { /* Get sleep interval in micro seconds. We use ut_min() to avoid long sleep in case of wrap around. */ @@ -3195,6 +3196,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ulint last_pages = 0; while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { + ulint curr_time = ut_time_ms(); /* The page_cleaner skips sleep if the server is idle and there are no pending IOs in the buffer pool @@ -3204,23 +3206,22 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) || n_flushed == 0) { ret_sleep = pc_sleep_if_needed( - next_loop_time, sig_count); - - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { - break; - } - } else if (ut_time_ms() > next_loop_time) { + next_loop_time, sig_count, curr_time); + } else if (curr_time > next_loop_time) { ret_sleep = OS_SYNC_TIME_EXCEEDED; } else { ret_sleep = 0; } + if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { + break; + } + sig_count = os_event_reset(buf_flush_event); if (ret_sleep == OS_SYNC_TIME_EXCEEDED) { - ulint curr_time = ut_time_ms(); - - if (curr_time > next_loop_time + 3000 + if (global_system_variables.log_warnings > 2 + && curr_time > next_loop_time + 3000 && !(test_flags & TEST_SIGINT)) { if (warn_count == 0) { ib::info() << "page_cleaner: 1000ms" @@ -3487,19 +3488,15 @@ buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt) { mutex_enter(&page_cleaner->mutex); - if (new_cnt > srv_n_page_cleaners) { + srv_n_page_cleaners = new_cnt; + if (new_cnt > page_cleaner->n_workers) { /* User has increased the number of page cleaner threads. */ - uint add = new_cnt - srv_n_page_cleaners; - srv_n_page_cleaners = new_cnt; + uint add = new_cnt - page_cleaner->n_workers; for (uint i = 0; i < add; i++) { os_thread_id_t cleaner_thread_id; os_thread_create(buf_flush_page_cleaner_worker, NULL, &cleaner_thread_id); } - } else if (new_cnt < srv_n_page_cleaners) { - /* User has decreased the number of page - cleaner threads. */ - srv_n_page_cleaners = new_cnt; } mutex_exit(&page_cleaner->mutex); @@ -3879,16 +3876,14 @@ FlushObserver::notify_remove( void FlushObserver::flush() { + ut_ad(m_trx); + if (!m_interrupted && m_stage) { m_stage->begin_phase_flush(buf_flush_get_dirty_pages_count( m_space_id, this)); } - /* MDEV-14317 FIXME: Discard all changes to only those pages - that will be freed by the clean-up of the ALTER operation. - (Maybe, instead of buf_pool->flush_list, use a dedicated list - for pages on which redo logging has been disabled.) */ - buf_LRU_flush_or_remove_pages(m_space_id, m_trx); + buf_LRU_flush_or_remove_pages(m_space_id, this); /* Wait for all dirty pages were flushed. */ for (ulint i = 0; i < srv_buf_pool_instances; i++) { diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 9d0d9627d26..26814418033 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -542,27 +542,21 @@ buf_flush_or_remove_page( return(processed); } -/******************************************************************//** -Remove all dirty pages belonging to a given tablespace inside a specific +/** Remove all dirty pages belonging to a given tablespace inside a specific buffer pool instance when we are deleting the data file(s) of that tablespace. The pages still remain a part of LRU and are evicted from the list as they age towards the tail of the LRU. -@retval DB_SUCCESS if all freed -@retval DB_FAIL if not all freed -@retval DB_INTERRUPTED if the transaction was interrupted */ +@param[in,out] buf_pool buffer pool +@param[in] id tablespace identifier +@param[in] observer flush observer (to check for interrupt), + or NULL if the files should not be written to +@return whether all dirty pages were freed */ static MY_ATTRIBUTE((warn_unused_result)) -dberr_t +bool buf_flush_or_remove_pages( -/*======================*/ - buf_pool_t* buf_pool, /*!< buffer pool instance */ - ulint id, /*!< in: target space id for which - to remove or flush pages */ - FlushObserver* observer, /*!< in: flush observer */ - bool flush, /*!< in: flush to disk if true but - don't remove else remove without - flushing to disk */ - const trx_t* trx) /*!< to check if the operation must - be interrupted, can be 0 */ + buf_pool_t* buf_pool, + ulint id, + FlushObserver* observer) { buf_page_t* prev; buf_page_t* bpage; @@ -584,15 +578,27 @@ rescan: prev = UT_LIST_GET_PREV(list, bpage); - /* If flush observer is NULL, flush page for space id, - or flush page for flush observer. */ - if (observer ? (observer != bpage->flush_observer) - : (id != bpage->id.space())) { - - /* Skip this block, as it does not belong to - the target space. */ - - } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush)) { + /* Flush the pages matching space id, + or pages matching the flush observer. */ + if (observer && observer->is_partial_flush()) { + if (observer != bpage->flush_observer) { + /* Skip this block. */ + } else if (!buf_flush_or_remove_page( + buf_pool, bpage, + !observer->is_interrupted())) { + all_freed = false; + } else if (!observer->is_interrupted()) { + /* The processing was successful. And during the + processing we have released the buf_pool mutex + when calling buf_page_flush(). We cannot trust + prev pointer. */ + goto rescan; + } + } else if (id != bpage->id.space()) { + /* Skip this block, because it is for a + different tablespace. */ + } else if (!buf_flush_or_remove_page( + buf_pool, bpage, observer != NULL)) { /* Remove was unsuccessful, we have to try again by scanning the entire list from the end. @@ -615,7 +621,7 @@ rescan: iteration. */ all_freed = false; - } else if (flush) { + } else if (observer) { /* The processing was successful. And during the processing we have released the buf_pool mutex @@ -636,25 +642,14 @@ rescan: /* The check for trx is interrupted is expensive, we want to check every N iterations. */ - if (!processed && trx && trx_is_interrupted(trx)) { - if (trx->flush_observer != NULL) { - if (flush) { - trx->flush_observer->interrupted(); - } else { - /* We should remove all pages with the - the flush observer. */ - continue; - } - } - - buf_flush_list_mutex_exit(buf_pool); - return(DB_INTERRUPTED); + if (!processed && observer) { + observer->check_interrupted(); } } buf_flush_list_mutex_exit(buf_pool); - return(all_freed ? DB_SUCCESS : DB_FAIL); + return(all_freed); } /** Remove or flush all the dirty pages that belong to a given tablespace @@ -665,73 +660,58 @@ the tail of the LRU list. @param[in] id tablespace identifier @param[in] observer flush observer, or NULL if the files should not be written to -@param[in] trx transaction (to check for interrupt), - or NULL if the files should not be written to */ static void buf_flush_dirty_pages( buf_pool_t* buf_pool, ulint id, - FlushObserver* observer, - const trx_t* trx) + FlushObserver* observer) { - dberr_t err; - bool flush = trx != NULL; - - do { + for (;;) { buf_pool_mutex_enter(buf_pool); - err = buf_flush_or_remove_pages( - buf_pool, id, observer, flush, trx); + bool freed = buf_flush_or_remove_pages(buf_pool, id, observer); buf_pool_mutex_exit(buf_pool); ut_ad(buf_flush_validate(buf_pool)); - if (err == DB_FAIL) { - os_thread_sleep(2000); + if (freed) { + break; } - if (err == DB_INTERRUPTED && observer != NULL) { - ut_a(flush); - - flush = false; - err = DB_FAIL; - } - - /* DB_FAIL is a soft error, it means that the task wasn't - completed, needs to be retried. */ - + os_thread_sleep(2000); ut_ad(buf_flush_validate(buf_pool)); + } - } while (err == DB_FAIL); - - ut_ad(err == DB_INTERRUPTED + ut_ad((observer && observer->is_interrupted()) || buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0); } /** Empty the flush list for all pages belonging to a tablespace. @param[in] id tablespace identifier -@param[in] trx transaction, for checking for user interrupt; +@param[in] observer flush observer, or NULL if nothing is to be written @param[in] drop_ahi whether to drop the adaptive hash index */ void -buf_LRU_flush_or_remove_pages(ulint id, const trx_t* trx, bool drop_ahi) +buf_LRU_flush_or_remove_pages( + ulint id, + FlushObserver* observer, + bool drop_ahi) { - FlushObserver* observer = (trx == NULL) ? NULL : trx->flush_observer; /* Pages in the system tablespace must never be discarded. */ - ut_ad(id || trx); + ut_ad(id || observer); for (ulint i = 0; i < srv_buf_pool_instances; i++) { buf_pool_t* buf_pool = buf_pool_from_array(i); if (drop_ahi) { buf_LRU_drop_page_hash_for_tablespace(buf_pool, id); } - buf_flush_dirty_pages(buf_pool, id, observer, trx); + buf_flush_dirty_pages(buf_pool, id, observer); } - if (trx && !observer && !trx_is_interrupted(trx)) { + if (observer && !observer->is_interrupted()) { /* Ensure that all asynchronous IO is completed. */ os_aio_wait_until_no_pending_writes(); fil_flush(id); diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 3d1ee3f76e9..8f2c3231e1c 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -29,6 +29,7 @@ Created 25/08/2016 Jan Lindström #include "dict0defrag_bg.h" #include "row0mysql.h" #include "srv0start.h" +#include "trx0roll.h" #include "ut0new.h" #include @@ -201,17 +202,15 @@ dict_stats_defrag_pool_del( mutex_exit(&defrag_pool_mutex); } -/*****************************************************************//** -Get the first index that has been added for updating persistent defrag -stats and eventually save its stats. */ +/** Get the first index that has been added for updating persistent defrag +stats and eventually save its stats. +@param[in,out] trx transaction that will be started and committed */ static void -dict_stats_process_entry_from_defrag_pool() -/*=======================================*/ +dict_stats_process_entry_from_defrag_pool(trx_t* trx) { table_id_t table_id; index_id_t index_id; - dberr_t err = DB_SUCCESS; ut_ad(!srv_read_only_mode); @@ -230,96 +229,71 @@ dict_stats_process_entry_from_defrag_pool() table = dict_table_open_on_id(table_id, TRUE, DICT_TABLE_OP_OPEN_ONLY_IF_CACHED); - if (table == NULL) { + dict_index_t* index = table && !table->corrupted + ? dict_table_find_index_on_id(table, index_id) + : NULL; + + if (!index || dict_index_is_corrupted(index)) { + if (table) { + dict_table_close(table, TRUE, FALSE); + } mutex_exit(&dict_sys->mutex); return; } - /* Check whether table is corrupted */ - if (table->corrupted) { - dict_table_close(table, TRUE, FALSE); - mutex_exit(&dict_sys->mutex); - return; - } mutex_exit(&dict_sys->mutex); - - dict_index_t* index = dict_table_find_index_on_id(table, index_id); - - if (index == NULL) { - return; - } - - /* Check whether index is corrupted */ - if (dict_index_is_corrupted(index)) { - dict_table_close(table, FALSE, FALSE); - return; - } - - err = dict_stats_save_defrag_stats(index); + ++trx->will_lock; + dberr_t err = dict_stats_save_defrag_stats(index, trx); if (err != DB_SUCCESS) { + trx_rollback_to_savepoint(trx, NULL); ib::error() << "Saving defragmentation status for table " - << index->table->name.m_name - << " index " << index->name() + << index->table->name + << " index " << index->name << " failed " << err; + } else if (trx->state != TRX_STATE_NOT_STARTED) { + trx_commit_for_mysql(trx); } dict_table_close(table, FALSE, FALSE); } -/*****************************************************************//** -Get the first index that has been added for updating persistent defrag -stats and eventually save its stats. */ +/** Process indexes that have been scheduled for defragmenting. +@param[in,out] trx transaction that will be started and committed */ void -dict_defrag_process_entries_from_defrag_pool() -/*==========================================*/ +dict_defrag_process_entries_from_defrag_pool(trx_t* trx) { while (defrag_pool->size() && !dict_stats_start_shutdown) { - dict_stats_process_entry_from_defrag_pool(); + dict_stats_process_entry_from_defrag_pool(trx); } } -/*********************************************************************//** -Save defragmentation result. +/** Save defragmentation result. +@param[in] index index that was defragmented +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t -dict_stats_save_defrag_summary( -/*============================*/ - dict_index_t* index) /*!< in: index */ +dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx) { - dberr_t ret=DB_SUCCESS; - lint now = (lint) ut_time(); - if (dict_index_is_ibuf(index)) { return DB_SUCCESS; } - rw_lock_x_lock(dict_operation_lock); - mutex_enter(&dict_sys->mutex); - - ret = dict_stats_save_index_stat(index, now, "n_pages_freed", - index->stat_defrag_n_pages_freed, - NULL, - "Number of pages freed during" - " last defragmentation run.", - NULL); - - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - - return (ret); + return dict_stats_save_index_stat(index, ut_time(), "n_pages_freed", + index->stat_defrag_n_pages_freed, + NULL, + "Number of pages freed during" + " last defragmentation run.", + trx); } -/*********************************************************************//** -Save defragmentation stats for a given index. +/** Save defragmentation stats for a given index. +@param[in] index index that is being defragmented +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t -dict_stats_save_defrag_stats( -/*============================*/ - dict_index_t* index) /*!< in: index */ +dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx) { - dberr_t ret; - if (dict_index_is_ibuf(index)) { return DB_SUCCESS; } @@ -328,7 +302,6 @@ dict_stats_save_defrag_stats( return dict_stats_report_error(index->table, true); } - lint now = (lint) ut_time(); mtr_t mtr; ulint n_leaf_pages; ulint n_leaf_reserved; @@ -345,40 +318,33 @@ dict_stats_save_defrag_stats( return DB_SUCCESS; } - rw_lock_x_lock(dict_operation_lock); - - mutex_enter(&dict_sys->mutex); - ret = dict_stats_save_index_stat(index, now, "n_page_split", - index->stat_defrag_n_page_split, - NULL, - "Number of new page splits on leaves" - " since last defragmentation.", - NULL); - if (ret != DB_SUCCESS) { - goto end; + lint now = ut_time(); + dberr_t err = dict_stats_save_index_stat( + index, now, "n_page_split", + index->stat_defrag_n_page_split, + NULL, + "Number of new page splits on leaves" + " since last defragmentation.", + trx); + if (err == DB_SUCCESS) { + err = dict_stats_save_index_stat( + index, now, "n_leaf_pages_defrag", + n_leaf_pages, + NULL, + "Number of leaf pages when this stat is saved to disk", + trx); } - ret = dict_stats_save_index_stat( - index, now, "n_leaf_pages_defrag", - n_leaf_pages, - NULL, - "Number of leaf pages when this stat is saved to disk", - NULL); - if (ret != DB_SUCCESS) { - goto end; + if (err == DB_SUCCESS) { + err = dict_stats_save_index_stat( + index, now, "n_leaf_pages_reserved", + n_leaf_reserved, + NULL, + "Number of pages reserved for this " + "index leaves when this stat " + "is saved to disk", + trx); } - ret = dict_stats_save_index_stat( - index, now, "n_leaf_pages_reserved", - n_leaf_reserved, - NULL, - "Number of pages reserved for this index leaves when this stat " - "is saved to disk", - NULL); - -end: - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - - return (ret); + return err; } diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b07140b8dd7..5096a5003a0 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -6498,7 +6498,7 @@ dict_table_schema_check( } if (should_print) { - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "Table %s not found.", ut_format_name(req_schema->table_name, buf, sizeof(buf))); @@ -6512,7 +6512,7 @@ dict_table_schema_check( fil_space_get(table->space) == NULL) { /* missing tablespace */ - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "Tablespace for table %s is missing.", ut_format_name(req_schema->table_name, buf, sizeof(buf))); @@ -6522,12 +6522,12 @@ dict_table_schema_check( if (ulint(table->n_def - DATA_N_SYS_COLS) != req_schema->n_cols) { /* the table has a different number of columns than required */ - ut_snprintf(errstr, errstr_sz, - "%s has %d columns but should have " ULINTPF ".", - ut_format_name(req_schema->table_name, - buf, sizeof(buf)), - table->n_def - DATA_N_SYS_COLS, - req_schema->n_cols); + snprintf(errstr, errstr_sz, + "%s has %d columns but should have " ULINTPF ".", + ut_format_name(req_schema->table_name, buf, + sizeof buf), + table->n_def - DATA_N_SYS_COLS, + req_schema->n_cols); return(DB_ERROR); } @@ -6543,7 +6543,7 @@ dict_table_schema_check( if (j == table->n_def) { - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "required column %s" " not found in table %s.", req_schema->columns[i].name, @@ -6562,7 +6562,7 @@ dict_table_schema_check( CREATE_TYPES_NAMES(); - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "Column %s in table %s is %s" " but should be %s (length mismatch).", req_schema->columns[i].name, @@ -6586,7 +6586,7 @@ dict_table_schema_check( { CREATE_TYPES_NAMES(); - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "Column %s in table %s is %s" " but should be %s (type mismatch).", req_schema->columns[i].name, @@ -6605,7 +6605,7 @@ dict_table_schema_check( CREATE_TYPES_NAMES(); - ut_snprintf(errstr, errstr_sz, + snprintf(errstr, errstr_sz, "Column %s in table %s is %s" " but should be %s (flags mismatch).", req_schema->columns[i].name, @@ -6618,7 +6618,7 @@ dict_table_schema_check( } if (req_schema->n_foreign != table->foreign_set.size()) { - ut_snprintf( + snprintf( errstr, errstr_sz, "Table %s has " ULINTPF " foreign key(s) pointing" " to other tables, but it must have " ULINTPF ".", @@ -6630,7 +6630,7 @@ dict_table_schema_check( } if (req_schema->n_referenced != table->referenced_set.size()) { - ut_snprintf( + snprintf( errstr, errstr_sz, "There are " ULINTPF " foreign key(s) pointing to %s, " "but there must be " ULINTPF ".", @@ -6704,7 +6704,7 @@ dict_fs2utf8( &errors); if (errors != 0) { - ut_snprintf(table_utf8, table_utf8_size, "%s%s", + snprintf(table_utf8, table_utf8_size, "%s%s", srv_mysql50_table_name_prefix, table); } } diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 2bba95d2404..cdfc8b3ee19 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -1086,7 +1086,7 @@ dict_mem_create_temporary_tablename( size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10); name = static_cast(mem_heap_alloc(heap, size)); memcpy(name, dbtab, dblen); - ut_snprintf(name + dblen, size - dblen, + snprintf(name + dblen, size - dblen, TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF, id, dict_temp_file_num); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index e3d0effb5ac..5fa049f6b2b 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2009, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -276,9 +276,7 @@ This function will free the pinfo object. @param[in,out] pinfo pinfo to pass to que_eval_sql() must already have any literals bound to it @param[in] sql SQL string to execute -@param[in,out] trx in case of NULL the function will allocate and -free the trx object. If it is not NULL then it will be rolled back -only in the case of error, but not freed. +@param[in,out] trx transaction @return DB_SUCCESS or error code */ static dberr_t @@ -288,53 +286,12 @@ dict_stats_exec_sql( trx_t* trx) { dberr_t err; - bool trx_started = false; - - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); - - if (!dict_stats_persistent_storage_check(true)) { - pars_info_free(pinfo); - return(DB_STATS_DO_NOT_EXIST); - } - - if (trx == NULL) { - trx = trx_allocate_for_background(); - trx_started = true; - - if (srv_read_only_mode) { - trx_start_internal_read_only(trx); - } else { - trx_start_internal(trx); - } - } err = que_eval_sql(pinfo, sql, FALSE, trx); /* pinfo is freed here */ DBUG_EXECUTE_IF("stats_index_error", - if (!trx_started) { err = DB_STATS_DO_NOT_EXIST; - trx->error_state = DB_STATS_DO_NOT_EXIST; - }); - - if (!trx_started && err == DB_SUCCESS) { - return(DB_SUCCESS); - } - - if (err == DB_SUCCESS) { - trx_commit_for_mysql(trx); - } else { - trx->op_info = "rollback of internal trx on stats tables"; - trx->dict_operation_lock_mode = RW_X_LATCH; - trx_rollback_to_savepoint(trx, NULL); - trx->dict_operation_lock_mode = 0; - trx->op_info = ""; - ut_a(trx->error_state == DB_SUCCESS); - } - - if (trx_started) { - trx_free_for_background(trx); - } + trx->error_state = DB_STATS_DO_NOT_EXIST;); return(err); } @@ -543,39 +500,12 @@ dict_stats_empty_index( } } -/**********************************************************************//** -Clear defragmentation summary. */ -UNIV_INTERN +/** Reset the table and index statsistics, corresponding to an empty table. +@param[in,out] table table whose statistics are to be reset +@param[in] empty_defrag_stats whether to empty the defrag statistics +*/ void -dict_stats_empty_defrag_summary( -/*==================*/ - dict_index_t* index) /*!< in: index to clear defragmentation stats */ -{ - index->stat_defrag_n_pages_freed = 0; -} - -/**********************************************************************//** -Clear defragmentation related index stats. */ -UNIV_INTERN -void -dict_stats_empty_defrag_stats( -/*==================*/ - dict_index_t* index) /*!< in: index to clear defragmentation stats */ -{ - index->stat_defrag_modified_counter = 0; - index->stat_defrag_n_page_split = 0; -} - -/*********************************************************************//** -Write all zeros (or 1 where it makes sense) into a table and its indexes' -statistics members. The resulting stats correspond to an empty table. */ -static -void -dict_stats_empty_table( -/*===================*/ - dict_table_t* table, /*!< in/out: table */ - bool empty_defrag_stats) - /*!< in: whether to empty defrag stats */ +dict_stats_empty_table(dict_table_t* table, bool empty_defrag_stats) { /* Zero the stats members */ @@ -2329,9 +2259,7 @@ storage. @param[in] stat_value value of the stat @param[in] sample_size n pages sampled or NULL @param[in] stat_description description of the stat -@param[in,out] trx in case of NULL the function will -allocate and free the trx object. If it is not NULL then it will be -rolled back only in the case of error, but not freed. +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_save_index_stat( @@ -2348,8 +2276,7 @@ dict_stats_save_index_stat( char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); + ut_ad(trx->persistent_stats || trx->in_mysql_trx_list); dict_fs2utf8(index->table->name.m_name, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); @@ -2375,6 +2302,8 @@ dict_stats_save_index_stat( pars_info_add_str_literal(pinfo, "stat_description", stat_description); + mutex_enter(&dict_sys->mutex); + ret = dict_stats_exec_sql( pinfo, "PROCEDURE INDEX_STATS_SAVE () IS\n" @@ -2401,6 +2330,8 @@ dict_stats_save_index_stat( ");\n" "END;", trx); + mutex_exit(&dict_sys->mutex); + if (ret != DB_SUCCESS) { if (innodb_index_stats_not_found == false && index->stats_error_printed == false) { @@ -2453,6 +2384,7 @@ dict_stats_report_error(dict_table_t* table, bool defragment) /** Save the table's statistics into the persistent statistics storage. @param[in] table_orig table whose stats to save +@param[in,out] trx transaction @param[in] only_for_index if this is non-NULL, then stats for indexes that are not equal to it will not be saved, if NULL, then all indexes' stats are saved @@ -2461,7 +2393,8 @@ static dberr_t dict_stats_save( dict_table_t* table_orig, - const index_id_t* only_for_index) + trx_t* trx, + const index_id_t* only_for_index = NULL) { pars_info_t* pinfo; lint now; @@ -2470,6 +2403,8 @@ dict_stats_save( char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; + ut_ad(trx->persistent_stats || trx->in_mysql_trx_list); + if (table_orig->is_readable()) { } else { return (dict_stats_report_error(table_orig)); @@ -2480,9 +2415,6 @@ dict_stats_save( dict_fs2utf8(table->name.m_name, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); - rw_lock_x_lock(dict_operation_lock); - mutex_enter(&dict_sys->mutex); - /* MySQL's timestamp is 4 byte, so we use pars_info_add_int4_literal() which takes a lint arg, so "now" is lint */ @@ -2499,6 +2431,8 @@ dict_stats_save( pars_info_add_ull_literal(pinfo, "sum_of_other_index_sizes", table->stat_sum_of_other_index_sizes); + mutex_enter(&dict_sys->mutex); + ret = dict_stats_exec_sql( pinfo, "PROCEDURE TABLE_STATS_SAVE () IS\n" @@ -2519,33 +2453,18 @@ dict_stats_save( ":clustered_index_size,\n" ":sum_of_other_index_sizes\n" ");\n" - "END;", NULL); + "END;", trx); - if (ret != DB_SUCCESS) { - ib::error() << "Cannot save table statistics for table " - << table->name << ": " << ut_strerr(ret); + mutex_exit(&dict_sys->mutex); - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - - dict_stats_snapshot_free(table); - - return(ret); - } - - trx_t* trx = trx_allocate_for_background(); - - if (srv_read_only_mode) { - trx_start_internal_read_only(trx); - } else { - trx_start_internal(trx); - } - - dict_index_t* index; index_map_t indexes( (ut_strcmp_functor()), index_map_t_allocator(mem_key_dict_stats_index_map_t)); + if (ret != DB_SUCCESS) { + goto end; + } + /* Below we do all the modifications in innodb_index_stats in a single transaction for performance reasons. Modifying more than one row in a single transaction may deadlock with other transactions if they @@ -2558,18 +2477,17 @@ dict_stats_save( stat_name). This is why below we sort the indexes by name and then for each index, do the mods ordered by stat_name. */ - for (index = dict_table_get_first_index(table); + for (dict_index_t* index = dict_table_get_first_index(table); index != NULL; index = dict_table_get_next_index(index)) { indexes[index->name] = index; } - index_map_t::const_iterator it; + for (index_map_t::const_iterator it = indexes.begin(); + it != indexes.end(); ++it) { - for (it = indexes.begin(); it != indexes.end(); ++it) { - - index = it->second; + dict_index_t* index = it->second; if (only_for_index != NULL && index->id != *only_for_index) { continue; @@ -2586,21 +2504,20 @@ dict_stats_save( char stat_name[16]; char stat_description[1024]; - ut_snprintf(stat_name, sizeof(stat_name), - "n_diff_pfx%02u", i + 1); + snprintf(stat_name, sizeof(stat_name), + "n_diff_pfx%02u", i + 1); /* craft a string that contains the column names */ - ut_snprintf(stat_description, - sizeof(stat_description), - "%s", index->fields[0].name()); + snprintf(stat_description, sizeof(stat_description), + "%s", index->fields[0].name()); for (unsigned j = 1; j <= i; j++) { size_t len; len = strlen(stat_description); - ut_snprintf(stat_description + len, - sizeof(stat_description) - len, - ",%s", index->fields[j].name()); + snprintf(stat_description + len, + sizeof(stat_description) - len, + ",%s", index->fields[j].name()); } ret = dict_stats_save_index_stat( @@ -2633,13 +2550,11 @@ dict_stats_save( } } - trx_commit_for_mysql(trx); - + if (ret != DB_SUCCESS) { end: - trx_free_for_background(trx); - - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); + ib::error() << "Cannot save table statistics for table " + << table->name << ": " << ut_strerr(ret); + } dict_stats_snapshot_free(table); @@ -3137,12 +3052,13 @@ dict_stats_empty_defrag_modified_counter( } } -/*********************************************************************//** -Fetches or calculates new estimates for index statistics. */ -void -dict_stats_update_for_index( -/*========================*/ - dict_index_t* index) /*!< in/out: index */ +/** Calculate index statistics. +@param[in,out] index index tree +@param[in,out] trx transaction (for persistent statistics) +@return DB_SUCCESS or error code */ +UNIV_INTERN +dberr_t +dict_stats_update_for_index(dict_index_t* index, trx_t* trx) { DBUG_ENTER("dict_stats_update_for_index"); @@ -3154,8 +3070,8 @@ dict_stats_update_for_index( dict_table_stats_lock(index->table, RW_X_LATCH); dict_stats_analyze_index(index); dict_table_stats_unlock(index->table, RW_X_LATCH); - dict_stats_save(index->table, &index->id); - DBUG_VOID_RETURN; + DBUG_RETURN(dict_stats_save(index->table, trx, + &index->id)); } /* else */ @@ -3178,22 +3094,20 @@ dict_stats_update_for_index( dict_stats_update_transient_for_index(index); dict_table_stats_unlock(index->table, RW_X_LATCH); - DBUG_VOID_RETURN; + DBUG_RETURN(DB_SUCCESS); } -/*********************************************************************//** -Calculates new estimates for table and index statistics. The statistics -are used in query optimization. -@return DB_SUCCESS or error code */ +/** Calculate new estimates for table and index statistics. +@param[in,out] table table +@param[in] stats_upd_option how to update statistics +@param[in,out] trx transaction +@return DB_* error code or DB_SUCCESS */ +UNIV_INTERN dberr_t dict_stats_update( -/*==============*/ - dict_table_t* table, /*!< in/out: table */ - dict_stats_upd_option_t stats_upd_option) - /*!< in: whether to (re) calc - the stats or to fetch them from - the persistent statistics - storage */ + dict_table_t* table, + dict_stats_upd_option_t stats_upd_option, + trx_t* trx) { ut_ad(!mutex_own(&dict_sys->mutex)); @@ -3238,7 +3152,7 @@ dict_stats_update( return(err); } - err = dict_stats_save(table, NULL); + err = dict_stats_save(table, trx); return(err); } @@ -3274,7 +3188,7 @@ dict_stats_update( if (dict_stats_persistent_storage_check(false)) { - return(dict_stats_save(table, NULL)); + return(dict_stats_save(table, trx)); } return(DB_STATS_DO_NOT_EXIST); @@ -3353,9 +3267,9 @@ dict_stats_update( } if (dict_stats_auto_recalc_is_enabled(table)) { - return(dict_stats_update( - table, - DICT_STATS_RECALC_PERSISTENT)); + return dict_stats_update( + table, DICT_STATS_RECALC_PERSISTENT, + trx); } ib::info() << "Trying to use table " << table->name @@ -3403,25 +3317,20 @@ transient: return(DB_SUCCESS); } -/*********************************************************************//** -Removes the information for a particular index's stats from the persistent -storage if it exists and if there is data stored for this index. -This function creates its own trx and commits it. -A note from Marko why we cannot edit user and sys_* tables in one trx: -marko: The problem is that ibuf merges should be disabled while we are -rolling back dict transactions. -marko: If ibuf merges are not disabled, we need to scan the *.ibd files. -But we shouldn't open *.ibd files before we have rolled back dict -transactions and opened the SYS_* records for the *.ibd files. +/** Remove the persistent statistics for an index. +@param[in] db_and_table schema and table name, e.g., 'db/table' +@param[in] iname index name +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_drop_index( -/*==================*/ - const char* db_and_table,/*!< in: db and table, e.g. 'db/table' */ - const char* iname, /*!< in: index name */ - char* errstr, /*!< out: error message if != DB_SUCCESS - is returned */ - ulint errstr_sz)/*!< in: size of the errstr buffer */ + const char* db_and_table, + const char* iname, + char* errstr, + size_t errstr_sz, + trx_t* trx) { char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; @@ -3437,6 +3346,11 @@ dict_stats_drop_index( return(DB_SUCCESS); } + if (!dict_stats_persistent_storage_check(false)) { + /* Statistics tables do not exist. */ + return(DB_SUCCESS); + } + dict_fs2utf8(db_and_table, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); @@ -3448,7 +3362,6 @@ dict_stats_drop_index( pars_info_add_str_literal(pinfo, "index_name", iname); - rw_lock_x_lock(dict_operation_lock); mutex_enter(&dict_sys->mutex); ret = dict_stats_exec_sql( @@ -3459,33 +3372,35 @@ dict_stats_drop_index( "database_name = :database_name AND\n" "table_name = :table_name AND\n" "index_name = :index_name;\n" - "END;\n", NULL); + "END;\n", trx); mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - if (ret == DB_STATS_DO_NOT_EXIST) { - ret = DB_SUCCESS; - } - - if (ret != DB_SUCCESS) { - ut_snprintf(errstr, errstr_sz, - "Unable to delete statistics for index %s" - " from %s%s: %s. They can be deleted later using" - " DELETE FROM %s WHERE" - " database_name = '%s' AND" - " table_name = '%s' AND" - " index_name = '%s';", - iname, - INDEX_STATS_NAME_PRINT, - (ret == DB_LOCK_WAIT_TIMEOUT - ? " because the rows are locked" - : ""), - ut_strerr(ret), - INDEX_STATS_NAME_PRINT, - db_utf8, - table_utf8, - iname); + switch (ret) { + case DB_STATS_DO_NOT_EXIST: + case DB_SUCCESS: + return(DB_SUCCESS); + case DB_QUE_THR_SUSPENDED: + ret = DB_LOCK_WAIT; + /* fall through */ + default: + snprintf(errstr, errstr_sz, + "Unable to delete statistics for index %s" + " from %s%s: %s. They can be deleted later using" + " DELETE FROM %s WHERE" + " database_name = '%s' AND" + " table_name = '%s' AND" + " index_name = '%s';", + iname, + INDEX_STATS_NAME_PRINT, + (ret == DB_LOCK_WAIT_TIMEOUT + ? " because the rows are locked" + : ""), + ut_strerr(ret), + INDEX_STATS_NAME_PRINT, + db_utf8, + table_utf8, + iname); ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: %s\n", errstr); @@ -3494,98 +3409,71 @@ dict_stats_drop_index( return(ret); } -/*********************************************************************//** -Executes -DELETE FROM mysql.innodb_table_stats -WHERE database_name = '...' AND table_name = '...'; -Creates its own transaction and commits it. +/** Delete table statistics. +@param[in] db schema name +@param[in] t table name +@param[in,out] trx transaction @return DB_SUCCESS or error code */ UNIV_INLINE dberr_t -dict_stats_delete_from_table_stats( -/*===============================*/ - const char* database_name, /*!< in: database name, e.g. 'db' */ - const char* table_name) /*!< in: table name, e.g. 'table' */ +dict_stats_delete_from_table_stats(const char* db, const char* t, trx_t* trx) { - pars_info_t* pinfo; - dberr_t ret; + pars_info_t* pinfo = pars_info_create(); - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); + pars_info_add_str_literal(pinfo, "database_name", db); + pars_info_add_str_literal(pinfo, "table_name", t); - pinfo = pars_info_create(); - - pars_info_add_str_literal(pinfo, "database_name", database_name); - pars_info_add_str_literal(pinfo, "table_name", table_name); - - ret = dict_stats_exec_sql( + return dict_stats_exec_sql( pinfo, "PROCEDURE DELETE_FROM_TABLE_STATS () IS\n" "BEGIN\n" "DELETE FROM \"" TABLE_STATS_NAME "\" WHERE\n" "database_name = :database_name AND\n" "table_name = :table_name;\n" - "END;\n", NULL); - - return(ret); + "END;\n", trx); } -/*********************************************************************//** -Executes -DELETE FROM mysql.innodb_index_stats -WHERE database_name = '...' AND table_name = '...'; -Creates its own transaction and commits it. +/** Delete index statistics. +@param[in] db schema name +@param[in] t table name +@param[in,out] trx transaction @return DB_SUCCESS or error code */ UNIV_INLINE dberr_t -dict_stats_delete_from_index_stats( -/*===============================*/ - const char* database_name, /*!< in: database name, e.g. 'db' */ - const char* table_name) /*!< in: table name, e.g. 'table' */ +dict_stats_delete_from_index_stats(const char* db, const char* t, trx_t* trx) { - pars_info_t* pinfo; - dberr_t ret; + pars_info_t* pinfo = pars_info_create(); - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); + pars_info_add_str_literal(pinfo, "database_name", db); + pars_info_add_str_literal(pinfo, "table_name", t); - pinfo = pars_info_create(); - - pars_info_add_str_literal(pinfo, "database_name", database_name); - pars_info_add_str_literal(pinfo, "table_name", table_name); - - ret = dict_stats_exec_sql( + return dict_stats_exec_sql( pinfo, "PROCEDURE DELETE_FROM_INDEX_STATS () IS\n" "BEGIN\n" "DELETE FROM \"" INDEX_STATS_NAME "\" WHERE\n" "database_name = :database_name AND\n" "table_name = :table_name;\n" - "END;\n", NULL); - - return(ret); + "END;\n", trx); } -/*********************************************************************//** -Removes the statistics for a table and all of its indexes from the -persistent statistics storage if it exists and if there is data stored for -the table. This function creates its own transaction and commits it. +/** Remove the persistent statistics for a table and all of its indexes. +@param[in] db_and_table schema and table name, e.g., 'db/table' +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_drop_table( -/*==================*/ - const char* db_and_table, /*!< in: db and table, e.g. 'db/table' */ - char* errstr, /*!< out: error message - if != DB_SUCCESS is returned */ - ulint errstr_sz) /*!< in: size of errstr buffer */ + const char* db_and_table, + char* errstr, + size_t errstr_sz, + trx_t* trx) { char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; dberr_t ret; - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); - /* skip tables that do not contain a database name e.g. if we are dropping SYS_TABLES */ if (strchr(db_and_table, '/') == NULL) { @@ -3600,76 +3488,78 @@ dict_stats_drop_table( return(DB_SUCCESS); } + if (!dict_stats_persistent_storage_check(true)) { + /* Statistics tables do not exist. */ + return(DB_SUCCESS); + } + dict_fs2utf8(db_and_table, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); - ret = dict_stats_delete_from_table_stats(db_utf8, table_utf8); + ret = dict_stats_delete_from_table_stats(db_utf8, table_utf8, trx); if (ret == DB_SUCCESS) { - ret = dict_stats_delete_from_index_stats(db_utf8, table_utf8); + ret = dict_stats_delete_from_index_stats( + db_utf8, table_utf8, trx); } - if (ret == DB_STATS_DO_NOT_EXIST) { - ret = DB_SUCCESS; - } + switch (ret) { + case DB_SUCCESS: + case DB_STATS_DO_NOT_EXIST: + return(DB_SUCCESS); + case DB_QUE_THR_SUSPENDED: + ret = DB_LOCK_WAIT; + /* fall through */ + default: + snprintf(errstr, errstr_sz, + "Unable to delete statistics for table %s.%s: %s. " + "They can be deleted later using " - if (ret != DB_SUCCESS) { + " DELETE FROM %s WHERE" + " database_name = '%s' AND" + " table_name = '%s';" - ut_snprintf(errstr, errstr_sz, - "Unable to delete statistics for table %s.%s: %s." - " They can be deleted later using" + " DELETE FROM %s WHERE" + " database_name = '%s' AND" + " table_name = '%s';", - " DELETE FROM %s WHERE" - " database_name = '%s' AND" - " table_name = '%s';" + db_utf8, table_utf8, + ut_strerr(ret), - " DELETE FROM %s WHERE" - " database_name = '%s' AND" - " table_name = '%s';", + INDEX_STATS_NAME_PRINT, + db_utf8, table_utf8, - db_utf8, table_utf8, - ut_strerr(ret), - - INDEX_STATS_NAME_PRINT, - db_utf8, table_utf8, - - TABLE_STATS_NAME_PRINT, - db_utf8, table_utf8); + TABLE_STATS_NAME_PRINT, + db_utf8, table_utf8); } return(ret); } -/*********************************************************************//** -Executes -UPDATE mysql.innodb_table_stats SET -database_name = '...', table_name = '...' -WHERE database_name = '...' AND table_name = '...'; -Creates its own transaction and commits it. +/** Rename table statistics. +@param[in] old_dbname_utf8 old schema name +@param[in] old_tablename_utf8 old table name +@param[in] new_dbname_utf8 new schema name +@param[in] new_tablename_utf8 new schema name +@param[in,out] trx transaction @return DB_SUCCESS or error code */ UNIV_INLINE dberr_t -dict_stats_rename_table_in_table_stats( -/*===================================*/ - const char* old_dbname_utf8,/*!< in: database name, e.g. 'olddb' */ - const char* old_tablename_utf8,/*!< in: table name, e.g. 'oldtable' */ - const char* new_dbname_utf8,/*!< in: database name, e.g. 'newdb' */ - const char* new_tablename_utf8)/*!< in: table name, e.g. 'newtable' */ +dict_stats_rename_in_table_stats( + const char* old_dbname_utf8, + const char* old_tablename_utf8, + const char* new_dbname_utf8, + const char* new_tablename_utf8, + trx_t* trx) { - pars_info_t* pinfo; - dberr_t ret; - - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); - - pinfo = pars_info_create(); + pars_info_t* pinfo = pars_info_create(); pars_info_add_str_literal(pinfo, "old_dbname_utf8", old_dbname_utf8); pars_info_add_str_literal(pinfo, "old_tablename_utf8", old_tablename_utf8); pars_info_add_str_literal(pinfo, "new_dbname_utf8", new_dbname_utf8); pars_info_add_str_literal(pinfo, "new_tablename_utf8", new_tablename_utf8); - ret = dict_stats_exec_sql( + return dict_stats_exec_sql( pinfo, "PROCEDURE RENAME_TABLE_IN_TABLE_STATS () IS\n" "BEGIN\n" @@ -3679,41 +3569,33 @@ dict_stats_rename_table_in_table_stats( "WHERE\n" "database_name = :old_dbname_utf8 AND\n" "table_name = :old_tablename_utf8;\n" - "END;\n", NULL); - - return(ret); + "END;\n", trx); } -/*********************************************************************//** -Executes -UPDATE mysql.innodb_index_stats SET -database_name = '...', table_name = '...' -WHERE database_name = '...' AND table_name = '...'; -Creates its own transaction and commits it. +/** Rename index statistics. +@param[in] old_dbname_utf8 old schema name +@param[in] old_tablename_utf8 old table name +@param[in] new_dbname_utf8 new schema name +@param[in] new_tablename_utf8 new schema name +@param[in,out] trx transaction @return DB_SUCCESS or error code */ UNIV_INLINE dberr_t -dict_stats_rename_table_in_index_stats( -/*===================================*/ - const char* old_dbname_utf8,/*!< in: database name, e.g. 'olddb' */ - const char* old_tablename_utf8,/*!< in: table name, e.g. 'oldtable' */ - const char* new_dbname_utf8,/*!< in: database name, e.g. 'newdb' */ - const char* new_tablename_utf8)/*!< in: table name, e.g. 'newtable' */ +dict_stats_rename_in_index_stats( + const char* old_dbname_utf8, + const char* old_tablename_utf8, + const char* new_dbname_utf8, + const char* new_tablename_utf8, + trx_t* trx) { - pars_info_t* pinfo; - dberr_t ret; - - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(mutex_own(&dict_sys->mutex)); - - pinfo = pars_info_create(); + pars_info_t* pinfo = pars_info_create(); pars_info_add_str_literal(pinfo, "old_dbname_utf8", old_dbname_utf8); pars_info_add_str_literal(pinfo, "old_tablename_utf8", old_tablename_utf8); pars_info_add_str_literal(pinfo, "new_dbname_utf8", new_dbname_utf8); pars_info_add_str_literal(pinfo, "new_tablename_utf8", new_tablename_utf8); - ret = dict_stats_exec_sql( + return dict_stats_exec_sql( pinfo, "PROCEDURE RENAME_TABLE_IN_INDEX_STATS () IS\n" "BEGIN\n" @@ -3723,23 +3605,23 @@ dict_stats_rename_table_in_index_stats( "WHERE\n" "database_name = :old_dbname_utf8 AND\n" "table_name = :old_tablename_utf8;\n" - "END;\n", NULL); - - return(ret); + "END;\n", trx); } -/*********************************************************************//** -Renames a table in InnoDB persistent stats storage. -This function creates its own transaction and commits it. +/** Rename a table in the InnoDB persistent statistics storage. +@param[in] old_name old schema and table name, e.g., 'db/table' +@param[in] new_name new schema and table name, e.g., 'db/table' +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_rename_table( -/*====================*/ - const char* old_name, /*!< in: old name, e.g. 'db/table' */ - const char* new_name, /*!< in: new name, e.g. 'db/table' */ - char* errstr, /*!< out: error string if != DB_SUCCESS - is returned */ - size_t errstr_sz) /*!< in: errstr size */ + const char* old_name, + const char* new_name, + char* errstr, + size_t errstr_sz, + trx_t* trx) { char old_db_utf8[MAX_DB_UTF8_LEN]; char new_db_utf8[MAX_DB_UTF8_LEN]; @@ -3747,9 +3629,6 @@ dict_stats_rename_table( char new_table_utf8[MAX_TABLE_UTF8_LEN]; dberr_t ret; - ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_X)); - ut_ad(!mutex_own(&dict_sys->mutex)); - /* skip innodb_table_stats and innodb_index_stats themselves */ if (strcmp(old_name, TABLE_STATS_NAME) == 0 || strcmp(old_name, INDEX_STATS_NAME) == 0 @@ -3759,124 +3638,115 @@ dict_stats_rename_table( return(DB_SUCCESS); } + if (!dict_stats_persistent_storage_check(false)) { + /* Statistics tables do not exist. */ + return(DB_SUCCESS); + } + dict_fs2utf8(old_name, old_db_utf8, sizeof(old_db_utf8), old_table_utf8, sizeof(old_table_utf8)); dict_fs2utf8(new_name, new_db_utf8, sizeof(new_db_utf8), new_table_utf8, sizeof(new_table_utf8)); - rw_lock_x_lock(dict_operation_lock); - mutex_enter(&dict_sys->mutex); - ulint n_attempts = 0; do { - n_attempts++; + trx_savept_t savept = trx_savept_take(trx); - ret = dict_stats_rename_table_in_table_stats( + mutex_enter(&dict_sys->mutex); + + ret = dict_stats_rename_in_table_stats( old_db_utf8, old_table_utf8, - new_db_utf8, new_table_utf8); + new_db_utf8, new_table_utf8, trx); - if (ret == DB_DUPLICATE_KEY) { - dict_stats_delete_from_table_stats( - new_db_utf8, new_table_utf8); - } + mutex_exit(&dict_sys->mutex); - if (ret == DB_STATS_DO_NOT_EXIST) { - ret = DB_SUCCESS; - } - - if (ret != DB_SUCCESS) { - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - os_thread_sleep(200000 /* 0.2 sec */); - rw_lock_x_lock(dict_operation_lock); + switch (ret) { + case DB_DUPLICATE_KEY: + trx_rollback_to_savepoint(trx, &savept); mutex_enter(&dict_sys->mutex); + dict_stats_delete_from_table_stats( + new_db_utf8, new_table_utf8, trx); + mutex_exit(&dict_sys->mutex); + /* fall through */ + case DB_DEADLOCK: + case DB_LOCK_WAIT_TIMEOUT: + os_thread_sleep(200000 /* 0.2 sec */); + continue; + case DB_STATS_DO_NOT_EXIST: + ret = DB_SUCCESS; + break; + default: + break; } - } while ((ret == DB_DEADLOCK - || ret == DB_DUPLICATE_KEY - || ret == DB_LOCK_WAIT_TIMEOUT) - && n_attempts < 5); + + break; + } while (++n_attempts < 5); + + const char* table_name = TABLE_STATS_NAME_PRINT; if (ret != DB_SUCCESS) { - ut_snprintf(errstr, errstr_sz, - "Unable to rename statistics from" - " %s.%s to %s.%s in %s: %s." - " They can be renamed later using" - - " UPDATE %s SET" - " database_name = '%s'," - " table_name = '%s'" - " WHERE" - " database_name = '%s' AND" - " table_name = '%s';", - - old_db_utf8, old_table_utf8, - new_db_utf8, new_table_utf8, - TABLE_STATS_NAME_PRINT, - ut_strerr(ret), - - TABLE_STATS_NAME_PRINT, - new_db_utf8, new_table_utf8, - old_db_utf8, old_table_utf8); - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - return(ret); + goto err_exit; } - /* else */ + + table_name = INDEX_STATS_NAME_PRINT; n_attempts = 0; do { - n_attempts++; + trx_savept_t savept = trx_savept_take(trx); - ret = dict_stats_rename_table_in_index_stats( + mutex_enter(&dict_sys->mutex); + + ret = dict_stats_rename_in_index_stats( old_db_utf8, old_table_utf8, - new_db_utf8, new_table_utf8); + new_db_utf8, new_table_utf8, trx); - if (ret == DB_DUPLICATE_KEY) { - dict_stats_delete_from_index_stats( - new_db_utf8, new_table_utf8); - } + mutex_exit(&dict_sys->mutex); - if (ret == DB_STATS_DO_NOT_EXIST) { - ret = DB_SUCCESS; - } - - if (ret != DB_SUCCESS) { - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); - os_thread_sleep(200000 /* 0.2 sec */); - rw_lock_x_lock(dict_operation_lock); + switch (ret) { + case DB_DUPLICATE_KEY: + trx_rollback_to_savepoint(trx, &savept); mutex_enter(&dict_sys->mutex); + dict_stats_delete_from_index_stats( + new_db_utf8, new_table_utf8, trx); + mutex_exit(&dict_sys->mutex); + /* fall through */ + case DB_DEADLOCK: + case DB_LOCK_WAIT_TIMEOUT: + os_thread_sleep(200000 /* 0.2 sec */); + continue; + case DB_STATS_DO_NOT_EXIST: + ret = DB_SUCCESS; + break; + default: + break; } - } while ((ret == DB_DEADLOCK - || ret == DB_DUPLICATE_KEY - || ret == DB_LOCK_WAIT_TIMEOUT) - && n_attempts < 5); - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(dict_operation_lock); + break; + } while (++n_attempts < 5); if (ret != DB_SUCCESS) { - ut_snprintf(errstr, errstr_sz, - "Unable to rename statistics from" - " %s.%s to %s.%s in %s: %s." - " They can be renamed later using" +err_exit: + snprintf(errstr, errstr_sz, + "Unable to rename statistics from" + " %s.%s to %s.%s in %s: %s." + " They can be renamed later using" - " UPDATE %s SET" - " database_name = '%s'," - " table_name = '%s'" - " WHERE" - " database_name = '%s' AND" - " table_name = '%s';", + " UPDATE %s SET" + " database_name = '%s'," + " table_name = '%s'" + " WHERE" + " database_name = '%s' AND" + " table_name = '%s';", - old_db_utf8, old_table_utf8, - new_db_utf8, new_table_utf8, - INDEX_STATS_NAME_PRINT, - ut_strerr(ret), + old_db_utf8, old_table_utf8, + new_db_utf8, new_table_utf8, + table_name, + ut_strerr(ret), - INDEX_STATS_NAME_PRINT, - new_db_utf8, new_table_utf8, - old_db_utf8, old_table_utf8); + table_name, + new_db_utf8, new_table_utf8, + old_db_utf8, old_table_utf8); } return(ret); @@ -3979,7 +3849,7 @@ test_dict_table_schema_check() }; char errstr[512]; - ut_snprintf(errstr, sizeof(errstr), "Table not found"); + snprintf(errstr, sizeof(errstr), "Table not found"); /* prevent any data dictionary modifications while we are checking the tables' structure */ diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index 133e7904c94..0f76c73bc96 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -32,6 +32,7 @@ Created Apr 25, 2012 Vasil Dimov #include "srv0start.h" #include "ut0new.h" #include "fil0fil.h" +#include "trx0trx.h" #include @@ -180,7 +181,7 @@ dict_stats_update_if_needed(dict_table_t* table) if (counter > threshold) { /* this will reset table->stat_modified_counter to 0 */ - dict_stats_update(table, DICT_STATS_RECALC_TRANSIENT); + dict_stats_update(table, DICT_STATS_RECALC_TRANSIENT, NULL); } } @@ -280,10 +281,10 @@ dict_stats_thread_init() 1) the background stats gathering thread before any other latch and released without latching anything else in between (thus any level would do here) - 2) from row_update_statistics_if_needed() + 2) from dict_stats_update_if_needed() and released without latching anything else in between. We know that dict_sys->mutex (SYNC_DICT) is not acquired when - row_update_statistics_if_needed() is called and it may be acquired + dict_stats_update_if_needed() is called and it may be acquired inside that function (thus a level <=SYNC_DICT would do). 3) from row_drop_table_for_mysql() after dict_sys->mutex (SYNC_DICT) and dict_operation_lock (SYNC_DICT_OPERATION) have been locked @@ -323,8 +324,7 @@ Get the first table that has been added for auto recalc and eventually update its stats. */ static void -dict_stats_process_entry_from_recalc_pool() -/*=======================================*/ +dict_stats_process_entry_from_recalc_pool(trx_t* trx) { table_id_t table_id; @@ -378,8 +378,11 @@ dict_stats_process_entry_from_recalc_pool() dict_stats_recalc_pool_add(table); } else { - - dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT); + ++trx->will_lock; + dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT, trx); + if (trx->state != TRX_STATE_NOT_STARTED) { + trx_commit_for_mysql(trx); + } } mutex_enter(&dict_sys->mutex); @@ -440,6 +443,9 @@ DECLARE_THREAD(dict_stats_thread)(void*) */ #endif /* UNIV_PFS_THREAD */ + trx_t* trx = trx_allocate_for_background(); + ut_d(trx->persistent_stats = true); + while (!dict_stats_start_shutdown) { /* Wake up periodically even if not signaled. This is @@ -465,12 +471,14 @@ DECLARE_THREAD(dict_stats_thread)(void*) break; } - dict_stats_process_entry_from_recalc_pool(); - dict_defrag_process_entries_from_defrag_pool(); + dict_stats_process_entry_from_recalc_pool(trx); + dict_defrag_process_entries_from_defrag_pool(trx); os_event_reset(dict_stats_event); } + ut_d(trx->persistent_stats = false); + trx_free_for_background(trx); srv_dict_stats_thread_active = false; os_event_set(dict_stats_shutdown_event); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 90a3baa6f83..3b496e3959f 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2907,7 +2907,10 @@ fil_close_tablespace( completely and permanently. The flag stop_new_ops also prevents fil_flush() from being applied to this tablespace. */ - buf_LRU_flush_or_remove_pages(id, trx); + { + FlushObserver observer(id, trx, NULL); + buf_LRU_flush_or_remove_pages(id, &observer); + } /* If the free is successful, the X lock will be released before the space memory data structure is freed. */ diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc index 4d41df1abf9..7ad7459ea6a 100644 --- a/storage/innobase/fts/fts0config.cc +++ b/storage/innobase/fts/fts0config.cc @@ -349,7 +349,7 @@ fts_config_set_index_ulint( // FIXME: Get rid of snprintf ut_a(FTS_MAX_INT_LEN < FTS_MAX_CONFIG_VALUE_LEN); - value.f_len = ut_snprintf( + value.f_len = snprintf( (char*) value.f_str, FTS_MAX_INT_LEN, ULINTPF, int_value); error = fts_config_set_index_value(trx, index, name, &value); @@ -422,7 +422,7 @@ fts_config_set_ulint( ut_a(FTS_MAX_INT_LEN < FTS_MAX_CONFIG_VALUE_LEN); - value.f_len = my_snprintf( + value.f_len = snprintf( (char*) value.f_str, FTS_MAX_INT_LEN, ULINTPF, int_value); error = fts_config_set_value(trx, fts_table, name, &value); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 8e9c897274b..32cd56e78eb 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2833,7 +2833,7 @@ fts_update_sync_doc_id( info = pars_info_create(); - id_len = ut_snprintf( + id_len = snprintf( (char*) id, sizeof(id), FTS_DOC_ID_FORMAT, doc_id + 1); pars_info_bind_varchar_literal(info, "doc_id", id, id_len); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b1f706a03ec..2fc1b00851e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6281,7 +6281,21 @@ no_such_table: /* No point to init any statistics if tablespace is still encrypted. */ if (ib_table->is_readable()) { - dict_stats_init(ib_table); + trx_t* trx = check_trx_exists(thd); + bool alloc = !trx_state_eq(trx, TRX_STATE_NOT_STARTED); + + if (alloc) { + trx = trx_allocate_for_background(); + } + ut_ad(!trx->persistent_stats); + ut_d(trx->persistent_stats = true); + ++trx->will_lock; + dict_stats_init(ib_table, trx); + innobase_commit_low(trx); + ut_d(trx->persistent_stats = false); + if (alloc) { + trx_free_for_background(trx); + } } else { ib_table->stat_initialized = 1; } @@ -13053,7 +13067,9 @@ create_table_info_t::create_table_update_dict() innobase_copy_frm_flags_from_create_info(innobase_table, m_create_info); - dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE); + ++m_trx->will_lock; + dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE, m_trx); + innobase_commit_low(m_trx); /* Load server stopword into FTS cache */ if (m_flags2 & DICT_TF2_FTS) { @@ -13310,7 +13326,8 @@ ha_innobase::discard_or_import_tablespace( /* Adjust the persistent statistics. */ ret = dict_stats_update(dict_table, - DICT_STATS_RECALC_PERSISTENT); + DICT_STATS_RECALC_PERSISTENT, + m_prebuilt->trx); if (ret != DB_SUCCESS) { push_warning_printf( @@ -13318,8 +13335,11 @@ ha_innobase::discard_or_import_tablespace( Sql_condition::WARN_LEVEL_WARN, ER_ALTER_INFO, "Error updating stats for table '%s'" - " after table rebuild: %s", + " after table import: %s", dict_table->name.m_name, ut_strerr(ret)); + trx_rollback_to_savepoint(m_prebuilt->trx, NULL); + } else { + trx_commit_for_mysql(m_prebuilt->trx); } } @@ -13798,8 +13818,6 @@ ha_innobase::rename_table( innobase_commit_low(trx); - trx_free_for_mysql(trx); - if (error == DB_SUCCESS) { char norm_from[MAX_FULL_NAME_LEN]; char norm_to[MAX_FULL_NAME_LEN]; @@ -13809,17 +13827,23 @@ ha_innobase::rename_table( normalize_table_name(norm_from, from); normalize_table_name(norm_to, to); + ++trx->will_lock; ret = dict_stats_rename_table(norm_from, norm_to, - errstr, sizeof(errstr)); + errstr, sizeof errstr, trx); if (ret != DB_SUCCESS) { + trx_rollback_to_savepoint(trx, NULL); ib::error() << errstr; push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_LOCK_WAIT_TIMEOUT, errstr); + } else { + innobase_commit_low(trx); } } + trx_free_for_mysql(trx); + /* Add a special case to handle the Duplicated Key error and return DB_ERROR instead. This is to avoid a possible SIGSEGV error from mysql error @@ -14356,17 +14380,33 @@ ha_innobase::info_low( } ut_ad(!mutex_own(&dict_sys->mutex)); - ret = dict_stats_update(ib_table, opt); + /* Do not use prebuilt->trx in case this is + called in the middle of a transaction. We + should commit the transaction after + dict_stats_update() in order not to hog locks + on the mysql.innodb_table_stats, + mysql.innodb_index_stats tables. */ + trx_t* trx = trx_allocate_for_background(); + ut_d(trx->persistent_stats = true); + ++trx->will_lock; + ret = dict_stats_update(ib_table, opt, trx); if (ret != DB_SUCCESS) { m_prebuilt->trx->op_info = ""; - DBUG_RETURN(HA_ERR_GENERIC); + trx_rollback_to_savepoint(trx, NULL); + } else { + m_prebuilt->trx->op_info = + "returning various info to MySQL"; + trx_commit_for_mysql(trx); } - m_prebuilt->trx->op_info = - "returning various info to MariaDB"; - } + ut_d(trx->persistent_stats = false); + trx_free_for_background(trx); + if (ret != DB_SUCCESS) { + DBUG_RETURN(HA_ERR_GENERIC); + } + } stats.update_time = (ulong) ib_table->update_time; } @@ -14632,9 +14672,9 @@ ha_innobase::info_low( dict_table_stats_unlock(ib_table, RW_S_LATCH); } - my_snprintf(path, sizeof(path), "%s/%s%s", - mysql_data_home, table->s->normalized_path.str, - reg_ext); + snprintf(path, sizeof(path), "%s/%s%s", + mysql_data_home, table->s->normalized_path.str, + reg_ext); unpack_filename(path,path); @@ -16485,13 +16525,13 @@ ShowStatus::to_string( int name_len; char name_buf[IO_SIZE]; - name_len = ut_snprintf( + name_len = snprintf( name_buf, sizeof(name_buf), "%s", it->m_name.c_str()); int status_len; char status_buf[IO_SIZE]; - status_len = ut_snprintf( + status_len = snprintf( status_buf, sizeof(status_buf), "spins=%lu,waits=%lu,calls=%llu", static_cast(it->m_spins), @@ -16578,7 +16618,7 @@ innodb_show_rwlock_status( continue; } - buf1len = ut_snprintf( + buf1len = snprintf( buf1, sizeof buf1, "rwlock: %s:%u", innobase_basename(rw_lock->cfile_name), rw_lock->cline); @@ -16586,7 +16626,7 @@ innodb_show_rwlock_status( int buf2len; char buf2[IO_SIZE]; - buf2len = ut_snprintf( + buf2len = snprintf( buf2, sizeof buf2, "waits=%u", rw_lock->count_os_wait); @@ -16606,7 +16646,7 @@ innodb_show_rwlock_status( int buf1len; char buf1[IO_SIZE]; - buf1len = ut_snprintf( + buf1len = snprintf( buf1, sizeof buf1, "sum rwlock: %s:%u", innobase_basename(block_rwlock->cfile_name), block_rwlock->cline); @@ -16614,7 +16654,7 @@ innodb_show_rwlock_status( int buf2len; char buf2[IO_SIZE]; - buf2len = ut_snprintf( + buf2len = snprintf( buf2, sizeof buf2, "waits=" ULINTPF, block_rwlock_oswait_count); @@ -17367,7 +17407,7 @@ ha_innobase::get_foreign_dup_key( child_table_name[len] = '\0'; /* copy index name */ - ut_snprintf(child_key_name, child_key_name_len, "%s", + snprintf(child_key_name, child_key_name_len, "%s", err_index->name()); return(true); @@ -17994,7 +18034,7 @@ innodb_buffer_pool_size_update( { longlong in_val = *static_cast(save); - ut_snprintf(export_vars.innodb_buffer_pool_resize_status, + snprintf(export_vars.innodb_buffer_pool_resize_status, sizeof(export_vars.innodb_buffer_pool_resize_status), "Requested to resize buffer pool."); @@ -21909,7 +21949,7 @@ ib_errf( if (vasprintf(&str, format, args) == -1) { /* In case of failure use a fixed length string */ str = static_cast(malloc(BUFSIZ)); - my_vsnprintf(str, BUFSIZ, format, args); + vsnprintf(str, BUFSIZ, format, args); } #else /* Use a fixed length string. */ @@ -21918,7 +21958,7 @@ ib_errf( va_end(args); return; /* Watch for Out-Of-Memory */ } - my_vsnprintf(str, BUFSIZ, format, args); + vsnprintf(str, BUFSIZ, format, args); #endif /* _WIN32 */ ib_senderrf(thd, level, code, str); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index fb3fb05103a..5757fa03740 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8836,29 +8836,27 @@ commit_cache_norebuild( /** Adjust the persistent statistics after non-rebuilding ALTER TABLE. Remove statistics for dropped indexes, add statistics for created indexes and rename statistics for renamed indexes. -@param ha_alter_info Data used during in-place alter -@param ctx In-place ALTER TABLE context -@param altered_table MySQL table that is being altered -@param table_name Table name in MySQL -@param thd MySQL connection -*/ +@param ha_alter_info Data used during in-place alter +@param ctx In-place ALTER TABLE context +@param table_name Table name in MySQL +@param trx transaction +@return error code */ static -void +dberr_t alter_stats_norebuild( -/*==================*/ Alter_inplace_info* ha_alter_info, ha_innobase_inplace_ctx* ctx, - TABLE* altered_table, const char* table_name, - THD* thd) + trx_t* trx) { + dberr_t err = DB_SUCCESS; ulint i; DBUG_ENTER("alter_stats_norebuild"); DBUG_ASSERT(!ctx->need_rebuild()); if (!dict_stats_is_persistent_enabled(ctx->new_table)) { - DBUG_VOID_RETURN; + DBUG_RETURN(err); } /* Delete corresponding rows from the stats table. We do this @@ -8887,10 +8885,13 @@ alter_stats_norebuild( char errstr[1024]; - if (dict_stats_drop_index( - ctx->new_table->name.m_name, key->name.str, - errstr, sizeof errstr) != DB_SUCCESS) { - push_warning(thd, + dberr_t err2 = dict_stats_drop_index( + ctx->new_table->name.m_name, key->name.str, + errstr, sizeof errstr, trx); + + if (err2 != DB_SUCCESS) { + err = err2; + push_warning(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN, ER_LOCK_WAIT_TIMEOUT, errstr); } @@ -8926,34 +8927,36 @@ alter_stats_norebuild( DBUG_ASSERT(index->table == ctx->new_table); if (!(index->type & DICT_FTS)) { - dict_stats_init(ctx->new_table); - dict_stats_update_for_index(index); + dict_stats_init(ctx->new_table, trx); + dberr_t err2 = dict_stats_update_for_index(index, trx); + if (err2 != DB_SUCCESS) { + err = err2; + } } } - DBUG_VOID_RETURN; + DBUG_RETURN(err); } /** Adjust the persistent statistics after rebuilding ALTER TABLE. Remove statistics for dropped indexes, add statistics for created indexes and rename statistics for renamed indexes. -@param table InnoDB table that was rebuilt by ALTER TABLE -@param table_name Table name in MySQL -@param thd MySQL connection -*/ +@param table InnoDB table that was rebuilt by ALTER TABLE +@param table_name Table name in MySQL +@param trx transaction +@return error code */ static -void +dberr_t alter_stats_rebuild( -/*================*/ dict_table_t* table, const char* table_name, - THD* thd) + trx_t* trx) { DBUG_ENTER("alter_stats_rebuild"); if (dict_table_is_discarded(table) || !dict_stats_is_persistent_enabled(table)) { - DBUG_VOID_RETURN; + DBUG_RETURN(DB_SUCCESS); } #ifndef DBUG_OFF @@ -8966,7 +8969,24 @@ alter_stats_rebuild( table->file_unreadable = true; ); - dberr_t ret = dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT); + char errstr[1024]; + mutex_enter(&dict_sys->mutex); + dberr_t ret = dict_stats_drop_table(table->name.m_name, + errstr, sizeof errstr, trx); + mutex_exit(&dict_sys->mutex); + if (ret != DB_SUCCESS) { + push_warning_printf( + trx->mysql_thd, + Sql_condition::WARN_LEVEL_WARN, + ER_ALTER_INFO, + "Deleting persistent statistics" + " for rebuilt table '%s' in" + " InnoDB failed: %s", + table_name, errstr); + DBUG_RETURN(ret); + } + + ret = dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT, trx); DBUG_EXECUTE_IF( "ib_rename_index_fail2", @@ -8975,7 +8995,7 @@ alter_stats_rebuild( if (ret != DB_SUCCESS) { push_warning_printf( - thd, + trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN, ER_ALTER_INFO, "Error updating stats for table '%s'" @@ -8983,14 +9003,14 @@ alter_stats_rebuild( table_name, ut_strerr(ret)); } - DBUG_VOID_RETURN; + DBUG_RETURN(ret); } #ifndef DBUG_OFF # define DBUG_INJECT_CRASH(prefix, count) \ do { \ char buf[32]; \ - ut_snprintf(buf, sizeof buf, prefix "_%u", count); \ + snprintf(buf, sizeof buf, prefix "_%u", count); \ DBUG_EXECUTE_IF(buf, DBUG_SUICIDE();); \ } while (0) #else @@ -9272,7 +9292,7 @@ ha_innobase::commit_inplace_alter_table( /* Generate a dynamic dbug text. */ char buf[32]; - ut_snprintf(buf, sizeof buf, + snprintf(buf, sizeof buf, "ib_commit_inplace_fail_%u", failure_inject_count++); @@ -9297,6 +9317,36 @@ ha_innobase::commit_inplace_alter_table( ctx->rollback_instant(); } } else if (!new_clustered) { + if (ctx0->num_to_drop_vcol || ctx0->num_to_add_vcol) { + DBUG_ASSERT(ctx0->old_table->get_ref_count() == 1); + bool warned = false; + + for (inplace_alter_handler_ctx** pctx = ctx_array; + *pctx; pctx++) { + ha_innobase_inplace_ctx* ctx + = static_cast + (*pctx); + + DBUG_ASSERT(!ctx->need_rebuild()); + char errstr[1024]; + if (dict_stats_drop_table( + ctx->old_table->name.m_name, + errstr, sizeof errstr, trx) + != DB_SUCCESS && !warned) { + warned = true; + push_warning_printf( + m_user_thd, + Sql_condition::WARN_LEVEL_WARN, + ER_ALTER_INFO, + "Deleting persistent " + "statistics for table '%s' in" + " InnoDB failed: %s", + table_share->table_name.str, + errstr); + } + } + } + trx_commit_for_mysql(trx); } else { mtr_t mtr; @@ -9543,23 +9593,6 @@ foreign_fail: m_prebuilt->table = dict_table_open_on_name( tb_name, TRUE, TRUE, DICT_ERR_IGNORE_NONE); - /* Drop outdated table stats. */ - char errstr[1024]; - if (dict_stats_drop_table( - m_prebuilt->table->name.m_name, - errstr, sizeof(errstr)) - != DB_SUCCESS) { - push_warning_printf( - m_user_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_ALTER_INFO, - "Deleting persistent statistics" - " for table '%s' in" - " InnoDB failed: %s", - table->s->table_name.str, - errstr); - } - row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); @@ -9615,41 +9648,6 @@ foreign_fail: } #endif if (new_clustered) { - /* Since the table has been rebuilt, we remove - all persistent statistics corresponding to the - old copy of the table (which was renamed to - ctx->tmp_name). */ - - char errstr[1024]; - - DBUG_ASSERT(0 == strcmp(ctx->old_table->name.m_name, - ctx->tmp_name)); - - DBUG_EXECUTE_IF( - "ib_rename_index_fail3", - DBUG_SET("+d,innodb_report_deadlock"); - ); - - if (dict_stats_drop_table( - ctx->new_table->name.m_name, - errstr, sizeof(errstr)) - != DB_SUCCESS) { - push_warning_printf( - m_user_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_ALTER_INFO, - "Deleting persistent statistics" - " for rebuilt table '%s' in" - " InnoDB failed: %s", - table->s->table_name.str, - errstr); - } - - DBUG_EXECUTE_IF( - "ib_rename_index_fail3", - DBUG_SET("-d,innodb_report_deadlock"); - ); - DBUG_EXECUTE_IF("ib_ddl_crash_before_commit", DBUG_SUICIDE();); @@ -9695,11 +9693,13 @@ foreign_fail: } row_mysql_unlock_data_dictionary(trx); - trx_free_for_mysql(trx); + ++trx->will_lock; /* TODO: The following code could be executed while allowing concurrent access to the table (MDL downgrade). */ + trx->mysql_thd = m_user_thd; + dberr_t stats_err = DB_SUCCESS; if (new_clustered) { for (inplace_alter_handler_ctx** pctx = ctx_array; @@ -9708,10 +9708,11 @@ foreign_fail: = static_cast (*pctx); DBUG_ASSERT(ctx->need_rebuild()); - - alter_stats_rebuild( - ctx->new_table, table->s->table_name.str, - m_user_thd); + stats_err = alter_stats_rebuild( + ctx->new_table, table->s->table_name.str, trx); + if (stats_err != DB_SUCCESS) { + break; + } DBUG_INJECT_CRASH("ib_commit_inplace_crash", crash_inject_count++); } @@ -9723,14 +9724,25 @@ foreign_fail: (*pctx); DBUG_ASSERT(!ctx->need_rebuild()); - alter_stats_norebuild( - ha_alter_info, ctx, altered_table, - table->s->table_name.str, m_user_thd); + stats_err = alter_stats_norebuild( + ha_alter_info, ctx, + table->s->table_name.str, trx); + if (stats_err != DB_SUCCESS) { + break; + } DBUG_INJECT_CRASH("ib_commit_inplace_crash", crash_inject_count++); } } + if (stats_err != DB_SUCCESS) { + trx_rollback_to_savepoint(trx, NULL); + } else { + trx_commit_for_mysql(trx); + } + + trx_free_for_mysql(trx); + innobase_parse_hint_from_comment( m_user_thd, m_prebuilt->table, altered_table->s); diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index b597b9224fa..8f03620b556 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -586,7 +586,7 @@ fill_innodb_trx_from_cache( cache, I_S_INNODB_TRX, i); /* trx_id */ - ut_snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id); + snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id); OK(field_store_string(fields[IDX_TRX_ID], trx_id)); /* trx_state */ @@ -915,8 +915,8 @@ fill_innodb_locks_from_cache( lock_id)); /* lock_trx_id */ - ut_snprintf(lock_trx_id, sizeof(lock_trx_id), - TRX_ID_FMT, row->lock_trx_id); + snprintf(lock_trx_id, sizeof(lock_trx_id), + TRX_ID_FMT, row->lock_trx_id); OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id)); /* lock_mode */ @@ -1115,8 +1115,8 @@ fill_innodb_lock_waits_from_cache( cache, I_S_INNODB_LOCK_WAITS, i); /* requesting_trx_id */ - ut_snprintf(requesting_trx_id, sizeof(requesting_trx_id), - TRX_ID_FMT, row->requested_lock_row->lock_trx_id); + snprintf(requesting_trx_id, sizeof(requesting_trx_id), + TRX_ID_FMT, row->requested_lock_row->lock_trx_id); OK(field_store_string(fields[IDX_REQUESTING_TRX_ID], requesting_trx_id)); @@ -1129,8 +1129,8 @@ fill_innodb_lock_waits_from_cache( sizeof(requested_lock_id)))); /* blocking_trx_id */ - ut_snprintf(blocking_trx_id, sizeof(blocking_trx_id), - TRX_ID_FMT, row->blocking_lock_row->lock_trx_id); + snprintf(blocking_trx_id, sizeof(blocking_trx_id), + TRX_ID_FMT, row->blocking_lock_row->lock_trx_id); OK(field_store_string(fields[IDX_BLOCKING_TRX_ID], blocking_trx_id)); @@ -1732,8 +1732,8 @@ i_s_cmp_per_index_fill_low( index->name); } else { /* index not found */ - ut_snprintf(name, sizeof(name), - "index_id:" IB_ID_FMT, iter->first); + snprintf(name, sizeof(name), + "index_id:" IB_ID_FMT, iter->first); field_store_string(fields[IDX_DATABASE_NAME], "unknown"); field_store_string(fields[IDX_TABLE_NAME], @@ -9180,8 +9180,8 @@ i_s_innodb_mutexes_fill_table( if (block_mutex) { char buf1[IO_SIZE]; - my_snprintf(buf1, sizeof buf1, "combined %s", - innobase_basename(block_mutex->cfile_name)); + snprintf(buf1, sizeof buf1, "combined %s", + innobase_basename(block_mutex->cfile_name)); OK(field_store_string(fields[MUTEXES_NAME], block_mutex->cmutex_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); @@ -9219,8 +9219,8 @@ i_s_innodb_mutexes_fill_table( if (block_lock) { char buf1[IO_SIZE]; - my_snprintf(buf1, sizeof buf1, "combined %s", - innobase_basename(block_lock->cfile_name)); + snprintf(buf1, sizeof buf1, "combined %s", + innobase_basename(block_lock->cfile_name)); //OK(field_store_string(fields[MUTEXES_NAME], block_lock->lock_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 44cd5b5f772..81a1fb757c7 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -369,6 +369,12 @@ public: || m_interrupted); } + /** @return whether to flush only some pages of the tablespace */ + bool is_partial_flush() const { return m_stage != NULL; } + + /** @return whether the operation was interrupted */ + bool is_interrupted() const { return m_interrupted; } + /** Interrupt observer not to wait. */ void interrupted() { @@ -381,7 +387,6 @@ public: /** Flush dirty pages. */ void flush(); - /** Notify observer of flushing a page @param[in] buf_pool buffer pool instance @param[in] bpage buffer page to flush */ @@ -397,10 +402,10 @@ public: buf_page_t* bpage); private: /** Table space id */ - ulint m_space_id; + const ulint m_space_id; /** Trx instance */ - trx_t* m_trx; + trx_t* const m_trx; /** Performance schema accounting object, used by ALTER TABLE. If not NULL, then stage->begin_phase_flush() will be called initially, diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index 54c001ce478..7b739fc0332 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -52,12 +52,14 @@ These are low-level functions /** Empty the flush list for all pages belonging to a tablespace. @param[in] id tablespace identifier -@param[in] trx transaction, for checking for user interrupt; +@param[in,out] observer flush observer, or NULL if nothing is to be written @param[in] drop_ahi whether to drop the adaptive hash index */ -UNIV_INTERN void -buf_LRU_flush_or_remove_pages(ulint id, const trx_t* trx, bool drop_ahi=false); +buf_LRU_flush_or_remove_pages( + ulint id, + FlushObserver* observer, + bool drop_ahi = false); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /********************************************************************//** diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index a68f4829561..0af2dcf9fa1 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -387,79 +387,79 @@ dtype_sql_name( #define APPEND_UNSIGNED() \ do { \ if (prtype & DATA_UNSIGNED) { \ - ut_snprintf(name + strlen(name), \ + snprintf(name + strlen(name), \ name_sz - strlen(name), \ " UNSIGNED"); \ } \ } while (0) - ut_snprintf(name, name_sz, "UNKNOWN"); + snprintf(name, name_sz, "UNKNOWN"); switch (mtype) { case DATA_INT: switch (len) { case 1: - ut_snprintf(name, name_sz, "TINYINT"); + snprintf(name, name_sz, "TINYINT"); break; case 2: - ut_snprintf(name, name_sz, "SMALLINT"); + snprintf(name, name_sz, "SMALLINT"); break; case 3: - ut_snprintf(name, name_sz, "MEDIUMINT"); + snprintf(name, name_sz, "MEDIUMINT"); break; case 4: - ut_snprintf(name, name_sz, "INT"); + snprintf(name, name_sz, "INT"); break; case 8: - ut_snprintf(name, name_sz, "BIGINT"); + snprintf(name, name_sz, "BIGINT"); break; } APPEND_UNSIGNED(); break; case DATA_FLOAT: - ut_snprintf(name, name_sz, "FLOAT"); + snprintf(name, name_sz, "FLOAT"); APPEND_UNSIGNED(); break; case DATA_DOUBLE: - ut_snprintf(name, name_sz, "DOUBLE"); + snprintf(name, name_sz, "DOUBLE"); APPEND_UNSIGNED(); break; case DATA_FIXBINARY: - ut_snprintf(name, name_sz, "BINARY(%u)", len); + snprintf(name, name_sz, "BINARY(%u)", len); break; case DATA_CHAR: case DATA_MYSQL: - ut_snprintf(name, name_sz, "CHAR(%u)", len); + snprintf(name, name_sz, "CHAR(%u)", len); break; case DATA_VARCHAR: case DATA_VARMYSQL: - ut_snprintf(name, name_sz, "VARCHAR(%u)", len); + snprintf(name, name_sz, "VARCHAR(%u)", len); break; case DATA_BINARY: - ut_snprintf(name, name_sz, "VARBINARY(%u)", len); + snprintf(name, name_sz, "VARBINARY(%u)", len); break; case DATA_GEOMETRY: - ut_snprintf(name, name_sz, "GEOMETRY"); + snprintf(name, name_sz, "GEOMETRY"); break; case DATA_BLOB: switch (len) { case 9: - ut_snprintf(name, name_sz, "TINYBLOB"); + snprintf(name, name_sz, "TINYBLOB"); break; case 10: - ut_snprintf(name, name_sz, "BLOB"); + snprintf(name, name_sz, "BLOB"); break; case 11: - ut_snprintf(name, name_sz, "MEDIUMBLOB"); + snprintf(name, name_sz, "MEDIUMBLOB"); break; case 12: - ut_snprintf(name, name_sz, "LONGBLOB"); + snprintf(name, name_sz, "LONGBLOB"); break; } } if (prtype & DATA_NOT_NULL) { - ut_snprintf(name + strlen(name), + snprintf(name + strlen(name), name_sz - strlen(name), " NOT NULL"); } diff --git a/storage/innobase/include/dict0defrag_bg.h b/storage/innobase/include/dict0defrag_bg.h index eb2a6e6824f..6dd73f1d481 100644 --- a/storage/innobase/include/dict0defrag_bg.h +++ b/storage/innobase/include/dict0defrag_bg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2016, MariaDB Corporation. All rights Reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -66,28 +66,24 @@ dict_stats_defrag_pool_del( all entries for the table */ const dict_index_t* index); /*!< in: index to remove */ -/*****************************************************************//** -Get the first index that has been added for updating persistent defrag -stats and eventually save its stats. */ +/** Process indexes that have been scheduled for defragmenting. +@param[in,out] trx transaction that will be started and committed */ void -dict_defrag_process_entries_from_defrag_pool(); -/*===========================================*/ +dict_defrag_process_entries_from_defrag_pool(trx_t* trx); -/*********************************************************************//** -Save defragmentation result. +/** Save defragmentation result. +@param[in] index index that was defragmented +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t -dict_stats_save_defrag_summary( -/*============================*/ - dict_index_t* index) /*!< in: index */ - MY_ATTRIBUTE((warn_unused_result)); +dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx) + MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*********************************************************************//** -Save defragmentation stats for a given index. +/** Save defragmentation stats for a given index. +@param[in] index index that is being defragmented +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t -dict_stats_save_defrag_stats( -/*============================*/ - dict_index_t* index) /*!< in: index */ - MY_ATTRIBUTE((warn_unused_result)); +dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx) + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* dict0defrag_bg_h */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 1300fe6e3e3..700017b9331 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1783,7 +1783,7 @@ struct dict_table_t { /** How many rows are modified since last stats recalc. When a row is inserted, updated, or deleted, we add 1 to this number; we calculate new estimates for the table and the indexes if the table has changed - too much, see row_update_statistics_if_needed(). The counter is reset + too much, see dict_stats_update_if_needed(). The counter is reset to zero at statistics calculation. This counter is not protected by any latch, because this is only used for heuristics. */ ib_uint64_t stat_modified_counter; @@ -2053,6 +2053,19 @@ dict_col_get_spatial_status( return(spatial_status); } +/** Clear defragmentation summary. */ +inline void dict_stats_empty_defrag_summary(dict_index_t* index) +{ + index->stat_defrag_n_pages_freed = 0; +} + +/** Clear defragmentation related index stats. */ +inline void dict_stats_empty_defrag_stats(dict_index_t* index) +{ + index->stat_defrag_modified_counter = 0; + index->stat_defrag_n_page_split = 0; +} + #include "dict0mem.ic" #endif /* dict0mem_h */ diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index 8846aeda7fd..4a34b90195a 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -92,13 +92,12 @@ bool dict_stats_auto_recalc_is_enabled(const dict_table_t* table) MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*********************************************************************//** -Initialize table's stats for the first time when opening a table. */ +/** Initialize table statistics for the first time when opening a table. +@param[in,out] table freshly opened table +@param[in,out] trx transaction */ UNIV_INLINE void -dict_stats_init( -/*============*/ - dict_table_t* table); /*!< in/out: table */ +dict_stats_init(dict_table_t* table, trx_t* trx); /*********************************************************************//** Deinitialize table's stats after the last close of the table. This is @@ -117,66 +116,68 @@ void dict_stats_update_if_needed(dict_table_t* table) MY_ATTRIBUTE((nonnull)); -/*********************************************************************//** -Calculates new estimates for table and index statistics. The statistics -are used in query optimization. +/** Calculate new estimates for table and index statistics. +@param[in,out] table table +@param[in] stats_upd_option how to update statistics +@param[in,out] trx transaction @return DB_* error code or DB_SUCCESS */ dberr_t dict_stats_update( -/*==============*/ - dict_table_t* table, /*!< in/out: table */ - dict_stats_upd_option_t stats_upd_option); - /*!< in: whether to (re) calc - the stats or to fetch them from - the persistent storage */ + dict_table_t* table, + dict_stats_upd_option_t stats_upd_option, + trx_t* trx); -/*********************************************************************//** -Removes the information for a particular index's stats from the persistent -storage if it exists and if there is data stored for this index. -This function creates its own trx and commits it. +/** Remove the persistent statistics for an index. +@param[in] db_and_table schema and table name, e.g., 'db/table' +@param[in] iname index name +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_drop_index( -/*==================*/ - const char* tname, /*!< in: table name */ - const char* iname, /*!< in: index name */ - char* errstr, /*!< out: error message if != DB_SUCCESS - is returned */ - ulint errstr_sz);/*!< in: size of the errstr buffer */ + const char* db_and_table, + const char* iname, + char* errstr, + size_t errstr_sz, + trx_t* trx); -/*********************************************************************//** -Removes the statistics for a table and all of its indexes from the -persistent storage if it exists and if there is data stored for the table. -This function creates its own transaction and commits it. +/** Remove the persistent statistics for a table and all of its indexes. +@param[in] db_and_table schema and table name, e.g., 'db/table' +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_drop_table( -/*==================*/ - const char* table_name, /*!< in: table name */ - char* errstr, /*!< out: error message - if != DB_SUCCESS is returned */ - ulint errstr_sz); /*!< in: size of errstr buffer */ + const char* db_and_table, + char* errstr, + size_t errstr_sz, + trx_t* trx); -/*********************************************************************//** -Fetches or calculates new estimates for index statistics. */ -void -dict_stats_update_for_index( -/*========================*/ - dict_index_t* index) /*!< in/out: index */ +/** Calculate index statistics. +@param[in,out] index index tree +@param[in,out] trx transaction (for persistent statistics) +@return DB_SUCCESS or error code */ +UNIV_INTERN +dberr_t +dict_stats_update_for_index(dict_index_t* index, trx_t* trx) MY_ATTRIBUTE((nonnull)); -/*********************************************************************//** -Renames a table in InnoDB persistent stats storage. -This function creates its own transaction and commits it. +/** Rename a table in the InnoDB persistent statistics storage. +@param[in] old_name old schema and table name, e.g., 'db/table' +@param[in] new_name new schema and table name, e.g., 'db/table' +@param[out] errstr error message (when not returning DB_SUCCESS) +@param[in] errstr_sz sizeof errstr +@param[in,out] trx transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_rename_table( -/*====================*/ - const char* old_name, /*!< in: old table name */ - const char* new_name, /*!< in: new table name */ - char* errstr, /*!< out: error string if != DB_SUCCESS - is returned */ - size_t errstr_sz); /*!< in: errstr size */ + const char* old_name, + const char* new_name, + char* errstr, + size_t errstr_sz, + trx_t* trx); /*********************************************************************//** Renames an index in InnoDB persistent stats storage. This function creates its own transaction and commits it. @@ -190,52 +191,13 @@ dict_stats_rename_index( const char* old_index_name, /*!< in: old index name */ const char* new_index_name) /*!< in: new index name */ __attribute__((warn_unused_result)); -/*********************************************************************//** -Save defragmentation result. -@return DB_SUCCESS or error code */ -UNIV_INTERN -dberr_t -dict_stats_save_defrag_summary( - dict_index_t* index); /*!< in: index */ -/*********************************************************************//** -Save defragmentation stats for a given index. -@return DB_SUCCESS or error code */ -UNIV_INTERN -dberr_t -dict_stats_save_defrag_stats( - dict_index_t* index); /*!< in: index */ - -/**********************************************************************//** -Clear defragmentation summary. */ -UNIV_INTERN +/** Reset the table and index statsistics, corresponding to an empty table. +@param[in,out] table table whose statistics are to be reset +@param[in] empty_defrag_stats whether to empty the defrag statistics +*/ void -dict_stats_empty_defrag_summary( -/*==================*/ - dict_index_t* index); /*!< in: index to clear defragmentation stats */ - -/**********************************************************************//** -Clear defragmentation related index stats. */ -UNIV_INTERN -void -dict_stats_empty_defrag_stats( -/*==================*/ - dict_index_t* index); /*!< in: index to clear defragmentation stats */ - - -/*********************************************************************//** -Renames an index in InnoDB persistent stats storage. -This function creates its own transaction and commits it. -@return DB_SUCCESS or error code. DB_STATS_DO_NOT_EXIST will be returned -if the persistent stats do not exist. */ -dberr_t -dict_stats_rename_index( -/*====================*/ - const dict_table_t* table, /*!< in: table whose index - is renamed */ - const char* old_index_name, /*!< in: old index name */ - const char* new_index_name) /*!< in: new index name */ - MY_ATTRIBUTE((warn_unused_result)); +dict_stats_empty_table(dict_table_t* table, bool empty_defrag_stats = true); /** Save an individual index's statistic into the persistent statistics storage. @@ -245,9 +207,7 @@ storage. @param[in] stat_value value of the stat @param[in] sample_size n pages sampled or NULL @param[in] stat_description description of the stat -@param[in,out] trx in case of NULL the function will -allocate and free the trx object. If it is not NULL then it will be -rolled back only in the case of error, but not freed. +@param[in,out] trx dictionary transaction @return DB_SUCCESS or error code */ dberr_t dict_stats_save_index_stat( @@ -257,7 +217,8 @@ dict_stats_save_index_stat( ib_uint64_t stat_value, ib_uint64_t* sample_size, const char* stat_description, - trx_t* trx); + trx_t* trx) + MY_ATTRIBUTE((nonnull(1,3,7), warn_unused_result)); /** Report an error if updating table statistics failed because .ibd file is missing, table decryption failed or table is corrupted. diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic index 1efe5780b58..e0784f63038 100644 --- a/storage/innobase/include/dict0stats.ic +++ b/storage/innobase/include/dict0stats.ic @@ -79,7 +79,7 @@ dict_stats_is_persistent_enabled(const dict_table_t* table) protect the ::stat_persistent with dict_table_stats_lock() like the other ::stat_ members which would be too big performance penalty, especially when this function is called from - row_update_statistics_if_needed(). */ + dict_stats_update_if_needed(). */ /* we rely on this read to be atomic */ ib_uint32_t stat_persistent = table->stat_persistent; @@ -141,13 +141,12 @@ dict_stats_auto_recalc_is_enabled(const dict_table_t* table) } } -/*********************************************************************//** -Initialize table's stats for the first time when opening a table. */ +/** Initialize table statistics for the first time when opening a table. +@param[in,out] table freshly opened table +@param[in,out] trx transaction */ UNIV_INLINE void -dict_stats_init( -/*============*/ - dict_table_t* table) /*!< in/out: table */ +dict_stats_init(dict_table_t* table, trx_t* trx) { ut_ad(!mutex_own(&dict_sys->mutex)); @@ -163,7 +162,7 @@ dict_stats_init( opt = DICT_STATS_RECALC_TRANSIENT; } - dict_stats_update(table, opt); + dict_stats_update(table, opt, trx); } /*********************************************************************//** diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 4bfbbb4bb7d..8409ec75c70 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -99,14 +99,15 @@ recv_sys_debug_free(void); /** Read a log segment to a buffer. @param[out] buf buffer @param[in] group redo log files -@param[in] start_lsn read area start +@param[in, out] start_lsn in : read area start, out: the last read valid lsn @param[in] end_lsn read area end -@return valid end_lsn */ -lsn_t +@param[out] invalid_block - invalid, (maybe incompletely written) block encountered +@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */ +bool log_group_read_log_seg( byte* buf, const log_group_t* group, - lsn_t start_lsn, + lsn_t* start_lsn, lsn_t end_lsn); /********************************************************//** diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 064430cbf4b..13de798280a 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1195,11 +1195,12 @@ to original un-instrumented file I/O APIs */ # define os_file_read_no_error_handling(type, file, buf, offset, n, o) \ os_file_read_no_error_handling_func(type, file, buf, offset, n, o) # define os_file_read_no_error_handling_int_fd(type, file, buf, offset, n) \ - os_file_read_no_error_handling_func(type, file, buf, offset, n, NULL) + os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL) # define os_file_write(type, name, file, buf, offset, n) \ os_file_write_func(type, name, file, buf, offset, n) -# define os_file_write_int_fd os_file_write_func +# define os_file_write_int_fd(type, name, file, buf, offset, n) \ + os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n) # define os_file_flush(file) os_file_flush_func(file) diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 888a32007ce..ae5f410e810 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -501,8 +501,8 @@ bool rw_lock_lock_word_decr( /*===================*/ rw_lock_t* lock, /*!< in/out: rw-lock */ - ulint amount, /*!< in: amount to decrement */ - lint threshold); /*!< in: threshold of judgement */ + int32_t amount, /*!< in: amount to decrement */ + int32_t threshold); /*!< in: threshold of judgement */ #ifdef UNIV_DEBUG /******************************************************************//** Checks if the thread has locked the rw-lock in the specified mode, with @@ -571,10 +571,10 @@ struct rw_lock_t #endif /* UNIV_DEBUG */ { /** Holds the state of the lock. */ - volatile lint lock_word; + int32_t lock_word; /** 1: there are waiters */ - volatile uint32_t waiters; + int32_t waiters; /** number of granted SX locks. */ volatile ulint sx_recursive; diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index a048476d0e8..cbbf421d9f2 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -77,7 +77,8 @@ rw_lock_get_writer( /*===============*/ const rw_lock_t* lock) /*!< in: rw-lock */ { - lint lock_word = lock->lock_word; + int32_t lock_word = my_atomic_load32_explicit(const_cast(&lock->lock_word), + MY_MEMORY_ORDER_RELAXED); ut_ad(lock_word <= X_LOCK_DECR); if (lock_word > X_LOCK_HALF_DECR) { @@ -109,7 +110,8 @@ rw_lock_get_reader_count( /*=====================*/ const rw_lock_t* lock) /*!< in: rw-lock */ { - lint lock_word = lock->lock_word; + int32_t lock_word = my_atomic_load32_explicit(const_cast(&lock->lock_word), + MY_MEMORY_ORDER_RELAXED); ut_ad(lock_word <= X_LOCK_DECR); if (lock_word > X_LOCK_HALF_DECR) { @@ -145,7 +147,8 @@ rw_lock_get_x_lock_count( /*=====================*/ const rw_lock_t* lock) /*!< in: rw-lock */ { - lint lock_copy = lock->lock_word; + int32_t lock_copy = my_atomic_load32_explicit(const_cast(&lock->lock_word), + MY_MEMORY_ORDER_RELAXED); ut_ad(lock_copy <= X_LOCK_DECR); if (lock_copy == 0 || lock_copy == -X_LOCK_HALF_DECR) { @@ -178,7 +181,8 @@ rw_lock_get_sx_lock_count( const rw_lock_t* lock) /*!< in: rw-lock */ { #ifdef UNIV_DEBUG - lint lock_copy = lock->lock_word; + int32_t lock_copy = my_atomic_load32_explicit(const_cast(&lock->lock_word), + MY_MEMORY_ORDER_RELAXED); ut_ad(lock_copy <= X_LOCK_DECR); @@ -197,9 +201,7 @@ rw_lock_get_sx_lock_count( } /******************************************************************//** -Two different implementations for decrementing the lock_word of a rw_lock: -one for systems supporting atomic operations, one for others. This does -does not support recusive x-locks: they should be handled by the caller and +Recursive x-locks are not supported: they should be handled by the caller and need not be atomic since they are performed by the current lock holder. Returns true if the decrement was made, false if not. @return true if decr occurs */ @@ -208,17 +210,17 @@ bool rw_lock_lock_word_decr( /*===================*/ rw_lock_t* lock, /*!< in/out: rw-lock */ - ulint amount, /*!< in: amount to decrement */ - lint threshold) /*!< in: threshold of judgement */ + int32_t amount, /*!< in: amount to decrement */ + int32_t threshold) /*!< in: threshold of judgement */ { - lint local_lock_word; - - local_lock_word = my_atomic_loadlint_explicit(&lock->lock_word, + int32_t lock_copy = my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED); - while (local_lock_word > threshold) { - if (my_atomic_caslint(&lock->lock_word, - &local_lock_word, - local_lock_word - amount)) { + while (lock_copy > threshold) { + if (my_atomic_cas32_strong_explicit(&lock->lock_word, + &lock_copy, + lock_copy - amount, + MY_MEMORY_ORDER_ACQUIRE, + MY_MEMORY_ORDER_RELAXED)) { return(true); } } @@ -306,29 +308,32 @@ rw_lock_x_lock_func_nowait( const char* file_name,/*!< in: file name where lock requested */ unsigned line) /*!< in: line where requested */ { - lint oldval = X_LOCK_DECR; + int32_t oldval = X_LOCK_DECR; - if (my_atomic_caslint(&lock->lock_word, &oldval, 0)) { + if (my_atomic_cas32_strong_explicit(&lock->lock_word, &oldval, 0, + MY_MEMORY_ORDER_ACQUIRE, + MY_MEMORY_ORDER_RELAXED)) { lock->writer_thread = os_thread_get_curr_id(); } else if (os_thread_eq(lock->writer_thread, os_thread_get_curr_id())) { - /* Relock: this lock_word modification is safe since no other - threads can modify (lock, unlock, or reserve) lock_word while - there is an exclusive writer and this is the writer thread. */ - if (lock->lock_word == 0 || lock->lock_word == -X_LOCK_HALF_DECR) { + /* Relock: even though no other thread can modify (lock, unlock + or reserve) lock_word while there is an exclusive writer and + this is the writer thread, we still want concurrent threads to + observe consistent values. */ + if (oldval == 0 || oldval == -X_LOCK_HALF_DECR) { /* There are 1 x-locks */ - lock->lock_word -= X_LOCK_DECR; - } else if (lock->lock_word <= -X_LOCK_DECR) { + my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_DECR, + MY_MEMORY_ORDER_RELAXED); + } else if (oldval <= -X_LOCK_DECR) { /* There are 2 or more x-locks */ - lock->lock_word--; + my_atomic_add32_explicit(&lock->lock_word, -1, + MY_MEMORY_ORDER_RELAXED); + /* Watch for too many recursive locks */ + ut_ad(oldval < 1); } else { /* Failure */ return(FALSE); } - - /* Watch for too many recursive locks */ - ut_ad(lock->lock_word < 0); - } else { /* Failure */ return(FALSE); @@ -357,8 +362,8 @@ rw_lock_s_unlock_func( rw_lock_t* lock) /*!< in/out: rw-lock */ { #ifdef UNIV_DEBUG - lint dbg_lock_word = my_atomic_loadlint_explicit( - &lock->lock_word, MY_MEMORY_ORDER_RELAXED); + int32_t dbg_lock_word = my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED); ut_ad(dbg_lock_word > -X_LOCK_DECR); ut_ad(dbg_lock_word != 0); ut_ad(dbg_lock_word < X_LOCK_DECR); @@ -367,7 +372,8 @@ rw_lock_s_unlock_func( ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_S)); /* Increment lock_word to indicate 1 less reader */ - lint lock_word = my_atomic_addlint(&lock->lock_word, 1) + 1; + int32_t lock_word = my_atomic_add32_explicit(&lock->lock_word, 1, + MY_MEMORY_ORDER_RELEASE) + 1; if (lock_word == 0 || lock_word == -X_LOCK_HALF_DECR) { /* wait_ex waiter exists. It may not be asleep, but we signal @@ -393,9 +399,8 @@ rw_lock_x_unlock_func( #endif /* UNIV_DEBUG */ rw_lock_t* lock) /*!< in/out: rw-lock */ { - lint lock_word; - lock_word = my_atomic_loadlint_explicit(&lock->lock_word, - MY_MEMORY_ORDER_RELAXED); + int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED); ut_ad(lock_word == 0 || lock_word == -X_LOCK_HALF_DECR || lock_word <= -X_LOCK_DECR); @@ -408,31 +413,35 @@ rw_lock_x_unlock_func( ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_X)); if (lock_word == 0 || lock_word == -X_LOCK_HALF_DECR) { - /* There is 1 x-lock */ - /* atomic increment is needed, because it is last */ - if (my_atomic_addlint(&lock->lock_word, X_LOCK_DECR) <= -X_LOCK_DECR) { - ut_error; - } + /* Last X-lock owned by this thread, it may still hold SX-locks. + ACQ_REL due to... + RELEASE: we release rw-lock + ACQUIRE: we want waiters to be loaded after lock_word is stored */ + my_atomic_add32_explicit(&lock->lock_word, X_LOCK_DECR, + MY_MEMORY_ORDER_ACQ_REL); /* This no longer has an X-lock but it may still have an SX-lock. So it is now free for S-locks by other threads. We need to signal read/write waiters. We do not need to signal wait_ex waiters, since they cannot exist when there is a writer. */ - if (my_atomic_load32_explicit((int32*) &lock->waiters, + if (my_atomic_load32_explicit(&lock->waiters, MY_MEMORY_ORDER_RELAXED)) { - my_atomic_store32((int32*) &lock->waiters, 0); + my_atomic_store32_explicit(&lock->waiters, 0, + MY_MEMORY_ORDER_RELAXED); os_event_set(lock->event); sync_array_object_signalled(); } } else if (lock_word == -X_LOCK_DECR || lock_word == -(X_LOCK_DECR + X_LOCK_HALF_DECR)) { /* There are 2 x-locks */ - lock->lock_word += X_LOCK_DECR; + my_atomic_add32_explicit(&lock->lock_word, X_LOCK_DECR, + MY_MEMORY_ORDER_RELAXED); } else { /* There are more than 2 x-locks. */ ut_ad(lock_word < -X_LOCK_DECR); - lock->lock_word += 1; + my_atomic_add32_explicit(&lock->lock_word, 1, + MY_MEMORY_ORDER_RELAXED); } ut_ad(rw_lock_validate(lock)); @@ -458,28 +467,37 @@ rw_lock_sx_unlock_func( ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_SX)); if (lock->sx_recursive == 0) { + int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED); /* Last caller in a possible recursive chain. */ - if (lock->lock_word > 0) { + if (lock_word > 0) { lock->writer_thread = 0; + ut_ad(lock_word <= INT_MAX32 - X_LOCK_HALF_DECR); + + /* Last SX-lock owned by this thread, doesn't own X-lock. + ACQ_REL due to... + RELEASE: we release rw-lock + ACQUIRE: we want waiters to be loaded after lock_word is stored */ + my_atomic_add32_explicit(&lock->lock_word, X_LOCK_HALF_DECR, + MY_MEMORY_ORDER_ACQ_REL); - if (my_atomic_addlint(&lock->lock_word, X_LOCK_HALF_DECR) <= 0) { - ut_error; - } /* Lock is now free. May have to signal read/write waiters. We do not need to signal wait_ex waiters, since they cannot exist when there is an sx-lock holder. */ - if (lock->waiters) { - my_atomic_store32((int32*) &lock->waiters, 0); + if (my_atomic_load32_explicit(&lock->waiters, + MY_MEMORY_ORDER_RELAXED)) { + my_atomic_store32_explicit(&lock->waiters, 0, + MY_MEMORY_ORDER_RELAXED); os_event_set(lock->event); sync_array_object_signalled(); } } else { /* still has x-lock */ - ut_ad(lock->lock_word == -X_LOCK_HALF_DECR - || lock->lock_word <= -(X_LOCK_DECR - + X_LOCK_HALF_DECR)); - lock->lock_word += X_LOCK_HALF_DECR; + ut_ad(lock_word == -X_LOCK_HALF_DECR || + lock_word <= -(X_LOCK_DECR + X_LOCK_HALF_DECR)); + my_atomic_add32_explicit(&lock->lock_word, X_LOCK_HALF_DECR, + MY_MEMORY_ORDER_RELAXED); } } diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index 1f8e245569e..136626b65d5 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1163,15 +1163,11 @@ enum rw_lock_flag_t { #ifdef _WIN64 #define my_atomic_addlint(A,B) my_atomic_add64((int64*) (A), (B)) #define my_atomic_loadlint(A) my_atomic_load64((int64*) (A)) -#define my_atomic_loadlint_explicit(A,O) my_atomic_load64_explicit((int64*) (A), (O)) #define my_atomic_storelint(A,B) my_atomic_store64((int64*) (A), (B)) -#define my_atomic_caslint(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C)) #else #define my_atomic_addlint my_atomic_addlong #define my_atomic_loadlint my_atomic_loadlong -#define my_atomic_loadlint_explicit my_atomic_loadlong_explicit #define my_atomic_storelint my_atomic_storelong -#define my_atomic_caslint my_atomic_caslong #endif /** Simple counter aligned to CACHE_LINE_SIZE diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index e8efc1525c4..5271601b4ea 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -343,6 +344,15 @@ trx_rw_is_active( bool do_ref_count) /*!< in: if true then increment the trx_t::n_ref_count */ { + if (!trx_id) { + /* In MariaDB 10.3, purge will reset DB_TRX_ID to 0 + when the history is lost. Read/write transactions will + always have a nonzero trx_t::id; there the value 0 is + reserved for transactions that did not write or lock + anything yet. */ + return NULL; + } + trx_t* trx; trx_sys_mutex_enter(); diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 9f3db61aa2e..a263dc07290 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -844,7 +844,8 @@ that modified it is running. */ typedef std::map< dict_table_t*, trx_mod_table_time_t, std::less, - ut_allocator > trx_mod_tables_t; + ut_allocator > > + trx_mod_tables_t; /** The transaction handle @@ -1182,6 +1183,9 @@ struct trx_t { mysql_trx_list; /*!< list of transactions created for MySQL; protected by trx_sys->mutex */ #ifdef UNIV_DEBUG + /** whether this transaction is updating persistent statistics + (used for silencing a debug assertion at shutdown) */ + bool persistent_stats; bool in_mysql_trx_list; /*!< true if in trx_sys->mysql_trx_list */ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index b8282b7d0de..7cca4fe875b 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -45,6 +45,7 @@ Created 1/20/1994 Heikki Tuuri #include #include +#include /** Index name prefix in fast index creation, as a string constant */ #define TEMP_INDEX_PREFIX_STR "\377" @@ -74,11 +75,15 @@ typedef time_t ib_time_t; # include # define UT_RELAX_CPU() __ppc_get_timebase() #else -# define UT_RELAX_CPU() do { \ - volatile int32 volatile_var; \ - int32 oldval= 0; \ - my_atomic_cas32(&volatile_var, &oldval, 1); \ - } while (0) +static inline void UT_RELAX_CPU(void) +{ + volatile int32 var; + int32 oldval = 0; + my_atomic_cas32_strong_explicit( + &var, &oldval, 1, + MY_MEMORY_ORDER_RELAXED, + MY_MEMORY_ORDER_RELAXED); +} #endif #if defined (__GNUC__) @@ -89,15 +94,6 @@ typedef time_t ib_time_t; # define UT_COMPILER_BARRIER() #endif -#if defined(HAVE_HMT_PRIORITY_INSTRUCTION) -# include -# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low() -# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med() -#else -# define UT_LOW_PRIORITY_CPU() ((void)0) -# define UT_RESUME_PRIORITY_CPU() ((void)0) -#endif - /*********************************************************************//** Delays execution for at most max_wait_us microseconds or returns earlier if cond becomes true. @@ -395,50 +391,6 @@ ut_copy_file( FILE* dest, /*!< in: output file */ FILE* src); /*!< in: input file to be appended to output */ -#ifdef _WIN32 -/**********************************************************************//** -A substitute for vsnprintf(3), formatted output conversion into -a limited buffer. Note: this function DOES NOT return the number of -characters that would have been printed if the buffer was unlimited because -VC's _vsnprintf() returns -1 in this case and we would need to call -_vscprintf() in addition to estimate that but we would need another copy -of "ap" for that and VC does not provide va_copy(). */ -void -ut_vsnprintf( -/*=========*/ - char* str, /*!< out: string */ - size_t size, /*!< in: str size */ - const char* fmt, /*!< in: format */ - va_list ap); /*!< in: format values */ - -/**********************************************************************//** -A substitute for snprintf(3), formatted output conversion into -a limited buffer. -@return number of characters that would have been printed if the size -were unlimited, not including the terminating '\0'. */ -int -ut_snprintf( -/*========*/ - char* str, /*!< out: string */ - size_t size, /*!< in: str size */ - const char* fmt, /*!< in: format */ - ...); /*!< in: format values */ -#else -/**********************************************************************//** -A wrapper for vsnprintf(3), formatted output conversion into -a limited buffer. Note: this function DOES NOT return the number of -characters that would have been printed if the buffer was unlimited because -VC's _vsnprintf() returns -1 in this case and we would need to call -_vscprintf() in addition to estimate that but we would need another copy -of "ap" for that and VC does not provide va_copy(). */ -# define ut_vsnprintf(buf, size, fmt, ap) \ - ((void) vsnprintf(buf, size, fmt, ap)) -/**********************************************************************//** -A wrapper for snprintf(3), formatted output conversion into -a limited buffer. */ -# define ut_snprintf snprintf -#endif /* _WIN32 */ - /*************************************************************//** Convert an error number to a human readable text message. The returned string is static and should not be freed or modified. diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake index b3e52fa10b1..4e11e946216 100644 --- a/storage/innobase/innodb.cmake +++ b/storage/innobase/innodb.cmake @@ -110,7 +110,7 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") ENDIF() # Enable InnoDB's UNIV_DEBUG in debug builds -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG") OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON) OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON) @@ -156,6 +156,11 @@ IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) ENDIF() IF(NOT MSVC) + CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN) + IF(HAVE_POSIX_MEMALIGN) + ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN) + ENDIF() + # Only use futexes on Linux if GCC atomics are available IF(NOT MSVC AND NOT CMAKE_CROSSCOMPILING) CHECK_C_SOURCE_RUNS( diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index ed3281e1453..fe943f8e5c6 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1685,18 +1685,7 @@ RecLock::prepare() const ut_error; } - switch (trx_get_dict_operation(m_trx)) { - case TRX_DICT_OP_NONE: - break; - case TRX_DICT_OP_TABLE: - case TRX_DICT_OP_INDEX: - ib::error() << "A record lock wait happens in a dictionary" - " operation. index " << m_index->name - << " of table " << m_index->table->name - << ". " << BUG_REPORT_MSG; - ut_ad(0); - } - + ut_ad(trx_get_dict_operation(m_trx) == TRX_DICT_OP_NONE); ut_ad(m_index->table->n_ref_count > 0 || !m_index->table->can_be_evicted); } @@ -2262,6 +2251,24 @@ RecLock::add_to_waitq(const lock_t* wait_for, const lock_prdt_t* prdt) /* Do the preliminary checks, and set query thread state */ + switch (UNIV_EXPECT(trx_get_dict_operation(m_trx), TRX_DICT_OP_NONE)) { + case TRX_DICT_OP_NONE: + break; + case TRX_DICT_OP_TABLE: + case TRX_DICT_OP_INDEX: + ut_ad(!prdt); + + if (m_trx->dict_operation_lock_mode != RW_X_LATCH) { + } else if (!strcmp(m_index->table->name.m_name, + "mysql/innodb_table_stats") + || !strcmp(m_index->table->name.m_name, + "mysql/innodb_index_stats")) { + /* Statistics can be updated as part of a DDL + transaction, but only as the very last operation. */ + return(DB_QUE_THR_SUSPENDED); + } + } + prepare(); bool high_priority = trx_is_high_priority(m_trx); @@ -4667,6 +4674,16 @@ lock_table_enqueue_waiting( break; case TRX_DICT_OP_TABLE: case TRX_DICT_OP_INDEX: + if (trx->dict_operation_lock_mode != RW_X_LATCH) { + } else if (!strcmp(table->name.m_name, + "mysql/innodb_table_stats") + || !strcmp(table->name.m_name, + "mysql/innodb_index_stats")) { + /* Statistics can be updated as part of a DDL + transaction, but only as the very last operation. */ + return(DB_QUE_THR_SUSPENDED); + } + ib::error() << "A table lock wait happens in a dictionary" " operation. Table " << table->name << ". " << BUG_REPORT_MSG; @@ -6458,13 +6475,9 @@ loop: ut_ad(!trx_is_ac_nl_ro(lock->trx)); -# ifdef UNIV_DEBUG /* Only validate the record queues when this thread is not - holding a space->latch. Deadlocks are possible due to - latching order violation when UNIV_DEBUG is defined while - UNIV_DEBUG is not. */ + holding a space->latch. */ if (!sync_check_find(SYNC_FSP)) -# endif /* UNIV_DEBUG */ for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) { if (i == 1 || lock_rec_get_nth_bit(lock, i)) { diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 9ae5eb4f42e..b7b3b6db066 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1979,6 +1979,7 @@ wait_suspend_loop: goto wait_suspend_loop; case SRV_PURGE: case SRV_WORKER: + ut_ad(!"purge was not shut down"); srv_purge_wakeup(); thread_name = "purge thread"; goto wait_suspend_loop; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 21450767689..1097dafb9b6 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -608,26 +608,29 @@ recv_sys_debug_free(void) /** Read a log segment to a buffer. @param[out] buf buffer @param[in] group redo log files -@param[in] start_lsn read area start +@param[in, out] start_lsn in : read area start, out: the last read valid lsn @param[in] end_lsn read area end -@return valid end_lsn */ -lsn_t +@param[out] invalid_block - invalid, (maybe incompletely written) block encountered +@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */ +bool log_group_read_log_seg( byte* buf, const log_group_t* group, - lsn_t start_lsn, + lsn_t *start_lsn, lsn_t end_lsn) { ulint len; lsn_t source_offset; - + bool success = true; ut_ad(log_mutex_own()); + ut_ad(!(*start_lsn % OS_FILE_LOG_BLOCK_SIZE)); + ut_ad(!(end_lsn % OS_FILE_LOG_BLOCK_SIZE)); loop: - source_offset = log_group_calc_lsn_offset(start_lsn, group); + source_offset = log_group_calc_lsn_offset(*start_lsn, group); - ut_a(end_lsn - start_lsn <= ULINT_MAX); - len = (ulint) (end_lsn - start_lsn); + ut_a(end_lsn - *start_lsn <= ULINT_MAX); + len = (ulint) (end_lsn - *start_lsn); ut_ad(len != 0); @@ -657,16 +660,16 @@ loop: for (ulint l = 0; l < len; l += OS_FILE_LOG_BLOCK_SIZE, buf += OS_FILE_LOG_BLOCK_SIZE, - start_lsn += OS_FILE_LOG_BLOCK_SIZE) { + (*start_lsn) += OS_FILE_LOG_BLOCK_SIZE) { const ulint block_number = log_block_get_hdr_no(buf); - if (block_number != log_block_convert_lsn_to_no(start_lsn)) { + if (block_number != log_block_convert_lsn_to_no(*start_lsn)) { /* Garbage or an incompletely written log block. We will not report any error, because this can happen when InnoDB was killed while it was writing redo log. We simply treat this as an abrupt end of the redo log. */ - end_lsn = start_lsn; + end_lsn = *start_lsn; break; } @@ -674,6 +677,13 @@ loop: ulint crc = log_block_calc_checksum_crc32(buf); ulint cksum = log_block_get_checksum(buf); + DBUG_EXECUTE_IF("log_intermittent_checksum_mismatch", { + static int block_counter; + if (block_counter++ == 0) { + cksum = crc + 1; + } + }); + if (crc != cksum) { ib::error() << "Invalid log block checksum." << " block: " << block_number @@ -681,30 +691,33 @@ loop: << log_block_get_checkpoint_no(buf) << " expected: " << crc << " found: " << cksum; - end_lsn = start_lsn; + end_lsn = *start_lsn; + success = false; break; } if (group->is_encrypted()) { - log_crypt(buf, start_lsn, + log_crypt(buf, *start_lsn, OS_FILE_LOG_BLOCK_SIZE, true); } } } if (recv_sys->report(ut_time())) { - ib::info() << "Read redo log up to LSN=" << start_lsn; + ib::info() << "Read redo log up to LSN=" << *start_lsn; sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF, - start_lsn); + *start_lsn); } - if (start_lsn != end_lsn) { + if (*start_lsn != end_lsn) { goto loop; } - return(start_lsn); + return(success); } + + /********************************************************//** Copies a log segment from the most up-to-date log group to the other log groups, so that they all contain the latest log data. Also writes the info @@ -719,10 +732,10 @@ recv_synchronize_groups() /* Read the last recovered log block to the recovery system buffer: the block is always incomplete */ - const lsn_t start_lsn = ut_uint64_align_down(recovered_lsn, + lsn_t start_lsn = ut_uint64_align_down(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE); log_group_read_log_seg(log_sys->buf, &log_sys->log, - start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE); + &start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE); /* Update the fields in the group struct to correspond to recovered_lsn */ @@ -2962,9 +2975,11 @@ recv_group_scan_log_recs( recv_apply_hashed_log_recs(false); } - start_lsn = end_lsn; - end_lsn = log_group_read_log_seg( - log_sys->buf, group, start_lsn, + start_lsn = ut_uint64_align_down(end_lsn, + OS_FILE_LOG_BLOCK_SIZE); + end_lsn = start_lsn; + log_group_read_log_seg( + log_sys->buf, group, &end_lsn, start_lsn + RECV_SCAN_SIZE); } while (end_lsn != start_lsn && !recv_scan_log_recs( diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index e556f6bef6d..3c0013e600a 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1305,11 +1305,8 @@ os_file_make_new_pathname( new_path = static_cast(ut_malloc_nokey(new_path_len)); memcpy(new_path, old_path, dir_len); - ut_snprintf(new_path + dir_len, - new_path_len - dir_len, - "%c%s.ibd", - OS_PATH_SEPARATOR, - base_name); + snprintf(new_path + dir_len, new_path_len - dir_len, + "%c%s.ibd", OS_PATH_SEPARATOR, base_name); return(new_path); } diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 9e3119bfd3a..ba392bb2aa1 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -1340,8 +1340,8 @@ page_zip_compress( if (UNIV_UNLIKELY(page_zip_compress_log)) { /* Create a log file for every compression attempt. */ char logfilename[9]; - ut_snprintf(logfilename, sizeof logfilename, - "%08x", page_zip_compress_log++); + snprintf(logfilename, sizeof logfilename, + "%08x", page_zip_compress_log++); logfile = fopen(logfilename, "wb"); if (logfile) { diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 9ea0bdd949c..4c412bf763c 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -725,7 +725,7 @@ FetchIndexRootPages::build_row_import(row_import* cfg) const UNIV_NOTHROW char name[BUFSIZ]; - ut_snprintf(name, sizeof(name), "index" IB_ID_FMT, it->m_id); + snprintf(name, sizeof(name), "index" IB_ID_FMT, it->m_id); ulint len = strlen(name) + 1; @@ -2581,11 +2581,11 @@ row_import_read_index_data( if (n_bytes != sizeof(row)) { char msg[BUFSIZ]; - ut_snprintf(msg, sizeof(msg), - "while reading index meta-data, expected " - "to read " ULINTPF - " bytes but read only " ULINTPF " bytes", - sizeof(row), n_bytes); + snprintf(msg, sizeof(msg), + "while reading index meta-data, expected " + "to read " ULINTPF + " bytes but read only " ULINTPF " bytes", + sizeof(row), n_bytes); ib_senderrf( thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR, @@ -3104,9 +3104,9 @@ row_import_read_cfg( if (file == NULL) { char msg[BUFSIZ]; - ut_snprintf(msg, sizeof(msg), - "Error opening '%s', will attempt to import" - " without schema verification", name); + snprintf(msg, sizeof(msg), + "Error opening '%s', will attempt to import" + " without schema verification", name); ib_senderrf( thd, IB_LOG_LEVEL_WARN, ER_IO_READ_ERROR, @@ -3672,11 +3672,16 @@ row_import_for_mysql( The only dirty pages generated should be from the pessimistic purge of delete marked records that couldn't be purged in Phase I. */ - buf_LRU_flush_or_remove_pages(prebuilt->table->space, trx); + { + FlushObserver observer(prebuilt->table->space, trx, NULL); + buf_LRU_flush_or_remove_pages(prebuilt->table->space, + &observer); - if (trx_is_interrupted(trx)) { - ib::info() << "Phase III - Flush interrupted"; - return(row_import_error(prebuilt, trx, DB_INTERRUPTED)); + if (observer.is_interrupted()) { + ib::info() << "Phase III - Flush interrupted"; + return(row_import_error(prebuilt, trx, + DB_INTERRUPTED)); + } } ib::info() << "Phase IV - Flush complete"; diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 88f2ac8ae95..8210c989816 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1438,11 +1438,11 @@ row_ins_foreign_check_on_constraint( #ifdef WITH_WSREP err = wsrep_append_foreign_key( - thr_get_trx(thr), - foreign, - clust_rec, - clust_index, - FALSE, FALSE); + thr_get_trx(thr), + foreign, + clust_rec, + clust_index, + FALSE, FALSE); if (err != DB_SUCCESS) { fprintf(stderr, "WSREP: foreign key append failed: %d\n", err); @@ -3740,6 +3740,11 @@ row_ins( switch (err) { case DB_SUCCESS: break; + case DB_NO_REFERENCED_ROW: + if (!dict_index_is_unique(node->index)) { + DBUG_RETURN(err); + } + /* fall through */ case DB_DUPLICATE_KEY: ut_ad(dict_index_is_unique(node->index)); @@ -3756,7 +3761,55 @@ row_ins( secondary indexes to block concurrent transactions from inserting the searched records. */ - if (!node->duplicate) { + if (err == DB_NO_REFERENCED_ROW + && node->duplicate) { + /* A foreign key check on a + unique index may fail to + find the record. + + Consider as a example + following: + create table child(a int not null + primary key, b int not null, + c int, + unique key (b), + foreign key (b) references + parent (id)) engine=innodb; + + insert into child values + (1,1,2); + + insert into child(a) values + (1) on duplicate key update + c = 3; + + Now primary key value 1 + naturally causes duplicate + key error that will be + stored on node->duplicate. + If there was no duplicate + key error, we should return + the actual no referenced + row error. + + As value for + column b used in both unique + key and foreign key is not + provided, server uses 0 as a + search value. This is + naturally, not found leading + to DB_NO_REFERENCED_ROW. + But, we should update the + row with primay key value 1 + anyway. + + Return the + original DB_DUPLICATE_KEY + error after + placing all gaplocks. */ + err = DB_DUPLICATE_KEY; + break; + } else if (!node->duplicate) { /* Save 1st dup error. Ignore subsequent dup errors. */ node->duplicate = node->index; diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 76ca4e8b940..cb902776e26 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -853,6 +853,18 @@ row_log_table_low_redundant( } } + dfield_t* db_trx_id = dtuple_get_nth_field(tuple, index->n_uniq); + ut_ad(dfield_get_len(db_trx_id) == DATA_TRX_ID_LEN); + ut_ad(dfield_get_len(db_trx_id + 1) == DATA_ROLL_PTR_LEN); + + if (trx_read_trx_id(static_cast + (dfield_get_data(db_trx_id))) + < index->online_log->min_trx) { + dfield_set_data(db_trx_id, reset_trx_id, DATA_TRX_ID_LEN); + dfield_set_data(db_trx_id + 1, reset_trx_id + DATA_TRX_ID_LEN, + DATA_ROLL_PTR_LEN); + } + rec_comp_status_t status = index->is_instant() ? REC_STATUS_COLUMNS_ADDED : REC_STATUS_ORDINARY; @@ -1057,7 +1069,16 @@ row_log_table_low( memcpy(b, rec - rec_extra_size - omit_size, rec_extra_size); b += rec_extra_size; + ulint len; + ulint trx_id_offs = rec_get_nth_field_offs( + offsets, index->n_uniq, &len); + ut_ad(len == DATA_TRX_ID_LEN); memcpy(b, rec, rec_offs_data_size(offsets)); + if (trx_read_trx_id(b + trx_id_offs) + < index->online_log->min_trx) { + memcpy(b + trx_id_offs, + reset_trx_id, sizeof reset_trx_id); + } b += rec_offs_data_size(offsets); row_log_table_close(index, b, mrec_size, avail_size); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 3515e59d30a..64f2d9a7a66 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1991,7 +1991,8 @@ row_merge_read_clustered_index( } if (dbug_run_purge - || dict_index_get_lock(clust_index)->waiters) { + || my_atomic_load32_explicit(&clust_index->lock.waiters, + MY_MEMORY_ORDER_RELAXED)) { /* There are waiters on the clustered index tree lock, likely the purge thread. Store and restore the cursor @@ -5092,7 +5093,7 @@ func_exit: ut_ad(need_flush_observer); DBUG_EXECUTE_IF("ib_index_build_fail_before_flush", - error = DB_FAIL; + error = DB_INTERRUPTED; ); if (error != DB_SUCCESS) { diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index c8f537c9ca0..8cc9f7bdcdd 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3456,31 +3456,9 @@ run_again: que_thr_stop_for_mysql_no_error(thr, trx); } else { que_thr_stop_for_mysql(thr); + ut_ad(err != DB_QUE_THR_SUSPENDED); - if (err != DB_QUE_THR_SUSPENDED) { - ibool was_lock_wait; - - was_lock_wait = row_mysql_handle_errors( - &err, trx, thr, NULL); - - if (was_lock_wait) { - goto run_again; - } - } else { - que_thr_t* run_thr; - que_node_t* parent; - - parent = que_node_get_parent(thr); - - run_thr = que_fork_start_command( - static_cast(parent)); - - ut_a(run_thr == thr); - - /* There was a lock wait but the thread was not - in a ready to run or running state. */ - trx->error_state = DB_LOCK_WAIT; - + if (row_mysql_handle_errors(&err, trx, thr, NULL)) { goto run_again; } } @@ -3758,7 +3736,6 @@ row_drop_table_for_mysql( if (!dict_table_is_temporary(table) && !table->no_rollback()) { - dict_stats_recalc_pool_del(table); dict_stats_defrag_pool_del(table, NULL); if (btr_defragment_thread_active) { /* During fts_drop_orphaned_tables() in @@ -3767,17 +3744,6 @@ row_drop_table_for_mysql( initialized by btr_defragment_init(). */ btr_defragment_remove_table(table); } - - /* Remove stats for this table and all of its indexes from the - persistent storage if it exists and if there are stats for this - table in there. This function creates its own trx and commits - it. */ - char errstr[1024]; - err = dict_stats_drop_table(name, errstr, sizeof(errstr)); - - if (err != DB_SUCCESS) { - ib::warn() << errstr; - } } dict_table_prevent_eviction(table); @@ -4110,9 +4076,17 @@ row_drop_table_for_mysql( table_flags = table->flags; ut_ad(!dict_table_is_temporary(table)); - err = row_drop_ancillary_fts_tables(table, trx); - if (err != DB_SUCCESS) { - break; + if (!table->no_rollback()) { + char errstr[1024]; + if (dict_stats_drop_table(name, errstr, sizeof errstr, + trx) != DB_SUCCESS) { + ib::warn() << errstr; + } + + err = row_drop_ancillary_fts_tables(table, trx); + if (err != DB_SUCCESS) { + break; + } } /* Determine the tablespace filename before we drop diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index ccf58b9e73f..dd6289c91e6 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -454,8 +454,7 @@ row_quiesce_write_cfg( char msg[BUFSIZ]; - ut_snprintf(msg, sizeof(msg), "%s flush() failed", - name); + snprintf(msg, sizeof(msg), "%s flush() failed", name); ib_senderrf( thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR, @@ -465,8 +464,7 @@ row_quiesce_write_cfg( if (fclose(file) != 0) { char msg[BUFSIZ]; - ut_snprintf(msg, sizeof(msg), "%s flose() failed", - name); + snprintf(msg, sizeof(msg), "%s flose() failed", name); ib_senderrf( thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR, @@ -537,7 +535,10 @@ row_quiesce_table_start( } if (!trx_is_interrupted(trx)) { - buf_LRU_flush_or_remove_pages(table->space, trx); + { + FlushObserver observer(table->space, trx, NULL); + buf_LRU_flush_or_remove_pages(table->space, &observer); + } if (trx_is_interrupted(trx)) { diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index c9bd4533fd8..93b84bdb209 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1183,7 +1183,7 @@ row_raw_format_int( value = mach_read_int_type( (const byte*) data, data_len, unsigned_type); - ret = ut_snprintf( + ret = snprintf( buf, buf_size, unsigned_type ? "%llu" : "%lld", (longlong) value)+1; } else { @@ -1282,7 +1282,7 @@ row_raw_format( if (data_len == UNIV_SQL_NULL) { - ret = ut_snprintf((char*) buf, buf_size, "NULL") + 1; + ret = snprintf((char*) buf, buf_size, "NULL") + 1; return(ut_min(ret, buf_size)); } diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index 8d371f67e72..d10e848e7de 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -293,13 +293,13 @@ public: log_file_name_len = strlen(m_log_file_name); } - ut_snprintf(m_log_file_name + log_file_name_len, - log_file_name_buf_sz - log_file_name_len, - "%s%lu_%lu_%s", - TruncateLogger::s_log_prefix, - (ulong) m_table->space, - (ulong) m_table->id, - TruncateLogger::s_log_ext); + snprintf(m_log_file_name + log_file_name_len, + log_file_name_buf_sz - log_file_name_len, + "%s%lu_%lu_%s", + TruncateLogger::s_log_prefix, + (ulong) m_table->space, + (ulong) m_table->id, + TruncateLogger::s_log_ext); return(DB_SUCCESS); @@ -1271,10 +1271,6 @@ row_truncate_complete( } } - if (err == DB_SUCCESS) { - dict_stats_update(table, DICT_STATS_EMPTY_TABLE); - } - trx->op_info = ""; /* For temporary tables or if there was an error, we need to reset @@ -2102,8 +2098,17 @@ row_truncate_table_for_mysql( dict_table_autoinc_unlock(table); if (trx_is_started(trx)) { + char errstr[1024]; + if (dict_stats_drop_table(table->name.m_name, errstr, + sizeof errstr, trx) != DB_SUCCESS) { + ib::warn() << "Deleting persistent " + "statistics for table " << table->name + << " failed: " << errstr; + } trx_commit_for_mysql(trx); + + dict_stats_empty_table(table); } ut_ad(!table->is_instant()); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index e3a4eb05010..5d43563dffb 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2958,8 +2958,11 @@ srv_purge_wakeup() { ut_ad(!srv_read_only_mode); - if (srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { + if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { + return; + } + do { srv_release_threads(SRV_PURGE, 1); if (srv_n_purge_threads > 1) { @@ -2967,7 +2970,9 @@ srv_purge_wakeup() srv_release_threads(SRV_WORKER, n_workers); } - } + } while (!srv_running + && (srv_sys.n_threads_active[SRV_WORKER] + || srv_sys.n_threads_active[SRV_PURGE])); } /** Check if tablespace is being truncated. diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 988ddf1a759..6982754d795 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -684,8 +684,8 @@ srv_undo_tablespace_open( dberr_t err = DB_ERROR; char undo_name[sizeof "innodb_undo000"]; - ut_snprintf(undo_name, sizeof(undo_name), - "innodb_undo%03u", static_cast(space_id)); + snprintf(undo_name, sizeof(undo_name), + "innodb_undo%03u", static_cast(space_id)); if (!srv_file_check_mode(name)) { ib::error() << "UNDO tablespaces must be " << @@ -763,7 +763,7 @@ srv_check_undo_redo_logs_exists() /* Check if any undo tablespaces exist */ for (ulint i = 1; i <= srv_undo_tablespaces; ++i) { - ut_snprintf( + snprintf( name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, @@ -860,7 +860,7 @@ srv_undo_tablespaces_init(bool create_new_db) DBUG_EXECUTE_IF("innodb_undo_upgrade", space_id = i + 3;); - ut_snprintf( + snprintf( name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, space_id); @@ -922,10 +922,10 @@ srv_undo_tablespaces_init(bool create_new_db) char name[OS_FILE_MAX_PATH]; - ut_snprintf(name, sizeof(name), - "%s%cundo%03zu", - srv_undo_dir, OS_PATH_SEPARATOR, - undo_tablespace_ids[i]); + snprintf(name, sizeof(name), + "%s%cundo%03zu", + srv_undo_dir, OS_PATH_SEPARATOR, + undo_tablespace_ids[i]); os_file_delete(innodb_data_file_key, name); @@ -955,7 +955,7 @@ srv_undo_tablespaces_init(bool create_new_db) for (i = 0; i < n_undo_tablespaces; ++i) { char name[OS_FILE_MAX_PATH]; - ut_snprintf( + snprintf( name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, @@ -993,7 +993,7 @@ srv_undo_tablespaces_init(bool create_new_db) for (i = prev_space_id + 1; i < TRX_SYS_N_RSEGS; ++i) { char name[OS_FILE_MAX_PATH]; - ut_snprintf( + snprintf( name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i); @@ -1097,22 +1097,19 @@ srv_undo_tablespaces_init(bool create_new_db) mtr_commit(&mtr); /* Step-2: Flush the dirty pages from the buffer pool. */ - trx_t* trx = trx_allocate_for_background(); - for (undo::undo_spaces_t::const_iterator it = undo::Truncate::s_fix_up_spaces.begin(); it != undo::Truncate::s_fix_up_spaces.end(); ++it) { - - buf_LRU_flush_or_remove_pages(TRX_SYS_SPACE, trx); - - buf_LRU_flush_or_remove_pages(*it, trx); + FlushObserver dummy(TRX_SYS_SPACE, NULL, NULL); + buf_LRU_flush_or_remove_pages(TRX_SYS_SPACE, &dummy); + FlushObserver dummy2(*it, NULL, NULL); + buf_LRU_flush_or_remove_pages(*it, &dummy2); /* Remove the truncate redo log file. */ undo::Truncate undo_trunc; undo_trunc.done_logging(*it); } - trx_free_for_background(trx); } return(DB_SUCCESS); diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index f1589e1f3a7..858b8c02e73 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -588,8 +588,8 @@ sync_array_cell_print( fprintf(file, "number of readers " ULINTPF - ", waiters flag %u, " - "lock_word: " ULINTPFx "\n" + ", waiters flag %d, " + "lock_word: %x\n" "Last time read locked in file %s line %u\n" "Last time write locked in file %s line %u" #if 0 /* JAN: TODO: FIX LATER */ @@ -598,8 +598,8 @@ sync_array_cell_print( #endif "\n", rw_lock_get_reader_count(rwlock), - rwlock->waiters, - rwlock->lock_word, + my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED), + my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED), innobase_basename(rwlock->last_s_file_name), rwlock->last_s_line, innobase_basename(rwlock->last_x_file_name), @@ -1397,8 +1397,10 @@ sync_arr_fill_sys_semphore_waits_table( //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(rwlock->line, true)); //fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull(); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock))); - OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)rwlock->waiters)); - OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)rwlock->lock_word)); + OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], + my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED))); + OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], + my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED))); OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_READER_FILE], innobase_basename(rwlock->last_s_file_name))); OK(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->store(rwlock->last_s_line, true)); fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->set_notnull(); diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index b7b68f98c19..509fd9cf19b 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -268,7 +268,8 @@ rw_lock_free_func( rw_lock_t* lock) /*!< in/out: rw-lock */ { ut_ad(rw_lock_validate(lock)); - ut_a(lock->lock_word == X_LOCK_DECR); + ut_a(my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED) == X_LOCK_DECR); mutex_enter(&rw_lock_list_mutex); @@ -316,8 +317,8 @@ lock_loop: /* Spin waiting for the writer field to become free */ HMT_low(); while (i < srv_n_spin_wait_rounds && - my_atomic_loadlint_explicit(&lock->lock_word, - MY_MEMORY_ORDER_RELAXED) <= 0) { + my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED) <= 0) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); } @@ -360,7 +361,7 @@ lock_loop: /* Set waiters before checking lock_word to ensure wake-up signal is sent. This may lead to some unnecessary signals. */ - my_atomic_fas32((int32*) &lock->waiters, 1); + my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE); if (rw_lock_s_lock_low(lock, pass, file_name, line)) { @@ -438,12 +439,10 @@ rw_lock_x_lock_wait_func( sync_array_t* sync_arr; uint64_t count_os_wait = 0; - ut_ad(lock->lock_word <= threshold); + ut_ad(my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= threshold); - while (lock->lock_word < threshold) { - - - HMT_low(); + HMT_low(); + while (my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) < threshold) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); } @@ -452,7 +451,6 @@ rw_lock_x_lock_wait_func( i++; continue; } - HMT_medium(); /* If there is still a reader, then go to sleep.*/ ++n_spins; @@ -465,7 +463,7 @@ rw_lock_x_lock_wait_func( i = 0; /* Check lock_word to ensure wake-up isn't missed.*/ - if (lock->lock_word < threshold) { + if (my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) < threshold) { ++count_os_wait; @@ -488,7 +486,6 @@ rw_lock_x_lock_wait_func( sync_array_free_cell(sync_arr, cell); break; } - HMT_low(); } HMT_medium(); rw_lock_stats.rw_x_spin_round_count.add(n_spins); @@ -564,14 +561,18 @@ rw_lock_x_lock_low( file_name, line); } else { + int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED); /* At least one X lock by this thread already exists. Add another. */ - if (lock->lock_word == 0 - || lock->lock_word == -X_LOCK_HALF_DECR) { - lock->lock_word -= X_LOCK_DECR; + if (lock_word == 0 + || lock_word == -X_LOCK_HALF_DECR) { + my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_DECR, + MY_MEMORY_ORDER_RELAXED); } else { - ut_ad(lock->lock_word <= -X_LOCK_DECR); - --lock->lock_word; + ut_ad(lock_word <= -X_LOCK_DECR); + my_atomic_add32_explicit(&lock->lock_word, -1, + MY_MEMORY_ORDER_RELAXED); } } @@ -642,12 +643,17 @@ rw_lock_sx_lock_low( thread working on this lock and it is safe to read and write to the lock_word. */ - ut_ad((lock->lock_word == 0) - || ((lock->lock_word <= -X_LOCK_DECR) - && (lock->lock_word +#ifdef UNIV_DEBUG + int32_t lock_word = +#endif + my_atomic_add32_explicit(&lock->lock_word, -X_LOCK_HALF_DECR, + MY_MEMORY_ORDER_RELAXED); + + ut_ad((lock_word == 0) + || ((lock_word <= -X_LOCK_DECR) + && (lock_word > -(X_LOCK_DECR + X_LOCK_HALF_DECR)))); - lock->lock_word -= X_LOCK_HALF_DECR; } } else { /* Another thread locked before us */ @@ -709,7 +715,7 @@ lock_loop: /* Spin waiting for the lock_word to become free */ HMT_low(); while (i < srv_n_spin_wait_rounds - && lock->lock_word <= X_LOCK_HALF_DECR) { + && my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= X_LOCK_HALF_DECR) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval( @@ -739,7 +745,7 @@ lock_loop: /* Waiters must be set before checking lock_word, to ensure signal is sent. This could lead to a few unnecessary wake-up signals. */ - my_atomic_fas32((int32*) &lock->waiters, 1); + my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE); if (rw_lock_x_lock_low(lock, pass, file_name, line)) { sync_array_free_cell(sync_arr, cell); @@ -815,7 +821,7 @@ lock_loop: /* Spin waiting for the lock_word to become free */ while (i < srv_n_spin_wait_rounds - && lock->lock_word <= X_LOCK_HALF_DECR) { + && my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= X_LOCK_HALF_DECR) { if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval( @@ -844,7 +850,7 @@ lock_loop: /* Waiters must be set before checking lock_word, to ensure signal is sent. This could lead to a few unnecessary wake-up signals. */ - my_atomic_fas32((int32*) &lock->waiters, 1); + my_atomic_fas32_explicit(&lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE); if (rw_lock_sx_lock_low(lock, pass, file_name, line)) { @@ -883,15 +889,15 @@ rw_lock_validate( /*=============*/ const rw_lock_t* lock) /*!< in: rw-lock */ { - lint lock_word; + int32_t lock_word; ut_ad(lock); - lock_word = my_atomic_loadlint_explicit(&lock->lock_word, - MY_MEMORY_ORDER_RELAXED); + lock_word = my_atomic_load32_explicit(const_cast(&lock->lock_word), + MY_MEMORY_ORDER_RELAXED); ut_ad(lock->magic_n == RW_LOCK_MAGIC_N); - ut_ad(my_atomic_load32_explicit((int32*) &lock->waiters, + ut_ad(my_atomic_load32_explicit(const_cast(&lock->waiters), MY_MEMORY_ORDER_RELAXED) < 2); ut_ad(lock_word > -(2 * X_LOCK_DECR)); ut_ad(lock_word <= X_LOCK_DECR); @@ -955,15 +961,17 @@ rw_lock_add_debug_info( rw_lock_debug_mutex_exit(); if (pass == 0 && lock_type != RW_LOCK_X_WAIT) { + int32_t lock_word = my_atomic_load32_explicit(&lock->lock_word, + MY_MEMORY_ORDER_RELAXED); /* Recursive x while holding SX (lock_type == RW_LOCK_X && lock_word == -X_LOCK_HALF_DECR) is treated as not-relock (new lock). */ if ((lock_type == RW_LOCK_X - && lock->lock_word < -X_LOCK_HALF_DECR) + && lock_word < -X_LOCK_HALF_DECR) || (lock_type == RW_LOCK_SX - && (lock->lock_word < 0 || lock->sx_recursive == 1))) { + && (lock_word < 0 || lock->sx_recursive == 1))) { sync_check_lock_validate(lock); sync_check_lock_granted(lock); @@ -1154,12 +1162,12 @@ rw_lock_list_print_info( count++; - if (lock->lock_word != X_LOCK_DECR) { + if (my_atomic_load32_explicit(const_cast(&lock->lock_word), MY_MEMORY_ORDER_RELAXED) != X_LOCK_DECR) { fprintf(file, "RW-LOCK: %p ", (void*) lock); - if (lock->waiters) { - fputs(" Waiters for the lock exist\n", file); + if (int32_t waiters= my_atomic_load32_explicit(const_cast(&lock->waiters), MY_MEMORY_ORDER_RELAXED)) { + fprintf(file, " (%d waiters)\n", waiters); } else { putc('\n', file); } diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 327ebf79211..f0dc2fb78bd 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -1607,17 +1607,17 @@ trx_i_s_create_lock_id( if (row->lock_space != ULINT_UNDEFINED) { /* record lock */ - res_len = ut_snprintf(lock_id, lock_id_size, - TRX_ID_FMT - ":" ULINTPF ":" ULINTPF ":" ULINTPF, - row->lock_trx_id, row->lock_space, - row->lock_page, row->lock_rec); + res_len = snprintf(lock_id, lock_id_size, + TRX_ID_FMT + ":" ULINTPF ":" ULINTPF ":" ULINTPF, + row->lock_trx_id, row->lock_space, + row->lock_page, row->lock_rec); } else { /* table lock */ - res_len = ut_snprintf(lock_id, lock_id_size, - TRX_ID_FMT":" UINT64PF, - row->lock_trx_id, - row->lock_table_id); + res_len = snprintf(lock_id, lock_id_size, + TRX_ID_FMT":" UINT64PF, + row->lock_trx_id, + row->lock_table_id); } /* the typecast is safe because snprintf(3) never returns diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 738f713298b..4e51796a400 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -304,7 +304,8 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) && purge_sys->state == PURGE_STATE_INIT) || (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND && purge_sys->state == PURGE_STATE_DISABLED) - || ((trx->undo_no == 0 || trx->in_mysql_trx_list) + || ((trx->undo_no == 0 || trx->in_mysql_trx_list + || trx->persistent_stats) && srv_fast_shutdown)); /* Add the log as the first in the history list */ @@ -569,10 +570,10 @@ namespace undo { log_file_name_len = strlen(log_file_name); } - ut_snprintf(log_file_name + log_file_name_len, - log_file_name_sz - log_file_name_len, - "%s%lu_%s", undo::s_log_prefix, - (ulong) space_id, s_log_ext); + snprintf(log_file_name + log_file_name_len, + log_file_name_sz - log_file_name_len, + "%s%lu_%s", undo::s_log_prefix, + (ulong) space_id, s_log_ext); return(DB_SUCCESS); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 91d28a2e9ab..e8a5623524b 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -558,6 +558,7 @@ trx_validate_state_before_free(trx_t* trx) ut_ad(!trx->declared_to_be_inside_innodb); ut_ad(!trx->n_mysql_tables_in_use); ut_ad(!trx->mysql_n_tables_locked); + ut_ad(!trx->persistent_stats); if (trx->declared_to_be_inside_innodb) { @@ -3044,6 +3045,7 @@ trx_set_rw_mode( ut_ad(trx->rsegs.m_redo.rseg == 0); ut_ad(!trx->in_rw_trx_list); ut_ad(!trx_is_autocommit_non_locking(trx)); + ut_ad(!trx->read_only); if (high_level_read_only) { return; @@ -3080,11 +3082,9 @@ trx_set_rw_mode( } #endif /* UNIV_DEBUG */ - if (!trx->read_only) { - UT_LIST_ADD_FIRST(trx_sys->rw_trx_list, trx); + UT_LIST_ADD_FIRST(trx_sys->rw_trx_list, trx); - ut_d(trx->in_rw_trx_list = true); - } + ut_d(trx->in_rw_trx_list = true); mutex_exit(&trx_sys->mutex); } diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc index 48f6b820b8e..284ea859013 100644 --- a/storage/innobase/ut/ut0crc32.cc +++ b/storage/innobase/ut/ut0crc32.cc @@ -86,6 +86,10 @@ mysys/my_perf.c, contributed by Facebook under the following license. #include "univ.i" #include "ut0crc32.h" +#ifdef _MSC_VER +#include +#endif + /** Swap the byte order of an 8 byte integer. @param[in] i 8-byte integer @return 8-byte integer */ @@ -128,7 +132,7 @@ ut_crc32_func_t ut_crc32 = ut_crc32_sw; const char* ut_crc32_implementation = "Using generic crc32 instructions"; #endif -#if defined(__GNUC__) && defined(__x86_64__) +#if (defined(__GNUC__) && defined(__x86_64__)) || defined(_MSC_VER) /********************************************************************//** Fetches CPU info */ static @@ -143,10 +147,29 @@ ut_cpuid( uint32_t* features_edx) /*!< out: CPU features edx */ { uint32_t sig; +#ifdef _MSC_VER + int data[4]; + __cpuid(data, 0); + /* ebx */ + vend[0] = data[1]; + /* edx */ + vend[1] = data[3]; + /* ecx */ + vend[2] = data[2]; + + __cpuid(data, 1); + /* eax */ + sig = data[0]; + /* ecx */ + *features_ecx = data[2]; + /* edx */ + *features_edx = data[3]; +#else asm("cpuid" : "=b" (vend[0]), "=c" (vend[2]), "=d" (vend[1]) : "a" (0)); asm("cpuid" : "=a" (sig), "=c" (*features_ecx), "=d" (*features_edx) : "a" (1) : "ebx"); +#endif *model = ((sig >> 4) & 0xF); *family = ((sig >> 8) & 0xF); @@ -173,11 +196,15 @@ ut_crc32_8_hw( const byte** data, ulint* len) { +#ifdef _MSC_VER + *crc = _mm_crc32_u8(*crc, (*data)[0]); +#else asm("crc32b %1, %0" /* output operands */ : "+r" (*crc) /* input operands */ : "rm" ((*data)[0])); +#endif (*data)++; (*len)--; @@ -194,12 +221,22 @@ ut_crc32_64_low_hw( uint64_t data) { uint64_t crc_64bit = crc; - +#ifdef _MSC_VER +#ifdef _M_X64 + crc_64bit = _mm_crc32_u64(crc_64bit, data); +#elif defined(_M_IX86) + crc = _mm_crc32_u32(crc, static_cast(data)); + crc_64bit = _mm_crc32_u32(crc, static_cast(data >> 32)); +#else +#error Not Supported processors type. +#endif +#else asm("crc32q %1, %0" /* output operands */ : "+r" (crc_64bit) /* input operands */ : "rm" (data)); +#endif return(static_cast(crc_64bit)); } @@ -321,7 +358,7 @@ ut_crc32_hw( return(~crc); } -#endif /* defined(__GNUC__) && defined(__x86_64__) */ +#endif /* defined(__GNUC__) && defined(__x86_64__) || (_WIN64) */ /* CRC32 software implementation. */ @@ -570,7 +607,7 @@ ut_crc32_init() { ut_crc32_slice8_table_init(); -#if defined(__GNUC__) && defined(__x86_64__) +#if (defined(__GNUC__) && defined(__x86_64__)) || defined(_MSC_VER) uint32_t vend[3]; uint32_t model; uint32_t family; diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 7ad80c3cd1f..91c1934f065 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -37,6 +37,7 @@ Created 5/11/1994 Heikki Tuuri #include "trx0trx.h" #include #include "log.h" +#include "my_cpu.h" #ifdef _WIN32 /*****************************************************************//** @@ -290,14 +291,14 @@ ut_delay( { ulint i; - UT_LOW_PRIORITY_CPU(); + HMT_low(); for (i = 0; i < delay * 50; i++) { UT_RELAX_CPU(); UT_COMPILER_BARRIER(); } - UT_RESUME_PRIORITY_CPU(); + HMT_medium(); } /*************************************************************//** @@ -522,65 +523,6 @@ ut_copy_file( } while (len > 0); } -#ifdef _WIN32 -# include -/**********************************************************************//** -A substitute for vsnprintf(3), formatted output conversion into -a limited buffer. Note: this function DOES NOT return the number of -characters that would have been printed if the buffer was unlimited because -VC's _vsnprintf() returns -1 in this case and we would need to call -_vscprintf() in addition to estimate that but we would need another copy -of "ap" for that and VC does not provide va_copy(). */ -void -ut_vsnprintf( -/*=========*/ - char* str, /*!< out: string */ - size_t size, /*!< in: str size */ - const char* fmt, /*!< in: format */ - va_list ap) /*!< in: format values */ -{ - _vsnprintf(str, size, fmt, ap); - str[size - 1] = '\0'; -} - -/**********************************************************************//** -A substitute for snprintf(3), formatted output conversion into -a limited buffer. -@return number of characters that would have been printed if the size -were unlimited, not including the terminating '\0'. */ -int -ut_snprintf( -/*========*/ - char* str, /*!< out: string */ - size_t size, /*!< in: str size */ - const char* fmt, /*!< in: format */ - ...) /*!< in: format values */ -{ - int res; - va_list ap1; - va_list ap2; - - va_start(ap1, fmt); - va_start(ap2, fmt); - - res = _vscprintf(fmt, ap1); - ut_a(res != -1); - - if (size > 0) { - _vsnprintf(str, size, fmt, ap2); - - if ((size_t) res >= size) { - str[size - 1] = '\0'; - } - } - - va_end(ap1); - va_end(ap2); - - return(res); -} -#endif /* _WIN32 */ - /** Convert an error number to a human readable text message. The returned string is static and should not be freed or modified. @param[in] num InnoDB internal error number diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index a9f9d7cc8b2..5d8e8c1eeb8 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA cmake_minimum_required(VERSION 2.6) project(mroonga) @@ -51,6 +51,14 @@ if(MSVC) endif() endif() +if(MRN_BUNDLED) + if(WITHOUT_MROONGA OR + WITHOUT_MROONGA_STORAGE_ENGINE OR + "${PLUGIN_MROONGA}" STREQUAL "NO") + return() + endif() +endif() + set(MRN_BUNDLED_GROONGA_RELATIVE_DIR "vendor/groonga") set(MRN_BUNDLED_GROONGA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") @@ -79,6 +87,58 @@ file(READ ${MRN_SOURCE_DIR}/version_micro MRN_VERSION_MICRO) file(READ ${MRN_SOURCE_DIR}/version_in_hex MRN_VERSION_IN_HEX) file(READ ${MRN_SOURCE_DIR}/plugin_version MRN_PLUGIN_VERSION) +if(MRN_GROONGA_BUNDLED) + option(MRN_GROONGA_EMBED + "Embed libgroonga" + ON) + if(MRN_GROONGA_EMBED) + set(GRN_EMBED ON) + endif() + + set(MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR + "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql") + option(MRN_GROONGA_NORMALIZER_MYSQL_EMBED + "Embed groonga-normalizer-mysql Groonga plugin" + ON) + if(EXISTS ${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}) + set(GROONGA_NORMALIZER_MYSQL_FOUND ON) + else() + set(GROONGA_NORMALIZER_MYSQL_FOUND OFF) + set(MRN_GROONGA_NORMALIZER_MYSQL_EMBED OFF) + endif() + if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED) + set(GROONGA_NORMALIZER_MYSQL_EMBED ON) + endif() + + file(READ "${MRN_BUNDLED_GROONGA_DIR}/bundled_lz4_version" + MRN_BUNDLED_LZ4_VERSION) + string(STRIP + "${MRN_BUNDLED_LZ4_VERSION}" + MRN_BUNDLED_LZ4_VERSION) + set(MRN_BUNDLED_LZ4_DIR + "${MRN_BUNDLED_GROONGA_DIR}/vendor/lz4-${MRN_BUNDLED_LZ4_VERSION}") + if(EXISTS ${MRN_BUNDLED_LZ4_DIR}) + set(GRN_WITH_BUNDLED_LZ4 ON) + set(GRN_WITH_LZ4 "yes") + else() + set(GRN_WITH_LZ4 "no") + endif() + + add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") +else() + set(MRN_GROONGA_EMBED OFF) + + file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION) + string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION) + + file(READ + ${MRN_SOURCE_DIR}/required_groonga_normalizer_mysql_version + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) + string(STRIP + "${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}" + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) +endif() + set(MRN_PACKAGE_STRING "${PROJECT_NAME} ${MRN_VERSION}") include(CheckCCompilerFlag) @@ -107,18 +167,7 @@ read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/udf/sources.am MRN_UDF_SOURCES) string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}udf/\\1" MRN_UDF_SOURCES "${MRN_UDF_SOURCES}") -set(MRN_ALL_SOURCES - ${MRN_SOURCES} - ${MRN_UDF_SOURCES} - ${LIBMRN_NO_MYSQL_SOURCES} - ${LIBMRN_NEED_MYSQL_SOURCES}) - if(MRN_BUNDLED) - mysql_add_plugin(mroonga ${MRN_ALL_SOURCES} STORAGE_ENGINE MODULE_ONLY) - if(NOT TARGET mroonga) - return() - endif() - set(MYSQL_SOURCE_DIR ${CMAKE_SOURCE_DIR}) set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR}) set(MYSQL_CONFIG ${CMAKE_SOURCE_DIR}/scripts/mysql_config) @@ -134,44 +183,6 @@ else() endif() find_path(MYSQL_CONFIG "${MYSQL_CONFIG}") -if(MRN_GROONGA_BUNDLED) - option(MRN_GROONGA_EMBED - "Embed libgroonga" - ON) - if(MRN_GROONGA_EMBED) - set(GRN_EMBED ON) - endif() - - set(MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR - "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql") - option(MRN_GROONGA_NORMALIZER_MYSQL_EMBED - "Embed groonga-normalizer-mysql Groonga plugin" - ON) - if(EXISTS ${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}) - set(GROONGA_NORMALIZER_MYSQL_FOUND ON) - else() - set(GROONGA_NORMALIZER_MYSQL_FOUND OFF) - set(MRN_GROONGA_NORMALIZER_MYSQL_EMBED OFF) - endif() - if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED) - set(GROONGA_NORMALIZER_MYSQL_EMBED ON) - endif() - - add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") -else() - set(MRN_GROONGA_EMBED OFF) - - file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION) - string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION) - - file(READ - ${MRN_SOURCE_DIR}/required_groonga_normalizer_mysql_version - REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) - string(STRIP - "${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}" - REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) -endif() - if(EXISTS "${MYSQL_SOURCE_DIR}/storage/maria") set(MYSQL_VARIANT "MariaDB") else() @@ -194,6 +205,7 @@ if(EXISTS "${MYSQL_SOURCE_DIR}/libbinlogevents") set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR "${MYSQL_SOURCE_DIR}/libbinlogevents/export") set(MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR + "${MYSQL_BUILD_DIR}/libbinlogevents/include" "${MYSQL_SOURCE_DIR}/libbinlogevents/include") else() set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR) @@ -270,6 +282,7 @@ else() set(MRN_LIBRARY_DIRS ${MRN_LIBRARY_DIRS} ${GROONGA_LIBRARY_DIRS}) + set(MRN_LIBRARIES ${GROONGA_LIBRARIES}) endif() include_directories( @@ -291,11 +304,17 @@ link_directories( ${MRN_LIBRARY_DIRS} ${MYSQL_LIBRARY_DIRS}) +set(MRN_ALL_SOURCES + ${MRN_SOURCES} + ${MRN_UDF_SOURCES} + ${LIBMRN_NO_MYSQL_SOURCES} + ${LIBMRN_NEED_MYSQL_SOURCES}) + if(MRN_BUNDLED) - target_link_libraries(mroonga ${MRN_LIBRARIES}) - if(NOT TARGET mroonga) - return() - endif() + mysql_add_plugin(mroonga + ${MRN_ALL_SOURCES} + STORAGE_ENGINE MODULE_ONLY + LINK_LIBRARIES ${MRN_LIBRARIES}) else() add_library(mroonga MODULE ${MRN_ALL_SOURCES}) @@ -340,8 +359,12 @@ else() MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated") MY_CHECK_AND_SET_COMPILER_FLAG("-fno-implicit-templates") - MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions") - MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti") + if(("${MYSQL_VARIANT}" STREQUAL "MariaDB") OR + ("${MYSQL_VARIANT}" STREQUAL "MySQL" AND + ${MYSQL_VERSION} VERSION_LESS "5.7.0")) + MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions") + MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti") + endif() MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") endif() @@ -362,10 +385,20 @@ else() install(TARGETS mroonga DESTINATION "${MYSQL_PLUGIN_DIR}") endif() +option(MRN_BUILD_FOR_EMBEDDED_SERVER + "Whether to build Mroonga for embedded server or not. You can't use Mroonga built for embedded server with non embedded server." + OFF) +if(MRN_BUILD_FOR_EMBEDDED_SERVER) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "EMBEDDED_LIBRARY") +endif() + if(GROONGA_NORMALIZER_MYSQL_FOUND) - add_definitions("-DWITH_GROONGA_NORMALIZER_MYSQL=1") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "WITH_GROONGA_NORMALIZER_MYSQL=1") if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED) - add_definitions("-DMRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED") else() set_property(TARGET mroonga APPEND PROPERTY COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"") @@ -373,7 +406,8 @@ if(GROONGA_NORMALIZER_MYSQL_FOUND) endif() if(MRN_GROONGA_EMBED) - add_definitions("-DMRN_GROONGA_EMBEDDED") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_GROONGA_EMBEDDED") endif() set(MRN_DEFAULT_PARSER "" CACHE STRING @@ -419,6 +453,8 @@ else() set(MRN_DATA_DIR "share/${PROJECT_NAME}") endif() install(FILES + "${PROJECT_SOURCE_DIR}/AUTHORS" + "${PROJECT_SOURCE_DIR}/COPYING" "${PROJECT_BINARY_DIR}/data/install.sql" "${PROJECT_SOURCE_DIR}/data/uninstall.sql" DESTINATION "${MRN_DATA_DIR}/") diff --git a/storage/mroonga/Makefile.am b/storage/mroonga/Makefile.am index d783ec883f9..69349ea6a8d 100644 --- a/storage/mroonga/Makefile.am +++ b/storage/mroonga/Makefile.am @@ -1,9 +1,9 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_ARGS} AUTOMAKE_OPTIONS = 1.9.7 LOCALES = ja AM_CPPFLAGS = $(MYSQL_INCLUDES) $(GROONGA_CFLAGS) -I$(top_srcdir)/lib -ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS include sources.am @@ -49,7 +49,13 @@ tag: cd $(top_srcdir) && \ git tag v$(VERSION) -a -m 'Mroonga $(VERSION)!!!' -update-latest-release: misc +ensure-cutter-source-path: + @if test -z "$(CUTTER_SOURCE_PATH)"; then \ + echo "\$$(CUTTER_SOURCE_PATH) is missing"; \ + exit 1; \ + fi + +update-latest-release: ensure-cutter-source-path @if test -z "$(OLD_RELEASE)"; then \ echo "\$$(OLD_RELEASE) is missing"; \ exit 1; \ @@ -63,17 +69,40 @@ update-latest-release: misc exit 1; \ fi cd $(top_srcdir) && \ - misc/update-latest-release.rb \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ $(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ $(VERSION) $(NEW_RELEASE_DATE) \ packages/rpm/centos/mariadb-mroonga.spec.in \ + packages/rpm/centos/mariadb-10.1-mroonga.spec.in \ + packages/rpm/centos/mariadb-10.2-mroonga.spec.in \ packages/rpm/centos/mysql55-mroonga.spec.in \ packages/rpm/centos/mysql56-community-mroonga.spec.in \ - packages/debian/changelog \ + packages/rpm/centos/mysql57-community-mroonga.spec.in \ + packages/rpm/centos/percona-server-56-mroonga.spec.in \ + packages/rpm/centos/percona-server-57-mroonga.spec.in \ doc/source/install/*.rst \ doc/locale/*/LC_MESSAGES/install.po \ - $(MROONGA_GITHUB_COM_PATH)/index.html \ - $(MROONGA_GITHUB_COM_PATH)/ja/index.html + $(MROONGA_GITHUB_COM_PATH)/_config.yml + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.5 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.5/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.6 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.6/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.7 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.7/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-mariadb-10.0 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-mariadb-10.0/changelog update-po: @for lang in $(LOCALES); do \ @@ -144,10 +173,3 @@ upload-to-github: echo-cutter: echo $(CUTTER) - -misc: - @if test -z "$(CUTTER_SOURCE_PATH)"; then \ - echo "\$$(CUTTER_SOURCE_PATH) is missing"; \ - exit 1; \ - fi - ln -s "$(CUTTER_SOURCE_PATH)/misc" misc diff --git a/storage/mroonga/appveyor.yml b/storage/mroonga/appveyor.yml index 038d590054e..3cf8ff8d331 100644 --- a/storage/mroonga/appveyor.yml +++ b/storage/mroonga/appveyor.yml @@ -1,54 +1,63 @@ version: "{build}" clone_depth: 10 +environment: + global: + MARIADB_VERSION: 10.1.26 + matrix: + - CMAKE_GENERATOR_NAME: "Visual Studio 14 2015" + - CMAKE_GENERATOR_NAME: "Visual Studio 14 2015 Win64" + install: - cd .. - choco install -y curl 7zip.commandline - - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-10.0.20/source/mariadb-10.0.20.tar.gz - - 7z x mariadb-10.0.20.tar.gz - - 7z x mariadb-10.0.20.tar > nul - - cd mariadb-10.0.20 + - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-%MARIADB_VERSION%/source/mariadb-%MARIADB_VERSION%.tar.gz + - 7z x mariadb-%MARIADB_VERSION%.tar.gz + - 7z x mariadb-%MARIADB_VERSION%.tar > nul + - cd mariadb-%MARIADB_VERSION% - rmdir /S /Q storage\mroonga\ - move ..\mroonga storage\mroonga - - git clone --quiet --depth 1 https://github.com/groonga/groonga.git ..\groonga - - cd ..\groonga - - git submodule update --init - - cd ..\mariadb-10.0.20 + - git clone --quiet --depth 1 --recursive https://github.com/groonga/groonga.git ..\groonga - rmdir /S /Q ..\groonga\test\ + - cd ..\groonga\vendor + - c:\Ruby22-x64\bin\ruby -v download_lz4.rb + - c:\Ruby22-x64\bin\ruby -v download_mecab.rb + - cd ..\..\mariadb-%MARIADB_VERSION% - mkdir storage\mroonga\vendor - move ..\groonga storage\mroonga\vendor\groonga - git clone --quiet --depth 1 https://github.com/groonga/groonga-normalizer-mysql.git storage\mroonga\vendor\groonga\vendor\plugins\groonga-normalizer-mysql build_script: - "echo # > win\\packaging\\CMakeLists.txt" - - cmake . -G "Visual Studio 12 Win64" + - cmake . -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Debug - -DWITHOUT_ARCHIVE=ON - -DWITHOUT_BLACKHOLE=ON - -DWITHOUT_CASSANDRA=ON - -DWITHOUT_CONNECT=ON - -DWITHOUT_CSV=ON - -DWITHOUT_EXAMPLE=ON - -DWITHOUT_FEDERATED=ON - -DWITHOUT_FEDERATEDX=ON - -DWITHOUT_HEAP=ON - -DWITHOUT_INNOBASE=ON - -DWITHOUT_MYISAM=ON - -DWITHOUT_MYISAMMRG=ON - -DWITHOUT_OQGRAPH=ON - -DWITHOUT_PERFSCHEMA=OFF - -DWITHOUT_SEQUENCE=ON - -DWITHOUT_SPHINX=ON - -DWITHOUT_SPIDER=ON - -DWITHOUT_TEST_SQL_DISCOVERY=ON - -DWITHOUT_TOKUDB=ON - -DWITHOUT_XTRADB=ON + -DPLUGIN_ARCHIVE=NO + -DPLUGIN_BLACKHOLE=NO + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_CONNECT=NO + -DPLUGIN_CSV=NO + -DPLUGIN_EXAMPLE=NO + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO + -DPLUGIN_HEAP=NO + -DPLUGIN_INNOBASE=NO + -DPLUGIN_MYISAM=NO + -DPLUGIN_MYISAMMRG=NO + -DPLUGIN_OQGRAPH=NO + -DPLUGIN_PERFSCHEMA=NO + -DPLUGIN_SEQUENCE=NO + -DPLUGIN_SPHINX=NO + -DPLUGIN_SPIDER=NO + -DPLUGIN_TEST_SQL_DISCOVERY=NO + -DPLUGIN_TOKUDB=NO + -DPLUGIN_XTRADB=NO -DWITH_UNIT_TESTS=OFF + -DWITH_MARIABACKUP=OFF + -DGRN_WITH_BUNDLED_MECAB=ON - cmake --build . --config Debug notifications: - provider: Email to: - groonga-mysql-commit@lists.sourceforge.jp - - kou@clear-code.com on_build_status_changed: true test: off diff --git a/storage/mroonga/autogen.sh b/storage/mroonga/autogen.sh index 7a1d38635d4..f795ad000ec 100755 --- a/storage/mroonga/autogen.sh +++ b/storage/mroonga/autogen.sh @@ -1,116 +1,11 @@ #!/bin/sh -warn() { - echo " WARNING: $@" 1>&2 -} - -# init - -LIBTOOLIZE=libtoolize -ACLOCAL=aclocal -AUTOCONF=autoconf -AUTOHEADER=autoheader -AUTOMAKE=automake - -case `uname -s` in -Darwin) - LIBTOOLIZE=glibtoolize - ;; +case $(uname -s) in FreeBSD) - ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/" - ;; + ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/" + ;; esac +mkdir -p m4 -# libtoolize -echo "Searching libtoolize..." -if [ `which $LIBTOOLIZE` ] ; then - echo " FOUND: libtoolize -> $LIBTOOLIZE" -else - warn "Cannot Found libtoolize... input libtool command" - read LIBTOOLIZE - LIBTOOLIZE=`which $LIBTOOLIZE` - if [ `which $LIBTOOLIZE` ] ; then - echo " SET: libtoolize -> $LIBTOOLIZE" - else - warn "$LIBTOOLIZE: Command not found." - exit 1; - fi -fi - -# aclocal -echo "Searching aclocal..." -if [ `which $ACLOCAL` ] ; then - echo " FOUND: aclocal -> $ACLOCAL" -else - warn "Cannot Found aclocal... input aclocal command" - read ACLOCAL - ACLOCAL=`which $ACLOCAL` - if [ `which $ACLOCAL` ] ; then - echo " SET: aclocal -> $ACLOCAL" - else - warn "$ACLOCAL: Command not found." - exit 1; - fi -fi - -# automake -echo "Searching automake..." -if [ `which $AUTOMAKE` ] ; then - echo " FOUND: automake -> $AUTOMAKE" -else - warn "Cannot Found automake... input automake command" - read AUTOMAKE - ACLOCAL=`which $AUTOMAKE` - if [ `which $AUTOMAKE` ] ; then - echo " SET: automake -> $AUTOMAKE" - else - warn "$AUTOMAKE: Command not found." - exit 1; - fi -fi - -# autoheader -echo "Searching autoheader..." -if [ `which $AUTOHEADER` ] ; then - echo " FOUND: autoheader -> $AUTOHEADER" -else - warn "Cannot Found autoheader... input autoheader command" - read AUTOHEADER - ACLOCAL=`which $AUTOHEADER` - if [ `which $AUTOHEADER` ] ; then - echo " SET: autoheader -> $AUTOHEADER" - else - warn "$AUTOHEADER: Command not found." - exit 1; - fi -fi - -# autoconf -echo "Searching autoconf..." -if [ `which $AUTOCONF` ] ; then - echo " FOUND: autoconf -> $AUTOCONF" -else - warn "Cannot Found autoconf... input autoconf command" - read AUTOCONF - ACLOCAL=`which $AUTOCONF` - if [ `which $AUTOCONF` ] ; then - echo " SET: autoconf -> $AUTOCONF" - else - warn "$AUTOCONF: Command not found." - exit 1; - fi -fi - -set -e - -echo "Running libtoolize ..." -$LIBTOOLIZE --force --copy -echo "Running aclocal ..." -$ACLOCAL ${ACLOCAL_ARGS} -echo "Running autoheader..." -$AUTOHEADER -echo "Running automake ..." -$AUTOMAKE --add-missing --copy -echo "Running autoconf ..." -$AUTOCONF +${AUTORECONF:-autoreconf} --force --install "$@" diff --git a/storage/mroonga/build/makefiles/sphinx-build.am b/storage/mroonga/build/makefiles/sphinx-build.am index e237377ba80..57bbcd614e1 100644 --- a/storage/mroonga/build/makefiles/sphinx-build.am +++ b/storage/mroonga/build/makefiles/sphinx-build.am @@ -10,10 +10,8 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR) -SPHINX_DIR = $(abs_top_builddir)/doc/sphinx SPHINX_BUILD_COMMAND = \ DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \ DOCUMENT_VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \ LOCALE="$(LOCALE)" \ - PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" \ $(SPHINX_BUILD) diff --git a/storage/mroonga/config.sh.in b/storage/mroonga/config.sh.in index e86973bdf88..32e88fd5c3d 100644 --- a/storage/mroonga/config.sh.in +++ b/storage/mroonga/config.sh.in @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA MYSQL_SOURCE_DIR="@MYSQL_SOURCE_DIR@" MYSQL_BUILD_DIR="@MYSQL_BUILD_DIR@" diff --git a/storage/mroonga/configure.ac b/storage/mroonga/configure.ac index f60b481e0ea..b1e66904f75 100644 --- a/storage/mroonga/configure.ac +++ b/storage/mroonga/configure.ac @@ -8,6 +8,7 @@ m4_define([mrn_version_in_hex], m4_include(version_in_hex)) m4_define([mrn_plugin_version], m4_include(plugin_version)) AC_INIT([mroonga], [mrn_version], [groonga-talk@lists.sourceforge.net]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([tar-pax foreign subdir-objects]) @@ -173,18 +174,27 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[ MYSQL_INCLUDES="" MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/include" MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql" + if test -d "$ac_mysql_source_dir/sql/auth"; then + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql/auth" + fi MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/include" if test -d "$ac_mysql_source_dir/extra/rapidjson"; then mysql_rapidjson_include_dir="$ac_mysql_source_dir/extra/rapidjson/include" MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_rapidjson_include_dir" fi - if test -d "$ac_mysql_source_dir/pcre"; then - mysql_regex_include_dir="$ac_mysql_source_dir/pcre" + if test -d "$ac_mysql_source_dir/extra/regex"; then + mysql_regex_include_dir="$ac_mysql_source_dir/extra/regex" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" else - mysql_regex_include_dir="$ac_mysql_source_dir/regex" + if test -d "$ac_mysql_source_dir/pcre"; then + mysql_regex_include_dir="$ac_mysql_source_dir/pcre" + else + mysql_regex_include_dir="$ac_mysql_source_dir/regex" + fi + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" fi - MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" if test -d "$ac_mysql_source_dir/libbinlogevents"; then + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/libbinlogevents/include" MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/libbinlogevents/export" MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/libbinlogevents/include" fi @@ -199,7 +209,7 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[ MYSQL_CXXFLAGS="-fno-implicit-templates -felide-constructors" case "$MYSQL_MAJOR_MINOR_VERSION" in - 5.7) + 5.7|8.*) : ;; *) @@ -381,6 +391,13 @@ AC_ARG_WITH(rsync-path, [RSYNC_PATH="packages@packages.groonga.org:public"]) AC_SUBST(RSYNC_PATH) +AC_ARG_WITH(launchpad-ppa, + [AS_HELP_STRING([--with-launchpad-ppa=PPA], + [specify Launchpad Personal Package Archive. [default=groonga-ppa]])], + [LAUNCHPAD_PPA="$withval"], + [LAUNCHPAD_PPA="groonga-ppa"]) +AC_SUBST(LAUNCHPAD_PPA) + AC_ARG_WITH(launchpad-uploader-pgp-key, [AS_HELP_STRING([--with-launchpad-uploader-pgp-key=KEY], [specify PGP key UID to upload Groonga packages to Launchpad.])], @@ -429,7 +446,7 @@ if test x"$enable_document" != x"no"; then AC_PATH_PROG(SPHINX_BUILD, sphinx-build, []) if test -n "$SPHINX_BUILD"; then sphinx_build_version=`"$SPHINX_BUILD" --version` - if ! echo "$sphinx_build_version" | grep -q ' 1\.[[23]]'; then + if ! echo "$sphinx_build_version" | grep -q ' 1\.[[2-6]]'; then AC_MSG_ERROR([ sphinx-build is old: $sphinx_build_version Sphinx 1.2 or later is required.]) @@ -509,12 +526,19 @@ AC_OUTPUT([ mrn_version.h mysql-test/mroonga/storage/information_schema/r/plugins.result mysql-test/mroonga/storage/variable/r/version.result - packages/debian/control + packages/debian-5.5/control + packages/debian-5.6/control + packages/debian-5.7/control + packages/debian-mariadb-10.0/control packages/apt/env.sh packages/rpm/centos/mysql55-mroonga.spec packages/rpm/centos/mysql56-community-mroonga.spec + packages/rpm/centos/mysql57-community-mroonga.spec packages/rpm/centos/mariadb-mroonga.spec + packages/rpm/centos/mariadb-10.1-mroonga.spec + packages/rpm/centos/mariadb-10.2-mroonga.spec packages/rpm/centos/percona-server-56-mroonga.spec + packages/rpm/centos/percona-server-57-mroonga.spec packages/yum/env.sh data/install.sql ]) diff --git a/storage/mroonga/data/install.sql.in b/storage/mroonga/data/install.sql.in index b0c930c8144..d7d5f3c4ad6 100644 --- a/storage/mroonga/data/install.sql.in +++ b/storage/mroonga/data/install.sql.in @@ -17,3 +17,19 @@ CREATE FUNCTION mroonga_command RETURNS STRING DROP FUNCTION IF EXISTS mroonga_escape; CREATE FUNCTION mroonga_escape RETURNS STRING SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_snippet_html; +CREATE FUNCTION mroonga_snippet_html RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_normalize; +CREATE FUNCTION mroonga_normalize RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_highlight_html; +CREATE FUNCTION mroonga_highlight_html RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_query_expand; +CREATE FUNCTION mroonga_query_expand RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; diff --git a/storage/mroonga/data/uninstall.sql b/storage/mroonga/data/uninstall.sql index b79e6c03d18..5713e074224 100644 --- a/storage/mroonga/data/uninstall.sql +++ b/storage/mroonga/data/uninstall.sql @@ -2,6 +2,10 @@ DROP FUNCTION IF EXISTS last_insert_grn_id; DROP FUNCTION IF EXISTS mroonga_snippet; DROP FUNCTION IF EXISTS mroonga_command; DROP FUNCTION IF EXISTS mroonga_escape; +DROP FUNCTION IF EXISTS mroonga_snippet_html; +DROP FUNCTION IF EXISTS mroonga_normalize; +DROP FUNCTION IF EXISTS mroonga_highlight_html; +DROP FUNCTION IF EXISTS mroonga_query_expand; UNINSTALL PLUGIN Mroonga; diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 96fe2b05ee7..0b0de7a41ed 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -2,7 +2,7 @@ /* Copyright(C) 2010 Tetsuro IKEDA Copyright(C) 2010-2013 Kentoku SHIBA - Copyright(C) 2011-2015 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou Copyright(C) 2013 Kenji Maruyama This library is free software; you can redistribute it and/or @@ -66,14 +66,9 @@ # include #endif -#define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \ - type *variable_name = \ - (type *)mrn_my_malloc(sizeof(type) * (variable_size), MYF(MY_WME)) -#define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) \ - my_free(variable_name) - #include "mrn_err.h" #include "mrn_table.hpp" +#include #include "ha_mroonga.hpp" #include #include @@ -91,9 +86,17 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include #ifdef MRN_SUPPORT_FOREIGN_KEYS # include @@ -143,10 +146,18 @@ static mysql_mutex_t *mrn_LOCK_open; # define MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK #endif -#if MYSQL_VERSION_ID >= 50603 || defined(MRN_MARIADB_P) -# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +#ifdef MRN_MARIADB_P +# if MYSQL_VERSION_ID >= 100200 +# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +# else +# define MRN_ORDER_IS_ASC(order) ((order)->asc) +# endif #else -# define MRN_ORDER_IS_ASC(order) ((order)->asc) +# if MYSQL_VERSION_ID >= 50603 +# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +# else +# define MRN_ORDER_IS_ASC(order) ((order)->asc) +# endif #endif #define MRN_STRINGIFY(macro_or_string) MRN_STRINGIFY_ARG(macro_or_string) @@ -199,22 +210,6 @@ static mysql_mutex_t *mrn_LOCK_open; calculate_key_len(table, key_index, buffer, keypart_map) #endif -#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P) -# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \ - ((select_lex)->where_cond()) -# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \ - ((select_lex)->having_cond()) -# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \ - ((select_lex)->active_options()) -#else -# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \ - ((select_lex)->where) -# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \ - ((select_lex)->having) -# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \ - ((select_lex)->options) -#endif - #if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P) # define MRN_TABLE_LIST_GET_DERIVED(table_list) NULL #else @@ -249,10 +244,6 @@ static const char *MRN_PLUGIN_AUTHOR = "The Mroonga project"; extern "C" { #endif -/* groonga's internal functions */ -int grn_atoi(const char *nptr, const char *end, const char **rest); -uint grn_atoui(const char *nptr, const char *end, const char **rest); - #ifdef HAVE_PSI_INTERFACE # ifdef WIN32 # ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE @@ -266,18 +257,41 @@ static PSI_mutex_key mrn_allocated_thds_mutex_key; PSI_mutex_key mrn_share_mutex_key; PSI_mutex_key mrn_long_term_share_auto_inc_mutex_key; static PSI_mutex_key mrn_log_mutex_key; +static PSI_mutex_key mrn_query_log_mutex_key; static PSI_mutex_key mrn_db_manager_mutex_key; +static PSI_mutex_key mrn_context_pool_mutex_key; +static PSI_mutex_key mrn_operations_mutex_key; + +# if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_MUTEXT_INFO_ENTRY(key, name, flags, volatility) \ + {key, name, flags, volatility} +# else +# define MRN_MUTEXT_INFO_ENTRY(key, name, flags, volatility) \ + {key, name, flags} +# endif static PSI_mutex_info mrn_mutexes[] = { - {&mrn_open_tables_mutex_key, "open_tables", PSI_FLAG_GLOBAL}, - {&mrn_long_term_share_mutex_key, "long_term_share", PSI_FLAG_GLOBAL}, - {&mrn_allocated_thds_mutex_key, "allocated_thds", PSI_FLAG_GLOBAL}, - {&mrn_share_mutex_key, "share", 0}, - {&mrn_long_term_share_auto_inc_mutex_key, - "long_term_share::auto_inc", 0}, - {&mrn_log_mutex_key, "log", PSI_FLAG_GLOBAL}, - {&mrn_db_manager_mutex_key, "DatabaseManager", PSI_FLAG_GLOBAL} + MRN_MUTEXT_INFO_ENTRY(&mrn_open_tables_mutex_key, + "mrn::open_tables", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_long_term_share_mutex_key, + "mrn::long_term_share", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_allocated_thds_mutex_key, + "mrn::allocated_thds", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_share_mutex_key, + "mrn::share", 0, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_long_term_share_auto_inc_mutex_key, + "mrn::long_term_share::auto_inc", 0, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_log_mutex_key, + "mrn::log", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_query_log_mutex_key, + "mrn::query_log", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_db_manager_mutex_key, + "mrn::DatabaseManager", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_context_pool_mutex_key, + "mrn::ContextPool", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_operations_mutex_key, + "mrn::Operations", PSI_FLAG_GLOBAL, 0) }; #endif @@ -294,10 +308,14 @@ mysql_mutex_t mrn_allocated_thds_mutex; /* internal variables */ static grn_ctx mrn_ctx; static mysql_mutex_t mrn_log_mutex; +static mysql_mutex_t mrn_query_log_mutex; static grn_obj *mrn_db; static grn_ctx mrn_db_manager_ctx; static mysql_mutex_t mrn_db_manager_mutex; mrn::DatabaseManager *mrn_db_manager = NULL; +static mysql_mutex_t mrn_context_pool_mutex; +mrn::ContextPool *mrn_context_pool = NULL; +static mysql_mutex_t mrn_operations_mutex; #ifdef WIN32 @@ -523,6 +541,8 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation) case HA_EXTRA_DETACH_CHILDREN: inspected = "HA_EXTRA_DETACH_CHILDREN"; break; + case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: + break; #ifdef MRN_HAVE_HA_EXTRA_EXPORT case HA_EXTRA_EXPORT: inspected = "HA_EXTRA_EXPORT"; @@ -542,6 +562,26 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation) case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE: inspected = "HA_EXTRA_PREPARE_FOR_FORCED_CLOSE"; break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW + case HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW: + inspected = "HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_BEGIN_ALTER_COPY + case HA_EXTRA_BEGIN_ALTER_COPY: + inspected = "HA_EXTRA_BEGIN_ALTER_COPY"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_END_ALTER_COPY + case HA_EXTRA_END_ALTER_COPY: + inspected = "HA_EXTRA_END_ALTER_COPY"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_NO_AUTOINC_LOCKING + case HA_EXTRA_NO_AUTOINC_LOCKING: + inspected = "HA_EXTRA_NO_AUTOINC_LOCKING"; + break; #endif } return inspected; @@ -579,6 +619,7 @@ static FILE *mrn_log_file = NULL; static bool mrn_log_file_opened = false; static grn_log_level mrn_log_level_default = GRN_LOG_DEFAULT_LEVEL; static ulong mrn_log_level = mrn_log_level_default; +static char *mrn_query_log_file_path = NULL; char *mrn_default_tokenizer = NULL; char *mrn_default_wrapper_engine = NULL; @@ -586,16 +627,10 @@ static int mrn_lock_timeout = grn_get_lock_timeout(); static char *mrn_libgroonga_version = const_cast(grn_get_version()); static char *mrn_version = const_cast(MRN_VERSION); static char *mrn_vector_column_delimiter = NULL; -static my_bool mrn_libgroonga_support_zlib = FALSE; -static my_bool mrn_libgroonga_support_lz4 = FALSE; -typedef enum { - MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT = (1 << 0), - MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_QUERY = (1 << 1), - MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT = (1 << 2), - MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN = (1 << 3), - MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE = (1 << 4), - MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT = (1 << 5) -} mrn_boolean_mode_syntax_flag; +static mrn_bool mrn_libgroonga_support_zlib = false; +static mrn_bool mrn_libgroonga_support_lz4 = false; +static mrn_bool mrn_libgroonga_support_zstd = false; +static mrn_bool mrn_enable_operations_recording = true; #ifdef MRN_SUPPORT_THDVAR_SET static const char *mrn_boolean_mode_sytnax_flag_names[] = { "DEFAULT", @@ -614,28 +649,13 @@ static TYPELIB mrn_boolean_mode_syntax_flags_typelib = { }; #endif #ifdef MRN_GROONGA_EMBEDDED -static my_bool mrn_libgroonga_embedded = TRUE; +static mrn_bool mrn_libgroonga_embedded = true; #else -static my_bool mrn_libgroonga_embedded = FALSE; +static mrn_bool mrn_libgroonga_embedded = false; #endif -typedef enum { - MRN_ACTION_ON_ERROR_ERROR, - MRN_ACTION_ON_ERROR_ERROR_AND_LOG, - MRN_ACTION_ON_ERROR_IGNORE, - MRN_ACTION_ON_ERROR_IGNORE_AND_LOG, -} mrn_action_on_error; - -static const char *mrn_action_on_error_names[] = { - "ERROR", - "ERROR_AND_LOG", - "IGNORE", - "IGNORE_AND_LOG", - NullS, -}; - -static mrn_action_on_error mrn_action_on_fulltext_query_error_default = - MRN_ACTION_ON_ERROR_ERROR_AND_LOG; +static mrn::variables::ActionOnError mrn_action_on_fulltext_query_error_default = + mrn::variables::ACTION_ON_ERROR_ERROR_AND_LOG; static void mrn_logger_log(grn_ctx *ctx, grn_log_level level, const char *timestamp, const char *title, @@ -752,20 +772,19 @@ static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var, const char *new_value = *((const char **)save); char **old_value_ptr = (char **)var_ptr; - grn_ctx ctx; - grn_ctx_init(&ctx, 0); - mrn_change_encoding(&ctx, system_charset_info); + grn_ctx *ctx = &mrn_ctx; + mrn_change_encoding(ctx, system_charset_info); const char *new_log_file_name; new_log_file_name = *old_value_ptr; if (strcmp(*old_value_ptr, new_value) == 0) { - GRN_LOG(&ctx, GRN_LOG_NOTICE, + GRN_LOG(ctx, GRN_LOG_NOTICE, "log file isn't changed " "because the requested path isn't different: <%s>", new_value); } else { - GRN_LOG(&ctx, GRN_LOG_NOTICE, + GRN_LOG(ctx, GRN_LOG_NOTICE, "log file is changed: <%s> -> <%s>", *old_value_ptr, new_value); @@ -786,18 +805,18 @@ static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var, } if (log_file_open_errno == 0) { - GRN_LOG(&ctx, GRN_LOG_NOTICE, + GRN_LOG(ctx, GRN_LOG_NOTICE, "log file is changed: <%s> -> <%s>", *old_value_ptr, new_value); new_log_file_name = new_value; } else { if (mrn_log_file) { - GRN_LOG(&ctx, GRN_LOG_ERROR, + GRN_LOG(ctx, GRN_LOG_ERROR, "log file isn't changed " "because the requested path can't be opened: <%s>: <%s>", new_value, strerror(log_file_open_errno)); } else { - GRN_LOG(&ctx, GRN_LOG_ERROR, + GRN_LOG(ctx, GRN_LOG_ERROR, "log file can't be opened: <%s>: <%s>", new_value, strerror(log_file_open_errno)); } @@ -812,8 +831,6 @@ static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var, *old_value_ptr = mrn_my_strdup(new_log_file_name, MYF(MY_WME)); #endif - grn_ctx_fin(&ctx); - DBUG_VOID_RETURN; } @@ -824,23 +841,100 @@ static MYSQL_SYSVAR_STR(log_file, mrn_log_file_path, mrn_log_file_update, MRN_LOG_FILE_PATH); +static void mrn_query_log_file_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + const char *normalized_new_value = NULL; + + grn_ctx *ctx = &mrn_ctx; + mrn_change_encoding(ctx, system_charset_info); + + const char *new_query_log_file_name; + new_query_log_file_name = *old_value_ptr; + + bool need_update = false; + if (!*old_value_ptr) { + if (new_value && new_value[0] != '\0') { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log is enabled: <%s>", + new_value); + need_update = true; + normalized_new_value = new_value; + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is still disabled"); + } + } else { + if (!new_value || new_value[0] == '\0') { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is disabled: <%s>", + *old_value_ptr); + need_update = true; + normalized_new_value = NULL; + } else if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file isn't changed " + "because the requested path isn't different: <%s>", + new_value); + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + need_update = true; + normalized_new_value = new_value; + } + } + + if (need_update) { + { // TODO: Remove me when Groonga 7.0.5 is released. + mrn::Lock lock(&mrn_query_log_mutex); + grn_default_query_logger_set_path(normalized_new_value); + } + grn_query_logger_reopen(ctx); + new_query_log_file_name = normalized_new_value; + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + char *old_query_log_file_name = *old_value_ptr; +#endif + if (new_query_log_file_name) { + *old_value_ptr = mrn_my_strdup(new_query_log_file_name, MYF(0)); + } else { + *old_value_ptr = NULL; + } +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(old_query_log_file_name); +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(query_log_file, mrn_query_log_file_path, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "query log file for " MRN_PLUGIN_NAME_STRING, + NULL, + mrn_query_log_file_update, + NULL); + static void mrn_default_tokenizer_update(THD *thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save) { MRN_DBUG_ENTER_FUNCTION(); const char *new_value = *((const char **)save); char **old_value_ptr = (char **)var_ptr; - grn_ctx ctx; + grn_ctx *ctx = &mrn_ctx; - grn_ctx_init(&ctx, 0); - mrn_change_encoding(&ctx, system_charset_info); + mrn_change_encoding(ctx, system_charset_info); if (strcmp(*old_value_ptr, new_value) == 0) { - GRN_LOG(&ctx, GRN_LOG_NOTICE, + GRN_LOG(ctx, GRN_LOG_NOTICE, "default tokenizer for fulltext index isn't changed " "because the requested default tokenizer isn't different: <%s>", new_value); } else { - GRN_LOG(&ctx, GRN_LOG_NOTICE, + GRN_LOG(ctx, GRN_LOG_NOTICE, "default tokenizer for fulltext index is changed: <%s> -> <%s>", *old_value_ptr, new_value); } @@ -852,8 +946,6 @@ static void mrn_default_tokenizer_update(THD *thd, struct st_mysql_sys_var *var, *old_value_ptr = (char *)new_value; #endif - grn_ctx_fin(&ctx); - DBUG_VOID_RETURN; } @@ -959,6 +1051,14 @@ static MYSQL_SYSVAR_STR(default_wrapper_engine, mrn_default_wrapper_engine, NULL, NULL); +static const char *mrn_action_on_error_names[] = { + "ERROR", + "ERROR_AND_LOG", + "IGNORE", + "IGNORE_AND_LOG", + NullS, +}; + static TYPELIB mrn_action_on_error_typelib = { array_elements(mrn_action_on_error_names) - 1, @@ -1013,7 +1113,7 @@ static MYSQL_SYSVAR_STR(version, mrn_version, NULL, MRN_VERSION); -static my_bool grn_check_zlib_support() +static mrn_bool grn_check_zlib_support() { bool is_zlib_support = false; grn_obj grn_support_p; @@ -1026,7 +1126,14 @@ static my_bool grn_check_zlib_support() return is_zlib_support; } -static my_bool grn_check_lz4_support() +static MYSQL_SYSVAR_BOOL(libgroonga_support_zlib, mrn_libgroonga_support_zlib, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "The status of libgroonga supports zlib", + NULL, + NULL, + grn_check_zlib_support()); + +static mrn_bool grn_check_lz4_support() { bool is_lz4_support = false; grn_obj grn_support_p; @@ -1039,13 +1146,6 @@ static my_bool grn_check_lz4_support() return is_lz4_support; } -static MYSQL_SYSVAR_BOOL(libgroonga_support_zlib, mrn_libgroonga_support_zlib, - PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "The status of libgroonga supports zlib", - NULL, - NULL, - grn_check_zlib_support()); - static MYSQL_SYSVAR_BOOL(libgroonga_support_lz4, mrn_libgroonga_support_lz4, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "The status of libgroonga supports LZ4", @@ -1053,6 +1153,45 @@ static MYSQL_SYSVAR_BOOL(libgroonga_support_lz4, mrn_libgroonga_support_lz4, NULL, grn_check_lz4_support()); +static mrn_bool grn_check_zstd_support() +{ + bool is_zstd_support = false; + grn_obj grn_support_p; + + GRN_BOOL_INIT(&grn_support_p, 0); + grn_obj_get_info(&mrn_ctx, NULL, GRN_INFO_SUPPORT_ZSTD, &grn_support_p); + is_zstd_support = (GRN_BOOL_VALUE(&grn_support_p)); + grn_obj_unlink(&mrn_ctx, &grn_support_p); + + return is_zstd_support; +} + +static MYSQL_SYSVAR_BOOL(libgroonga_support_zstd, mrn_libgroonga_support_zstd, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "The status of libgroonga supports Zstandard", + NULL, + NULL, + grn_check_zstd_support()); + +static void mrn_enable_operations_recording_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const bool new_value = *static_cast(save); + bool *old_value_ptr = static_cast(var_ptr); + + *old_value_ptr = new_value; + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_BOOL(enable_operations_recording, mrn_enable_operations_recording, + PLUGIN_VAR_RQCMDARG, + "Whether recording operations for recovery is enabled or not", + NULL, + mrn_enable_operations_recording_update, + true); + #ifdef MRN_SUPPORT_THDVAR_SET static MYSQL_THDVAR_SET(boolean_mode_syntax_flags, PLUGIN_VAR_RQCMDARG, @@ -1063,7 +1202,7 @@ static MYSQL_THDVAR_SET(boolean_mode_syntax_flags, "ALLOW_COLUMN, ALLOW_UPDATE and ALLOW_LEADING_NOT", NULL, NULL, - MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT, + mrn::variables::BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT, &mrn_boolean_mode_syntax_flags_typelib); #endif @@ -1105,11 +1244,14 @@ static struct st_mysql_sys_var *mrn_system_variables[] = MYSQL_SYSVAR(vector_column_delimiter), MYSQL_SYSVAR(libgroonga_support_zlib), MYSQL_SYSVAR(libgroonga_support_lz4), + MYSQL_SYSVAR(libgroonga_support_zstd), #ifdef MRN_SUPPORT_THDVAR_SET MYSQL_SYSVAR(boolean_mode_syntax_flags), #endif MYSQL_SYSVAR(max_n_records_for_estimate), MYSQL_SYSVAR(libgroonga_embedded), + MYSQL_SYSVAR(query_log_file), + MYSQL_SYSVAR(enable_operations_recording), NULL }; @@ -1147,7 +1289,8 @@ static ST_FIELD_INFO i_s_mrn_stats_fields_info[] = 0, "Rows read from Groonga", SKIP_OPEN_TABLE - } + }, + { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0} }; static int i_s_mrn_stats_deinit(void* p) @@ -1191,6 +1334,9 @@ struct st_mysql_plugin i_s_mrn_stats = "Statistics for " MRN_PLUGIN_NAME_STRING, PLUGIN_LICENSE_GPL, i_s_mrn_stats_init, +#ifdef MRN_ST_MYSQL_PLUGIN_HAVE_CHECK_UNINSTALL + NULL, +#endif i_s_mrn_stats_deinit, MRN_VERSION_IN_HEX, NULL, @@ -1199,7 +1345,12 @@ struct st_mysql_plugin i_s_mrn_stats = }; /* End of mroonga information schema implementations */ -static handler *mrn_handler_create(handlerton *hton, TABLE_SHARE *share, MEM_ROOT *root) +static handler *mrn_handler_create(handlerton *hton, + TABLE_SHARE *share, +#ifdef MRN_HANDLERTON_CREATE_HAVE_PARTITIONED + bool partitioned, +#endif + MEM_ROOT *root) { MRN_DBUG_ENTER_FUNCTION(); handler *new_handler = new (root) ha_mroonga(hton, share); @@ -1413,6 +1564,11 @@ static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field, case MYSQL_TYPE_VARCHAR_COMPRESSED: case MYSQL_TYPE_BLOB_COMPRESSED: DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + type = GRN_DB_TEXT; + break; +#endif } return type; } @@ -1463,6 +1619,17 @@ static bool mrn_parse_grn_column_create_flags(THD *thd, "COMPRESS_LZ4"); } flag_names += 12; + } else if (rest_length >= 13 && !memcmp(flag_names, "COMPRESS_ZSTD", 13)) { + if (mrn_libgroonga_support_zstd) { + *column_flags |= GRN_OBJ_COMPRESS_ZSTD; + found = true; + } else { + push_warning_printf(thd, MRN_SEVERITY_WARNING, + ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM, + ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR, + "COMPRESS_ZSTD"); + } + flag_names += 13; } else { char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE]; snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE, @@ -1483,7 +1650,7 @@ static bool mrn_parse_grn_index_column_flags(THD *thd, grn_ctx *ctx, const char *flag_names, uint flag_names_length, - grn_obj_flags *index_column_flags) + grn_column_flags *index_column_flags) { const char *flag_names_end = flag_names + flag_names_length; bool found = false; @@ -1510,6 +1677,14 @@ static bool mrn_parse_grn_index_column_flags(THD *thd, *index_column_flags |= GRN_OBJ_WITH_WEIGHT; flag_names += 11; found = true; + } else if (rest_length >= 11 && !memcmp(flag_names, "INDEX_SMALL", 11)) { + *index_column_flags |= GRN_OBJ_INDEX_SMALL; + flag_names += 11; + found = true; + } else if (rest_length >= 12 && !memcmp(flag_names, "INDEX_MEDIUM", 12)) { + *index_column_flags |= GRN_OBJ_INDEX_MEDIUM; + flag_names += 12; + found = true; } else { char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE]; snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE, @@ -1621,8 +1796,7 @@ static int mrn_init(void *p) { // init handlerton grn_ctx *ctx = NULL; - handlerton *hton; - hton = (handlerton *)p; + handlerton *hton = static_cast(p); hton->state = SHOW_OPTION_YES; hton->create = mrn_handler_create; hton->flags = HTON_NO_FLAGS; @@ -1677,7 +1851,7 @@ static int mrn_init(void *p) # endif #endif -#ifdef HAVE_PSI_INTERFACE +#ifdef MRN_HAVE_PSI_SERVER if (PSI_server) { const char *category = "mroonga"; int n_mutexes = array_elements(mrn_mutexes); @@ -1685,6 +1859,8 @@ static int mrn_init(void *p) } #endif + grn_default_query_logger_set_path(mrn_query_log_file_path); + if (grn_init() != GRN_SUCCESS) { goto err_grn_init; } @@ -1711,6 +1887,11 @@ static int mrn_init(void *p) MY_MUTEX_INIT_FAST) != 0) { goto err_log_mutex_init; } + if (mysql_mutex_init(mrn_query_log_mutex_key, + &mrn_query_log_mutex, + MY_MUTEX_INIT_FAST) != 0) { + goto err_query_log_mutex_init; + } mrn_logger.max_level = static_cast(mrn_log_level); grn_logger_set(ctx, &mrn_logger); @@ -1743,13 +1924,31 @@ static int mrn_init(void *p) if (!mrn_db_manager->init()) { goto err_db_manager_init; } + + if (mysql_mutex_init(mrn_context_pool_mutex_key, + &mrn_context_pool_mutex, + MY_MUTEX_INIT_FAST) != 0) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "failed to initialize mutex for context pool"); + goto error_context_pool_mutex_init; + } + mrn_context_pool = new mrn::ContextPool(&mrn_context_pool_mutex); + + if (mysql_mutex_init(mrn_operations_mutex_key, + &mrn_operations_mutex, + MY_MUTEX_INIT_FAST) != 0) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "failed to initialize mutex for operations"); + goto error_operations_mutex_init; + } + if ((mysql_mutex_init(mrn_allocated_thds_mutex_key, &mrn_allocated_thds_mutex, MY_MUTEX_INIT_FAST) != 0)) { goto err_allocated_thds_mutex_init; } - if (my_hash_init(&mrn_allocated_thds, system_charset_info, 32, 0, 0, - mrn_allocated_thds_get_key, 0, 0)) { + if (mrn_my_hash_init(&mrn_allocated_thds, system_charset_info, 32, 0, 0, + mrn_allocated_thds_get_key, 0, 0)) { goto error_allocated_thds_hash_init; } if ((mysql_mutex_init(mrn_open_tables_mutex_key, @@ -1757,8 +1956,8 @@ static int mrn_init(void *p) MY_MUTEX_INIT_FAST) != 0)) { goto err_allocated_open_tables_mutex_init; } - if (my_hash_init(&mrn_open_tables, system_charset_info, 32, 0, 0, - mrn_open_tables_get_key, 0, 0)) { + if (mrn_my_hash_init(&mrn_open_tables, system_charset_info, 32, 0, 0, + mrn_open_tables_get_key, 0, 0)) { goto error_allocated_open_tables_hash_init; } if ((mysql_mutex_init(mrn_long_term_share_mutex_key, @@ -1766,8 +1965,8 @@ static int mrn_init(void *p) MY_MUTEX_INIT_FAST) != 0)) { goto error_allocated_long_term_share_mutex_init; } - if (my_hash_init(&mrn_long_term_share, system_charset_info, 32, 0, 0, - mrn_long_term_share_get_key, 0, 0)) { + if (mrn_my_hash_init(&mrn_long_term_share, system_charset_info, 32, 0, 0, + mrn_long_term_share_get_key, 0, 0)) { goto error_allocated_long_term_share_hash_init; } @@ -1788,6 +1987,11 @@ err_allocated_open_tables_mutex_init: error_allocated_thds_hash_init: mysql_mutex_destroy(&mrn_allocated_thds_mutex); err_allocated_thds_mutex_init: + mysql_mutex_destroy(&mrn_operations_mutex); +error_operations_mutex_init: + delete mrn_context_pool; + mysql_mutex_destroy(&mrn_context_pool_mutex); +error_context_pool_mutex_init: err_db_manager_init: delete mrn_db_manager; mysql_mutex_destroy(&mrn_db_manager_mutex); @@ -1800,6 +2004,8 @@ err_db_create: mrn_log_file_opened = false; } err_log_file_open: + mysql_mutex_destroy(&mrn_query_log_mutex); +err_query_log_mutex_init: mysql_mutex_destroy(&mrn_log_mutex); err_log_mutex_init: err_mrn_change_encoding: @@ -1844,6 +2050,9 @@ static int mrn_deinit(void *p) mysql_mutex_destroy(&mrn_open_tables_mutex); my_hash_free(&mrn_allocated_thds); mysql_mutex_destroy(&mrn_allocated_thds_mutex); + mysql_mutex_destroy(&mrn_operations_mutex); + delete mrn_context_pool; + mysql_mutex_destroy(&mrn_context_pool_mutex); delete mrn_db_manager; mysql_mutex_destroy(&mrn_db_manager_mutex); grn_ctx_fin(&mrn_db_manager_ctx); @@ -1856,6 +2065,7 @@ static int mrn_deinit(void *p) fclose(mrn_log_file); mrn_log_file_opened = false; } + mysql_mutex_destroy(&mrn_query_log_mutex); mysql_mutex_destroy(&mrn_log_mutex); return 0; @@ -2342,7 +2552,8 @@ ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg) ignoring_no_key_columns(false), replacing_(false), written_by_row_based_binlog(0), - current_ft_item(NULL) + current_ft_item(NULL), + operations_(NULL) { MRN_DBUG_ENTER_METHOD(); grn_ctx_init(ctx, 0); @@ -2361,6 +2572,9 @@ ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg) ha_mroonga::~ha_mroonga() { MRN_DBUG_ENTER_METHOD(); + + delete operations_; + if (analyzed_for_create) { if (wrap_handler_for_create) { delete wrap_handler_for_create; @@ -2625,6 +2839,12 @@ ulonglong ha_mroonga::wrapper_table_flags() const #endif #ifdef HA_CAN_FULLTEXT_EXT table_flags |= HA_CAN_FULLTEXT_EXT; +#endif +#ifdef HA_GENERATED_COLUMNS + table_flags |= HA_GENERATED_COLUMNS; +#endif +#ifdef HA_CAN_VIRTUAL_COLUMNS + table_flags |= HA_CAN_VIRTUAL_COLUMNS; #endif DBUG_RETURN(table_flags); } @@ -2654,6 +2874,12 @@ ulonglong ha_mroonga::storage_table_flags() const #endif #ifdef HA_CAN_FULLTEXT_EXT flags |= HA_CAN_FULLTEXT_EXT; +#endif +#ifdef HA_GENERATED_COLUMNS + flags |= HA_GENERATED_COLUMNS; +#endif +#ifdef HA_CAN_VIRTUAL_COLUMNS + flags |= HA_CAN_VIRTUAL_COLUMNS; #endif DBUG_RETURN(flags); } @@ -2719,7 +2945,7 @@ ulong ha_mroonga::storage_index_flags(uint idx, uint part, bool all_parts) const part = 0; } Field *field = &(key->key_part[part].field[0]); - if (field && should_normalize(field)) { + if (field && (have_custom_normalizer(key) || should_normalize(field))) { need_normalize_p = true; } if (!need_normalize_p) { @@ -2743,7 +2969,7 @@ ulong ha_mroonga::index_flags(uint idx, uint part, bool all_parts) const DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); } if (mrn_is_geo_key(key)) { - DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); + DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR | HA_READ_RANGE); } int error = 0; @@ -2860,9 +3086,11 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table, DBUG_RETURN(ER_REQUIRES_PRIMARY_KEY); } - mrn::PathMapper mapper(name); - error = wrapper_create_index(name, table, info, tmp_share, - mapper.table_name()); + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = wrapper_create_index(name, table, tmp_share); if (error) DBUG_RETURN(error); @@ -2910,6 +3138,7 @@ int ha_mroonga::wrapper_create(const char *name, TABLE *table, delete hnd; if (error) { + mrn::PathMapper mapper(name); generic_delete_table(name, mapper.table_name()); } @@ -2973,7 +3202,7 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name, GRN_OBJ_PERSISTENT; grn_obj *index_table; - grn_obj_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + grn_column_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; if (!find_index_column_flags(key_info, &index_column_flags)) { index_column_flags |= GRN_OBJ_WITH_POSITION; @@ -3020,7 +3249,8 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name, grn_obj_unlink(ctx, &token_filters); } - if (should_normalize(&key_info->key_part->field[0])) { + if (have_custom_normalizer(key_info) || + should_normalize(&key_info->key_part->field[0])) { grn_info_type info_type = GRN_INFO_NORMALIZER; grn_obj *normalizer = find_normalizer(key_info); if (normalizer) { @@ -3109,22 +3339,18 @@ int ha_mroonga::wrapper_create_index_geo(const char *grn_table_name, } int ha_mroonga::wrapper_create_index(const char *name, TABLE *table, - HA_CREATE_INFO *info, - MRN_SHARE *tmp_share, - const char *grn_table_name) + MRN_SHARE *tmp_share) { MRN_DBUG_ENTER_METHOD(); int error = 0; - error = ensure_database_open(name); - if (error) - DBUG_RETURN(error); - error = mrn_change_encoding(ctx, system_charset_info); if (error) DBUG_RETURN(error); grn_obj *grn_index_table; + mrn::PathMapper mapper(name); + const char *grn_table_name = mapper.table_name(); char *grn_table_path = NULL; // we don't specify path grn_obj *pkey_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); grn_obj *pkey_value_type = NULL; // we don't use this @@ -3313,10 +3539,9 @@ int ha_mroonga::storage_create(const char *name, TABLE *table, uint n_columns = table->s->fields; for (uint i = 0; i < n_columns; i++) { Field *field = table->s->field[i]; - const char *column_name = field->field_name.str; - int column_name_size = strlen(column_name); + mrn::ColumnName column_name(field->field_name); - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (strcmp(MRN_COLUMN_NAME_ID, column_name.mysql_name()) == 0) { continue; } @@ -3331,6 +3556,12 @@ int ha_mroonga::storage_create(const char *name, TABLE *table, } #endif +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; if (!find_column_flags(field, tmp_share, i, &col_flags)) { col_flags |= GRN_OBJ_COLUMN_SCALAR; @@ -3347,12 +3578,13 @@ int ha_mroonga::storage_create(const char *name, TABLE *table, } char *col_path = NULL; // we don't specify path - grn_column_create(ctx, table_obj, column_name, column_name_size, + grn_column_create(ctx, table_obj, + column_name.c_str(), column_name.length(), col_path, col_flags, col_type); if (ctx->rc) { - grn_obj_remove(ctx, table_obj); error = ER_CANT_CREATE_TABLE; my_message(error, ctx->errbuf, MYF(0)); + grn_obj_remove(ctx, table_obj); DBUG_RETURN(error); } } @@ -3490,7 +3722,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table, if (!grn_table_ref) { error = ER_CANT_CREATE_TABLE; char err_msg[MRN_BUFFER_SIZE]; - sprintf(err_msg, "refference table [%s.%s] is not mroonga table", + sprintf(err_msg, "reference table [%s.%s] is not mroonga table", table->s->db.str, ref_table_name.str); my_message(error, err_msg, MYF(0)); DBUG_RETURN(false); @@ -3509,7 +3741,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table, grn_obj_unlink(ctx, grn_table_ref); error = ER_CANT_CREATE_TABLE; char err_msg[MRN_BUFFER_SIZE]; - sprintf(err_msg, "refference table [%s.%s] is not found", + sprintf(err_msg, "reference table [%s.%s] is not found", table->s->db.str, ref_table_name.str); my_message(error, err_msg, MYF(0)); DBUG_RETURN(false); @@ -3522,7 +3754,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table, grn_obj_unlink(ctx, grn_table_ref); error = ER_CANT_CREATE_TABLE; char err_msg[MRN_BUFFER_SIZE]; - sprintf(err_msg, "refference table [%s.%s] has no primary key", + sprintf(err_msg, "reference table [%s.%s] has no primary key", table->s->db.str, ref_table_name.str); my_message(error, err_msg, MYF(0)); DBUG_RETURN(false); @@ -3537,7 +3769,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table, error = ER_CANT_CREATE_TABLE; char err_msg[MRN_BUFFER_SIZE]; sprintf(err_msg, - "refference table [%s.%s] primary key is multiple column", + "reference table [%s.%s] primary key is multiple column", table->s->db.str, ref_table_name.str); my_message(error, err_msg, MYF(0)); DBUG_RETURN(false); @@ -3551,7 +3783,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table, error = ER_CANT_CREATE_TABLE; char err_msg[MRN_BUFFER_SIZE]; sprintf(err_msg, - "refference column [%s.%s.%s] is not used for primary key", + "reference column [%s.%s.%s] is not used for primary key", table->s->db.str, ref_table_name.str, ref_field_name.str); my_message(error, err_msg, MYF(0)); DBUG_RETURN(false); @@ -3727,11 +3959,14 @@ int ha_mroonga::storage_create_index_table(TABLE *table, grn_obj *normalizer = NULL; Field *field = &(key_info->key_part->field[0]); if (key_info->flags & HA_FULLTEXT) { - if (should_normalize(field)) { + if (have_custom_normalizer(key_info) || + should_normalize(field)) { normalizer = find_normalizer(key_info); } } else if (key_alg != HA_KEY_ALG_HASH) { - if (!is_multiple_column_index && should_normalize(field)) { + if (!is_multiple_column_index && + (have_custom_normalizer(key_info) || + should_normalize(field))) { normalizer = find_normalizer(key_info); } } @@ -3754,19 +3989,48 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, { MRN_DBUG_ENTER_METHOD(); int error = 0; - grn_obj *index_table, *index_column; - const char *column_name = NULL; - int column_name_size = 0; + grn_obj *index_column; bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; if (!is_multiple_column_index) { Field *field = key_info->key_part[0].field; - column_name = field->field_name.str; - column_name_size = field->field_name.length; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (strcmp(MRN_COLUMN_NAME_ID, field->field_name.str) == 0) { // skipping _id virtual column DBUG_RETURN(0); } + + if (is_foreign_key_field(table->s->table_name.str, + field->field_name.str)) { + DBUG_RETURN(0); + } + +#ifdef HA_CAN_VIRTUAL_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: storage: failed to create index: " + ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR, + field->field_name.str); + error = ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + } else { + int j, n_key_parts = KEY_N_KEY_PARTS(key_info); + for (j = 0; j < n_key_parts; j++) { + Field *field = key_info->key_part[j].field; + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: storage: failed to create index: " + ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR, + field->field_name.str); + error = ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + } +#endif } error = mrn_change_encoding(ctx, system_charset_info); @@ -3779,16 +4043,21 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, if (error) DBUG_RETURN(error); - grn_obj_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + grn_obj *index_table = index_tables[i]; + + grn_column_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; if (!find_index_column_flags(key_info, &index_column_flags)) { - index_column_flags |= GRN_OBJ_WITH_POSITION; - if (is_multiple_column_index) { + grn_obj *tokenizer = grn_obj_get_info(ctx, index_table, + GRN_INFO_DEFAULT_TOKENIZER, NULL); + if (tokenizer) { + index_column_flags |= GRN_OBJ_WITH_POSITION; + } + if (is_multiple_column_index && (key_info->flags & HA_FULLTEXT)) { index_column_flags |= GRN_OBJ_WITH_SECTION; } } - index_table = index_tables[i]; const char *index_column_name; if (tmp_share->index_table && tmp_share->index_table[i]) { index_column_name = key_info->name.str; @@ -3819,10 +4088,11 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, int j, n_key_parts = KEY_N_KEY_PARTS(key_info); for (j = 0; j < n_key_parts; j++) { Field *field = key_info->key_part[j].field; - const char *column_name = field->field_name.str; - int column_name_size = field->field_name.length; - grn_obj *source_column = grn_obj_column(ctx, grn_table, - column_name, column_name_size); + mrn::ColumnName column_name(field->field_name); + grn_obj *source_column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); grn_id source_id = grn_obj_id(ctx, source_column); GRN_UINT32_PUT(ctx, &source_ids, source_id); grn_obj_unlink(ctx, source_column); @@ -3832,8 +4102,13 @@ int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, grn_obj_unlink(ctx, &source_ids); } } else { + Field *field = key_info->key_part[0].field; + mrn::ColumnName column_name(field->field_name); grn_obj *column; - column = grn_obj_column(ctx, grn_table, column_name, column_name_size); + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); if (column) { grn_obj source_ids; grn_id source_id = grn_obj_id(ctx, column); @@ -3893,18 +4168,31 @@ int ha_mroonga::storage_create_indexes(TABLE *table, const char *grn_table_name, DBUG_RETURN(error); } -int ha_mroonga::ensure_database_open(const char *name) +int ha_mroonga::ensure_database_open(const char *name, mrn::Database **db) { int error; MRN_DBUG_ENTER_METHOD(); - grn_obj *db; - error = mrn_db_manager->open(name, &db); + if (db) + *db = NULL; + + mrn::Database *local_db; + error = mrn_db_manager->open(name, &local_db); if (error) DBUG_RETURN(error); - grn_ctx_use(ctx, db); + if (db) + *db = local_db; + grn_ctx_use(ctx, local_db->get()); + + delete operations_; + operations_ = new mrn::Operations(ctx); + if (mrn_enable_operations_recording) { + operations_->enable_recording(); + } else { + operations_->disable_recording(); + } DBUG_RETURN(error); } @@ -3919,6 +4207,9 @@ int ha_mroonga::ensure_database_remove(const char *name) if (error) DBUG_RETURN(error); + delete operations_; + operations_ = NULL; + mrn_db_manager->close(name); mrn::PathMapper mapper(name); @@ -3928,7 +4219,14 @@ int ha_mroonga::ensure_database_remove(const char *name) } -int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info) +int ha_mroonga::create(const char *name, + TABLE *table, + HA_CREATE_INFO *info +#ifdef MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION + , + dd::Table *table_def +#endif + ) { int error = 0; MRN_SHARE *tmp_share; @@ -3960,26 +4258,17 @@ int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info) DBUG_RETURN(error); } -int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) +int ha_mroonga::wrapper_open(const char *name, int mode, uint open_options) { int error = 0; MRN_DBUG_ENTER_METHOD(); - if (thd_sql_command(ha_thd()) == SQLCOM_REPAIR) { - error = ensure_database_remove(name); - if (error) - DBUG_RETURN(error); - error = ensure_database_open(name); - if (error) - DBUG_RETURN(error); - grn_table = NULL; - grn_index_tables = NULL; - grn_index_columns = NULL; - } else { - error = ensure_database_open(name); - if (error) - DBUG_RETURN(error); + mrn::Database *db = NULL; + error = ensure_database_open(name, &db); + if (error) + DBUG_RETURN(error); + if (!(open_options & HA_OPEN_FOR_REPAIR)) { error = open_table(name); if (error) DBUG_RETURN(error); @@ -4018,7 +4307,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) #ifdef MRN_HANDLER_HAVE_SET_HA_SHARE_REF wrap_handler->set_ha_share_ref(&table->s->ha_share); #endif - error = wrap_handler->ha_open(table, name, mode, test_if_locked); + error = wrap_handler->ha_open(table, name, mode, open_options); } else { if (!(wrap_handler = parent_for_clone->wrap_handler->clone(name, mem_root_for_clone))) @@ -4045,6 +4334,39 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) pk_keypart_map = make_prev_keypart_map( KEY_N_KEY_PARTS(&(table->key_info[table_share->primary_key]))); + if (!error) { + if (open_options & HA_OPEN_FOR_REPAIR) { + // TODO: How to check whether is DISABLE KEYS used or not? + error = wrapper_recreate_indexes(ha_thd()); + } else if (db) { + mrn::Lock lock(&mrn_operations_mutex); + mrn::PathMapper mapper(name); + const char *table_name = mapper.table_name(); + size_t table_name_size = strlen(table_name); + if (db->is_broken_table(table_name, table_name_size)) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is started: <%s>", + name); + error = operations_->clear(table_name, table_name_size); + if (!error) { + db->mark_table_repaired(table_name, table_name_size); + if (!share->disable_keys) { + // TODO: implemented by "reindex" instead of "remove and recreate". + // Because "remove and recreate" invalidates opened indexes by + // other threads. + error = wrapper_disable_indexes_mroonga(HA_KEY_SWITCH_ALL); + if (!error) { + error = wrapper_enable_indexes_mroonga(HA_KEY_SWITCH_ALL); + } + } + } + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is done: <%s>: %s", + name, error == 0 ? "success" : "failure"); + } + } + } + if (error) { grn_obj_unlink(ctx, grn_table); @@ -4104,6 +4426,11 @@ int ha_mroonga::wrapper_open_indexes(const char *name) grn_index_tables[i] = grn_ctx_get(ctx, index_table_name.c_str(), index_table_name.length()); + if (ctx->rc == GRN_SUCCESS && !grn_index_tables[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } if (ctx->rc) { DBUG_PRINT("info", ("mroonga: sql_command=%u", thd_sql_command(ha_thd()))); @@ -4166,8 +4493,16 @@ void ha_mroonga::wrapper_overwrite_index_bits() { Field *field = table_share->field[i]; field->part_of_key.clear_all(); +#ifdef MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED field->part_of_key_not_clustered.clear_all(); +#endif field->part_of_sortkey.clear_all(); + /* + TODO: We may need to update field->part_of_key_not_extended for + MySQL >= 5.7.18. If users report "raw InnoDB can use index for + this case but Mroonga wrapper mode for InnoDB can't use index + for the same case", we'll reconsider it again. + */ } for (i = 0; i < table_share->keys; i++) { KEY *key_info = &table->s->key_info[i]; @@ -4182,7 +4517,9 @@ void ha_mroonga::wrapper_overwrite_index_bits() { table_share->keys_for_keyread.set_bit(i); field->part_of_key.set_bit(i); +#ifdef MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED field->part_of_key_not_clustered.set_bit(i); +#endif } if (index_flags(i, j, 1) & HA_READ_ORDER) field->part_of_sortkey.set_bit(i); @@ -4201,12 +4538,93 @@ void ha_mroonga::wrapper_overwrite_index_bits() DBUG_VOID_RETURN; } -int ha_mroonga::storage_open(const char *name, int mode, uint test_if_locked) +int ha_mroonga::storage_reindex() { int error = 0; MRN_DBUG_ENTER_METHOD(); - error = ensure_database_open(name); + uint n_keys = table_share->keys; + KEY *key_info = table->key_info; + + bool have_multiple_column_index = false; + bitmap_clear_all(table->read_set); + for (uint i = 0; i < n_keys; ++i) { + if (!grn_index_columns[i]) + continue; + + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY); + grn_table_columns(ctx, grn_index_tables[i], NULL, 0, + reinterpret_cast(columns)); + unsigned int n_columns = + grn_table_size(ctx, reinterpret_cast(columns)); + grn_hash_close(ctx, columns); + + bool is_multiple_column_index = + (KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT)); + + if (n_columns == 1 || is_multiple_column_index) { + grn_table_truncate(ctx, grn_index_tables[i]); + if (ctx->rc != GRN_SUCCESS) { + error = ER_ERROR_ON_WRITE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + char index_table_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_table_name_size; + index_table_name_size = + grn_obj_name(ctx, grn_index_tables[i], + index_table_name, GRN_TABLE_MAX_KEY_SIZE); + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: reindex: failed to truncate index table: " + "<%.*s>: <%s>(%d)", + index_table_name_size, index_table_name, + ctx->errbuf, ctx->rc); + my_message(error, error_message, MYF(0)); + break; + } + } + + if (is_multiple_column_index) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } else { + grn_obj_reindex(ctx, grn_index_columns[i]); + if (ctx->rc != GRN_SUCCESS) { + error = ER_ERROR_ON_WRITE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + char index_column_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_column_name_size; + index_column_name_size = + grn_obj_name(ctx, grn_index_columns[i], + index_column_name, GRN_TABLE_MAX_KEY_SIZE); + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: reindex: failed to reindex: " + "<%.*s>: <%s>(%d)", + index_column_name_size, index_column_name, + ctx->errbuf, ctx->rc); + my_message(error, error_message, MYF(0)); + break; + } + } + } + + if (!error && have_multiple_column_index) + error = storage_add_index_multiple_columns(key_info, n_keys, + grn_index_tables, + grn_index_columns, + false); + bitmap_set_all(table->read_set); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_open(const char *name, int mode, uint open_options) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + mrn::Database *db; + error = ensure_database_open(name, &db); if (error) DBUG_RETURN(error); @@ -4221,19 +4639,38 @@ int ha_mroonga::storage_open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(error); } - if (!(ha_thd()->open_options & HA_OPEN_FOR_REPAIR)) { + if (!(open_options & HA_OPEN_FOR_REPAIR)) { error = storage_open_indexes(name); if (error) { + storage_close_columns(); grn_obj_unlink(ctx, grn_table); grn_table = NULL; - // TODO: unlink elements - free(grn_columns); - // TODO: unlink elements - free(grn_column_ranges); DBUG_RETURN(error); } storage_set_keys_in_use(); + + { + mrn::Lock lock(&mrn_operations_mutex); + mrn::PathMapper mapper(name); + const char *table_name = mapper.table_name(); + size_t table_name_size = strlen(table_name); + if (db->is_broken_table(table_name, table_name_size)) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is started: <%s>", + name); + error = operations_->repair(table_name, table_name_size); + if (!error) + db->mark_table_repaired(table_name, table_name_size); + if (!share->disable_keys) { + if (!error) + error = storage_reindex(); + } + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is done: <%s>: %s", + name, error == 0 ? "success" : "failure"); + } + } } ref_length = sizeof(grn_id); @@ -4300,18 +4737,26 @@ int ha_mroonga::storage_open_columns(void) for (int i = 0; i < n_columns; i++) { Field *field = table->field[i]; - const char *column_name = field->field_name.str; - int column_name_size = field->field_name.length; + mrn::ColumnName column_name(field->field_name); if (table_share->blob_fields) { blob_buffers[i].set_charset(field->charset()); } - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (strcmp(MRN_COLUMN_NAME_ID, column_name.mysql_name()) == 0) { continue; } +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + grn_columns[i] = NULL; + grn_column_ranges[i] = NULL; + continue; + } +#endif - grn_columns[i] = grn_obj_column(ctx, grn_table, - column_name, column_name_size); + grn_columns[i] = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); if (!grn_columns[i]) { error = ER_CANT_OPEN_FILE; my_message(error, ctx->errbuf, MYF(0)); @@ -4328,27 +4773,33 @@ int ha_mroonga::storage_open_columns(void) } if (error != 0) { - for (int i = 0; i < n_columns; i++) { - grn_obj *column = grn_columns[i]; - if (column) { - grn_obj_unlink(ctx, column); - } - - grn_obj *range = grn_column_ranges[i]; - if (range) { - grn_obj_unlink(ctx, range); - } - } - - free(grn_columns); - grn_columns = NULL; - free(grn_column_ranges); - grn_column_ranges = NULL; + storage_close_columns(); } DBUG_RETURN(error); } +void ha_mroonga::storage_close_columns(void) +{ + int n_columns = table->s->fields; + for (int i = 0; i < n_columns; i++) { + grn_obj *column = grn_columns[i]; + if (column) { + grn_obj_unlink(ctx, column); + } + + grn_obj *range = grn_column_ranges[i]; + if (range) { + grn_obj_unlink(ctx, range); + } + } + + free(grn_columns); + grn_columns = NULL; + free(grn_column_ranges); + grn_column_ranges = NULL; +} + int ha_mroonga::storage_open_indexes(const char *name) { int error; @@ -4407,6 +4858,11 @@ int ha_mroonga::storage_open_indexes(const char *name) grn_index_tables[i] = grn_ctx_get(ctx, index_table_name.c_str(), index_table_name.length()); + if (ctx->rc == GRN_SUCCESS && !grn_index_tables[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } if (ctx->rc == GRN_SUCCESS) { grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], @@ -4465,7 +4921,14 @@ error: DBUG_RETURN(error); } -int ha_mroonga::open(const char *name, int mode, uint test_if_locked) +int ha_mroonga::open(const char *name, + int mode, + uint open_options +#ifdef MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION + , + const dd::Table *table_def +#endif + ) { int error = 0; MRN_DBUG_ENTER_METHOD(); @@ -4483,9 +4946,9 @@ int ha_mroonga::open(const char *name, int mode, uint test_if_locked) if (share->wrapper_mode) { - error = wrapper_open(name, mode, test_if_locked); + error = wrapper_open(name, mode, open_options); } else { - error = storage_open(name, mode, test_if_locked); + error = storage_open(name, mode, open_options); } if (error) @@ -4553,7 +5016,10 @@ int ha_mroonga::close() DBUG_RETURN(error); } - error = add_wrap_hton(share->table_name, share->hton); + if (thd) + { + error = add_wrap_hton(share->table_name, share->hton); + } bitmap_free(&multiple_column_key_bitmap); if (share->use_count == 1) { mrn_free_long_term_share(share->long_term_share); @@ -4612,7 +5078,7 @@ int ha_mroonga::generic_delete_table(const char *name, const char *table_name) error = drop_indexes(table_name); grn_obj *table_obj = grn_ctx_get(ctx, table_name, strlen(table_name)); - if (!ctx->rc) { + if (table_obj) { grn_obj_remove(ctx, table_obj); } if (ctx->rc) { @@ -4655,6 +5121,46 @@ int ha_mroonga::delete_table(const char *name) } } + if (!wrap_handlerton) { + bool open_table_to_get_wrap_handlerton = true; + if (mapper.is_internal_table_name()) { + open_table_to_get_wrap_handlerton = false; + } + if (open_table_to_get_wrap_handlerton) { + TABLE_LIST table_list; + table_list.init_one_table(mapper.db_name(), strlen(mapper.db_name()), + mapper.mysql_table_name(), + strlen(mapper.mysql_table_name()), + mapper.mysql_table_name(), + TL_WRITE); + mrn_open_mutex_lock(NULL); + TABLE_SHARE *tmp_table_share = + mrn_create_tmp_table_share(&table_list, name, &error); + error = 0; + mrn_open_mutex_unlock(NULL); + if (tmp_table_share) { + TABLE tmp_table; + tmp_table.s = tmp_table_share; +#ifdef WITH_PARTITION_STORAGE_ENGINE + tmp_table.part_info = NULL; +#endif + MRN_SHARE *tmp_share = mrn_get_share(name, &tmp_table, &error); + if (tmp_share) { + wrap_handlerton = tmp_share->hton; + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + mrn_free_share(tmp_share); + } + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + if (error) { + DBUG_RETURN(error); + } + } + } + } + if (wrap_handlerton) { error = wrapper_delete_table(name, wrap_handlerton, mapper.table_name()); @@ -4665,8 +5171,8 @@ int ha_mroonga::delete_table(const char *name) error = generic_delete_table(name, mapper.table_name()); } - if (!error && is_temporary_table_name(name)) { - mrn_db_manager->drop(name); + if (!error) { + error = operations_->clear(name, strlen(name)); } DBUG_RETURN(error); @@ -5039,6 +5545,70 @@ int ha_mroonga::rnd_end() DBUG_RETURN(error); } +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR +int ha_mroonga::wrapper_records(ha_rows *num_rows) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_records(num_rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_records(ha_rows *num_rows) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::records(num_rows); + DBUG_RETURN(error); +} + +int ha_mroonga::records(ha_rows *num_rows) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) { + error = wrapper_records(num_rows); + } else { + error = storage_records(num_rows); + } + DBUG_RETURN(error); +} +#else +ha_rows ha_mroonga::wrapper_records() +{ + ha_rows num_rows; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + num_rows = wrap_handler->records(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(num_rows); +} + +ha_rows ha_mroonga::storage_records() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows num_rows = handler::records(); + DBUG_RETURN(num_rows); +} + +ha_rows ha_mroonga::records() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows num_rows; + if (share->wrapper_mode) { + num_rows = wrapper_records(); + } else { + num_rows = storage_records(); + } + DBUG_RETURN(num_rows); +} +#endif + int ha_mroonga::wrapper_rnd_next(uchar *buf) { int error = 0; @@ -5280,7 +5850,15 @@ int ha_mroonga::wrapper_write_row(uchar *buf) { int error = 0; THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + + mrn::Operation operation(operations_, + "write", + table->s->table_name.str, + table->s->table_name.length); + + operation.record_target(record_id); MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); tmp_disable_binlog(thd); @@ -5395,6 +5973,11 @@ int ha_mroonga::storage_write_row(uchar *buf) DBUG_RETURN(error); } + mrn::Operation operation(operations_, + "write", + table->s->table_name.str, + table->s->table_name.length); + THD *thd = ha_thd(); int i; int n_columns = table->s->fields; @@ -5408,11 +5991,17 @@ int ha_mroonga::storage_write_row(uchar *buf) mrn::DebugColumnAccess debug_column_access(table, table->read_set); for (i = 0; i < n_columns; i++) { Field *field = table->field[i]; - const char *column_name = field->field_name.str; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif if (field->is_null()) continue; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { push_warning_printf(thd, MRN_SEVERITY_WARNING, WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED), @@ -5496,17 +6085,25 @@ int ha_mroonga::storage_write_row(uchar *buf) } DBUG_RETURN(error); } + operation.record_target(record_id); } grn_obj colbuf; GRN_VOID_INIT(&colbuf); for (i = 0; i < n_columns; i++) { Field *field = table->field[i]; - const char *column_name = field->field_name.str; if (field->is_null()) continue; +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + mrn::ColumnName column_name(field->field_name); + #ifdef MRN_HAVE_SPATIAL bool is_null_geometry_value = field->real_type() == MYSQL_TYPE_GEOMETRY && @@ -5516,39 +6113,63 @@ int ha_mroonga::storage_write_row(uchar *buf) } #endif - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { continue; } error = mrn_change_encoding(ctx, field->charset()); if (error) { - grn_obj_unlink(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &colbuf); goto err; } error = generic_store_bulk(field, &colbuf); if (error) { - grn_obj_unlink(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &colbuf); goto err; } - if (added && is_grn_zero_column_value(grn_columns[i], &colbuf)) { - // WORKAROUND: groonga can't index newly added '0' value for - // fix size column. So we add non-'0' value first then add - // real '0' value again. It will be removed when groonga - // supports 'null' value. - char *bytes = GRN_BULK_HEAD(&colbuf); - bytes[0] = '\1'; - grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); - bytes[0] = '\0'; + + grn_obj *column = grn_columns[i]; + if (is_foreign_key_field(table->s->table_name.str, field->field_name.str)) { + grn_obj value; + GRN_RECORD_INIT(&value, 0, grn_obj_get_range(ctx, column)); + grn_rc cast_rc = grn_obj_cast(ctx, &colbuf, &value, GRN_FALSE); + if (cast_rc != GRN_SUCCESS) { + grn_obj inspected; + GRN_TEXT_INIT(&inspected, 0); + grn_inspect(ctx, &inspected, &colbuf); + error = HA_ERR_NO_REFERENCED_ROW; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "foreign record doesn't exist: <%s>:<%.*s>", + field->field_name.str, + static_cast(GRN_TEXT_LEN(&inspected)), + GRN_TEXT_VALUE(&inspected)); + GRN_OBJ_FIN(ctx, &value); + GRN_OBJ_FIN(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &inspected); + goto err; + } + grn_obj_set_value(ctx, column, record_id, &value, GRN_OBJ_SET); + } else { + if (added && is_grn_zero_column_value(column, &colbuf)) { + // WORKAROUND: groonga can't index newly added '0' value for + // fix size column. So we add non-'0' value first then add + // real '0' value again. It will be removed when groonga + // supports 'null' value. + char *bytes = GRN_BULK_HEAD(&colbuf); + bytes[0] = '\1'; + grn_obj_set_value(ctx, column, record_id, &colbuf, GRN_OBJ_SET); + bytes[0] = '\0'; + } + grn_obj_set_value(ctx, column, record_id, &colbuf, GRN_OBJ_SET); } - grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); if (ctx->rc) { - grn_obj_unlink(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &colbuf); my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); error = ER_ERROR_ON_WRITE; goto err; } } - grn_obj_unlink(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &colbuf); error = storage_write_row_multiple_column_indexes(buf, record_id); if (error) { @@ -5870,6 +6491,12 @@ int ha_mroonga::wrapper_update_row(const uchar *old_data, int error = 0; THD *thd = ha_thd(); + + mrn::Operation operation(operations_, + "update", + table->s->table_name.str, + table->s->table_name.length); + MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); tmp_disable_binlog(thd); @@ -6009,6 +6636,12 @@ int ha_mroonga::storage_update_row(const uchar *old_data, DBUG_RETURN(error); } + mrn::Operation operation(operations_, + "update", + table->s->table_name.str, + table->s->table_name.length); + operation.record_target(record_id); + grn_obj colbuf; int i; uint j; @@ -6017,11 +6650,22 @@ int ha_mroonga::storage_update_row(const uchar *old_data, for (i = 0; i < n_columns; i++) { Field *field = table->field[i]; - const char *column_name = field->field_name.str; - if (bitmap_is_set(table->write_set, field->field_index)) { - if (field->is_null()) continue; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + if (!bitmap_is_set(table->write_set, field->field_index)) + continue; + + if (field->is_null()) + continue; + + { + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { push_warning_printf(thd, MRN_SEVERITY_WARNING, WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED), MRN_COLUMN_NAME_ID, @@ -6031,6 +6675,38 @@ int ha_mroonga::storage_update_row(const uchar *old_data, } } } + + if (!is_foreign_key_field(table->s->table_name.str, field->field_name.str)) + continue; + + { + grn_obj *column = grn_columns[i]; + grn_obj new_value; + GRN_VOID_INIT(&new_value); + { + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + generic_store_bulk(field, &new_value); + } + grn_obj casted_value; + GRN_RECORD_INIT(&casted_value, 0, grn_obj_get_range(ctx, column)); + grn_rc cast_rc = grn_obj_cast(ctx, &new_value, &casted_value, GRN_FALSE); + GRN_OBJ_FIN(ctx, &casted_value); + if (cast_rc != GRN_SUCCESS) { + grn_obj inspected; + GRN_TEXT_INIT(&inspected, 0); + grn_inspect(ctx, &inspected, &new_value); + GRN_OBJ_FIN(ctx, &new_value); + error = HA_ERR_NO_REFERENCED_ROW; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "foreign record doesn't exist: <%s>:<%.*s>", + field->field_name.str, + static_cast(GRN_TEXT_LEN(&inspected)), + GRN_TEXT_VALUE(&inspected)); + GRN_OBJ_FIN(ctx, &inspected); + DBUG_RETURN(error); + } + GRN_OBJ_FIN(ctx, &new_value); + } } KEY *pkey_info = NULL; @@ -6054,14 +6730,21 @@ int ha_mroonga::storage_update_row(const uchar *old_data, GRN_VOID_INIT(&colbuf); for (i = 0; i < n_columns; i++) { Field *field = table->field[i]; - const char *column_name = field->field_name.str; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + if (bitmap_is_set(table->write_set, field->field_index)) { mrn::DebugColumnAccess debug_column_access(table, table->read_set); DBUG_PRINT("info", ("mroonga: update column %d(%d)",i,field->field_index)); if (field->is_null()) continue; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { continue; } @@ -6069,30 +6752,43 @@ int ha_mroonga::storage_update_row(const uchar *old_data, if (error) goto err; + bool is_pkey = false; bool on_duplicate_key_update = (inserting_with_update && ignoring_duplicated_key); - if (!on_duplicate_key_update && pkey_info) { - bool have_pkey = false; + if (pkey_info && !on_duplicate_key_update) { for (j = 0; j < KEY_N_KEY_PARTS(pkey_info); j++) { Field *pkey_field = pkey_info->key_part[j].field; - if (strcmp(pkey_field->field_name.str, column_name) == 0) { - if (!replacing_) { - char message[MRN_BUFFER_SIZE]; - snprintf(message, MRN_BUFFER_SIZE, - "data truncated for primary key column: <%s>", - column_name); - push_warning(thd, MRN_SEVERITY_WARNING, - WARN_DATA_TRUNCATED, message); - } - have_pkey = true; + if (strcmp(pkey_field->field_name.str, column_name.c_str()) == 0) { + is_pkey = true; + break; } } - if (have_pkey) { - continue; - } } generic_store_bulk(field, &colbuf); + if (is_pkey) { + bool is_multiple_column_index = KEY_N_KEY_PARTS(pkey_info) > 1; + bool is_same_value; + if (is_multiple_column_index) { + is_same_value = false; + } else { + grn_id found_record_id = grn_table_get(ctx, + grn_table, + GRN_BULK_HEAD(&colbuf), + GRN_BULK_VSIZE(&colbuf)); + is_same_value = (record_id == found_record_id); + } + if (!is_same_value && !replacing_) { + char message[MRN_BUFFER_SIZE]; + snprintf(message, MRN_BUFFER_SIZE, + "data truncated for primary key column: <%s>", + column_name.c_str()); + push_warning(thd, MRN_SEVERITY_WARNING, + WARN_DATA_TRUNCATED, message); + } + continue; + } + grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); if (ctx->rc) { grn_obj_unlink(ctx, &colbuf); @@ -6351,6 +7047,12 @@ int ha_mroonga::wrapper_delete_row(const uchar *buf) int error = 0; THD *thd= ha_thd(); + + mrn::Operation operation(operations_, + "delete", + table->s->table_name.str, + table->s->table_name.length); + MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); tmp_disable_binlog(thd); @@ -6440,6 +7142,69 @@ int ha_mroonga::storage_delete_row(const uchar *buf) DBUG_RETURN(0); } + mrn::Operation operation(operations_, + "delete", + table->s->table_name.str, + table->s->table_name.length); + operation.record_target(record_id); + + { + grn_id referencing_child_table_id = GRN_ID_NIL; + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY|GRN_HASH_TINY); + grn_table_columns(ctx, grn_table, "", 0, + reinterpret_cast(columns)); + GRN_HASH_EACH_BEGIN(ctx, columns, cursor, id) { + void *key; + grn_hash_cursor_get_key(ctx, cursor, &key); + grn_id column_id = *static_cast(key); + grn_obj *column = grn_ctx_at(ctx, column_id); + if (!column) + continue; + + if (column->header.type != GRN_COLUMN_INDEX) + continue; + + grn_ii_cursor *ii_cursor = + grn_ii_cursor_open(ctx, + reinterpret_cast(column), + record_id, + GRN_ID_NIL, + GRN_ID_MAX, + 0, + 0); + if (!ii_cursor) + continue; + + if (grn_ii_cursor_next(ctx, ii_cursor)) { + referencing_child_table_id = grn_obj_get_range(ctx, column); + } + + grn_ii_cursor_close(ctx, ii_cursor); + + if (referencing_child_table_id != GRN_ID_NIL) + break; + } GRN_HASH_EACH_END(ctx, cursor); + grn_hash_close(ctx, columns); + + if (referencing_child_table_id != GRN_ID_NIL) { + grn_obj *referencing_child_table = + grn_ctx_at(ctx, referencing_child_table_id); + char name[GRN_TABLE_MAX_KEY_SIZE]; + int name_size; + name_size = grn_obj_name(ctx, + referencing_child_table, + name, + GRN_TABLE_MAX_KEY_SIZE); + error = HA_ERR_ROW_IS_REFERENCED; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "one or more child rows exist in <%.*s>", + name_size, + name); + DBUG_RETURN(error); + } + } + storage_store_fields_for_prep_update(buf, NULL, record_id); { mrn::Lock lock(&(share->record_mutex), have_unique_index()); @@ -6810,6 +7575,13 @@ ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min, grn_ii *ii = reinterpret_cast(index_column); row_count = grn_ii_estimate_size_for_lexicon_cursor(ctx, ii, cursor); grn_table_cursor_close(ctx, cursor); + + unsigned int max_n_lexicon_records = + grn_table_size(ctx, grn_index_tables[key_nr]); + if (cursor_limit >= 0 && + static_cast(cursor_limit) < max_n_lexicon_records) { + row_count++; + } } DBUG_RETURN(row_count); } @@ -6971,7 +7743,7 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, enum ha_rkey_function find_flag) { MRN_DBUG_ENTER_METHOD(); - check_count_skip(keypart_map, 0, false); + check_count_skip(keypart_map); int error = 0; @@ -6987,6 +7759,29 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, clear_cursor_geo(); clear_empty_value_records(); + switch (find_flag) { + case HA_READ_BEFORE_KEY: + flags |= GRN_CURSOR_LT | GRN_CURSOR_DESCENDING; + break; + case HA_READ_PREFIX_LAST: + flags |= GRN_CURSOR_PREFIX | GRN_CURSOR_DESCENDING; + break; + case HA_READ_PREFIX_LAST_OR_PREV: + flags |= GRN_CURSOR_LE | GRN_CURSOR_DESCENDING; + break; + case HA_READ_AFTER_KEY: + flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_OR_NEXT: + flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_EXACT: + flags |= GRN_CURSOR_LE | GRN_CURSOR_GE; + break; + default: + break; + } + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; if (is_multiple_column_index) { mrn_change_encoding(ctx, NULL); @@ -6998,13 +7793,21 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, "multiple column index key length=<%u>", key_length, key_info->key_length)); if (key_length == key_info->key_length) { - if (find_flag == HA_READ_BEFORE_KEY || - find_flag == HA_READ_PREFIX_LAST_OR_PREV) { + switch (find_flag) { + case HA_READ_BEFORE_KEY: + case HA_READ_PREFIX_LAST_OR_PREV: key_max = key_max_entity; storage_encode_multiple_column_key(key_info, key, key_length, key_max, &size_max); - } else { + break; + case HA_READ_PREFIX_LAST: + key_min = key_min_entity; + storage_encode_multiple_column_key(key_info, + key, key_length, + key_min, &size_min); + break; + default: key_min = key_min_entity; storage_encode_multiple_column_key(key_info, key, key_length, @@ -7013,13 +7816,102 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, key_max = key_min; size_max = size_min; } + break; } } else { - flags |= GRN_CURSOR_PREFIX; - key_min = key_min_entity; - storage_encode_multiple_column_key(key_info, - key, key_length, - key_min, &size_min); + const uchar *prev_key = NULL; + uint prev_key_length = 0; + if ((keypart_map >> 1) > 0) { + prev_key = key; + prev_key_length = + mrn_calculate_key_len(table, active_index, key, keypart_map >> 1); + } + switch (find_flag) { + case HA_READ_BEFORE_KEY: + if (prev_key) { + flags |= GRN_CURSOR_GE; + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + prev_key, prev_key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + } + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + NULL, 0, + key_max, &size_max, + NULL, NULL); + break; + case HA_READ_PREFIX_LAST: + key_min = key_min_entity; + storage_encode_multiple_column_key(key_info, + key, key_length, + key_min, &size_min); + break; + case HA_READ_PREFIX_LAST_OR_PREV: + if (prev_key) { + flags |= GRN_CURSOR_GE; + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + prev_key, prev_key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + } + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + key, key_length, + NULL, NULL, + key_max, &size_max); + break; + case HA_READ_AFTER_KEY: + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + key, key_length, + NULL, NULL, + key_min, &size_min); + if (prev_key) { + flags |= GRN_CURSOR_LE; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + prev_key, prev_key_length, + NULL, NULL, + key_max, &size_max); + } + break; + case HA_READ_KEY_OR_NEXT: + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + if (prev_key) { + flags |= GRN_CURSOR_LE; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + prev_key, prev_key_length, + NULL, NULL, + key_max, &size_max); + } + break; + case HA_READ_KEY_EXACT: + key_min = key_min_entity; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + key, key_length, + key_min, &size_min, + key_max, &size_max); + default: + break; + } } } else if (mrn_is_geo_key(key_info)) { error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); @@ -7066,23 +7958,6 @@ int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, } } - switch (find_flag) { - case HA_READ_BEFORE_KEY: - flags |= GRN_CURSOR_LT | GRN_CURSOR_DESCENDING; - break; - case HA_READ_PREFIX_LAST_OR_PREV: - flags |= GRN_CURSOR_LE | GRN_CURSOR_DESCENDING; - break; - case HA_READ_AFTER_KEY: - flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; - break; - case HA_READ_KEY_OR_NEXT: - flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; - break; - default: - break; - } - uint pkey_nr = table->s->primary_key; if (key_nr == pkey_nr) { DBUG_PRINT("info", ("mroonga: use primary key")); @@ -7520,222 +8395,6 @@ int ha_mroonga::index_next_same(uchar *buf, const uchar *key, uint keylen) DBUG_RETURN(error); } -int ha_mroonga::wrapper_read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted) -{ - int error = 0; - MRN_DBUG_ENTER_METHOD(); - KEY *key_info = &(table->key_info[active_index]); - if (mrn_is_geo_key(key_info)) { - clear_cursor_geo(); - error = generic_geo_open_cursor(start_key->key, start_key->flag); - if (!error) { - error = wrapper_get_next_geo_record(table->record[0]); - } - DBUG_RETURN(error); - } - MRN_SET_WRAP_SHARE_KEY(share, table->s); - MRN_SET_WRAP_TABLE_KEY(this, table); - if (fulltext_searching) - set_pk_bitmap(); - error = wrap_handler->read_range_first(start_key, end_key, eq_range, - sorted); - MRN_SET_BASE_SHARE_KEY(share, table->s); - MRN_SET_BASE_TABLE_KEY(this, table); - DBUG_RETURN(error); -} - -int ha_mroonga::storage_read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted) -{ - MRN_DBUG_ENTER_METHOD(); - check_count_skip(start_key ? start_key->keypart_map : 0, - end_key ? end_key->keypart_map : 0, false); - int flags = 0, error; - uint size_min = 0, size_max = 0; - uchar *key_min = NULL, *key_max = NULL; - uchar key_min_entity[MRN_MAX_KEY_SIZE]; - uchar key_max_entity[MRN_MAX_KEY_SIZE]; - KEY *key_info = &(table->s->key_info[active_index]); - - clear_cursor(); - - bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; - if (is_multiple_column_index) { - mrn_change_encoding(ctx, NULL); - if (start_key && end_key && - start_key->length == end_key->length && - memcmp(start_key->key, end_key->key, start_key->length) == 0) { - flags |= GRN_CURSOR_PREFIX; - key_min = key_min_entity; - storage_encode_multiple_column_key(key_info, - start_key->key, start_key->length, - key_min, &size_min); - } else { - key_min = key_min_entity; - key_max = key_max_entity; - storage_encode_multiple_column_key_range(key_info, - start_key, end_key, - key_min, &size_min, - key_max, &size_max); - if (size_min == 0) { - key_min = NULL; - } - if (size_max == 0) { - key_max = NULL; - } - } - } else { - Field *field = key_info->key_part[0].field; - const char *column_name = field->field_name.str; - error = mrn_change_encoding(ctx, field->charset()); - if (error) - DBUG_RETURN(error); - if (start_key) { - key_min = key_min_entity; - storage_encode_key(field, start_key->key, key_min_entity, - &size_min); - if (start_key->flag == HA_READ_KEY_EXACT) { - // for _id - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { - grn_id found_record_id = *((grn_id *)key_min); - if (grn_table_at(ctx, grn_table, found_record_id) != GRN_ID_NIL) { // found - storage_store_fields(table->record[0], found_record_id); - table->status = 0; - cursor = NULL; - record_id = found_record_id; - DBUG_RETURN(0); - } else { - table->status = STATUS_NOT_FOUND; - cursor = NULL; - record_id = GRN_ID_NIL; - DBUG_RETURN(HA_ERR_END_OF_FILE); - } - } - } - } - if (end_key) { - key_max = key_max_entity; - storage_encode_key(field, end_key->key, key_max, &size_max); - } - } - - if (start_key) { - switch (start_key->flag) { - case HA_READ_AFTER_KEY: - flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; - break; - case HA_READ_KEY_OR_NEXT: - flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; - break; - default: - break; - } - } - if (end_key) { - switch (end_key->flag) { - case HA_READ_BEFORE_KEY: - flags |= GRN_CURSOR_LT | GRN_CURSOR_ASCENDING; - break; - case HA_READ_AFTER_KEY: - flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; - break; - default: - break; - } - } - - uint pkey_nr = table->s->primary_key; - if (active_index == pkey_nr) { - DBUG_PRINT("info", ("mroonga: use primary key")); - cursor = grn_table_cursor_open(ctx, grn_table, - key_min, size_min, key_max, size_max, - 0, -1, flags); - } else { - if (is_multiple_column_index) { - DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); - } else { - DBUG_PRINT("info", ("mroonga: use key%u", active_index)); - } - index_table_cursor = grn_table_cursor_open(ctx, - grn_index_tables[active_index], - key_min, size_min, - key_max, size_max, - 0, -1, flags); - cursor = grn_index_cursor_open(ctx, index_table_cursor, - grn_index_columns[active_index], - 0, GRN_ID_MAX, 0); - } - if (ctx->rc) { - my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); - DBUG_RETURN(ER_ERROR_ON_READ); - } - error = storage_get_next_record(table->record[0]); - DBUG_RETURN(error); -} - -int ha_mroonga::read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted) -{ - MRN_DBUG_ENTER_METHOD(); - int error = 0; - if (share->wrapper_mode) - { - error = wrapper_read_range_first(start_key, end_key, eq_range, - sorted); - } else { - error = storage_read_range_first(start_key, end_key, eq_range, sorted); - } - DBUG_RETURN(error); -} - -int ha_mroonga::wrapper_read_range_next() -{ - int error = 0; - MRN_DBUG_ENTER_METHOD(); - KEY *key_info = &(table->key_info[active_index]); - if (mrn_is_geo_key(key_info)) { - error = wrapper_get_next_geo_record(table->record[0]); - DBUG_RETURN(error); - } - MRN_SET_WRAP_SHARE_KEY(share, table->s); - MRN_SET_WRAP_TABLE_KEY(this, table); - if (fulltext_searching) - set_pk_bitmap(); - error = wrap_handler->read_range_next(); - MRN_SET_BASE_SHARE_KEY(share, table->s); - MRN_SET_BASE_TABLE_KEY(this, table); - DBUG_RETURN(error); -} - -int ha_mroonga::storage_read_range_next() -{ - MRN_DBUG_ENTER_METHOD(); - - if (cursor == NULL) { - DBUG_RETURN(HA_ERR_END_OF_FILE); - } - int error = storage_get_next_record(count_skip ? NULL : table->record[0]); - - DBUG_RETURN(error); -} - -int ha_mroonga::read_range_next() -{ - MRN_DBUG_ENTER_METHOD(); - int error = 0; - if (share->wrapper_mode) - { - error = wrapper_read_range_next(); - } else { - error = storage_read_range_next(); - } - DBUG_RETURN(error); -} - int ha_mroonga::generic_ft_init() { MRN_DBUG_ENTER_METHOD(); @@ -7819,306 +8478,22 @@ void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit( DBUG_VOID_RETURN; } -bool ha_mroonga::generic_ft_init_ext_parse_pragma_d(struct st_mrn_ft_info *info, - const char *keyword, - uint keyword_length, - grn_operator *default_operator, - uint *consumed_keyword_length) -{ - MRN_DBUG_ENTER_METHOD(); - - grn_bool succeeded = true; - if (keyword_length >= 1 && keyword[0] == '+') { - *default_operator = GRN_OP_AND; - *consumed_keyword_length = 1; - } else if (keyword_length >= 1 && keyword[0] == '-') { - *default_operator = GRN_OP_AND_NOT; - *consumed_keyword_length = 1; - } else if (keyword_length >= 2 && memcmp(keyword, "OR", 2) == 0) { - *default_operator = GRN_OP_OR; - *consumed_keyword_length = 2; - } else { - succeeded = false; - } - - DBUG_RETURN(succeeded); -} - -void ha_mroonga::generic_ft_init_ext_parse_pragma_w_append_section( - struct st_mrn_ft_info *info, - grn_obj *index_column, - grn_obj *match_columns, - uint section, - grn_obj *section_value_buffer, - int weight, - uint n_weights) -{ - MRN_DBUG_ENTER_METHOD(); - - grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); - GRN_UINT32_SET(info->ctx, section_value_buffer, section); - grn_expr_append_const(info->ctx, match_columns, section_value_buffer, - GRN_OP_PUSH, 1); - grn_expr_append_op(info->ctx, match_columns, GRN_OP_GET_MEMBER, 2); - - if (weight != 1) { - grn_expr_append_const_int(info->ctx, match_columns, weight, - GRN_OP_PUSH, 1); - grn_expr_append_op(info->ctx, match_columns, GRN_OP_STAR, 2); - } - - if (n_weights >= 2) { - grn_expr_append_op(info->ctx, match_columns, GRN_OP_OR, 2); - } - - DBUG_VOID_RETURN; -} - -bool ha_mroonga::generic_ft_init_ext_parse_pragma_w(struct st_mrn_ft_info *info, - const char *keyword, - uint keyword_length, - grn_obj *index_column, - grn_obj *match_columns, - uint *consumed_keyword_length, - grn_obj *tmp_objects) -{ - MRN_DBUG_ENTER_METHOD(); - - *consumed_keyword_length = 0; - - uint n_sections = KEY_N_KEY_PARTS(info->key_info); - - grn_obj section_value_buffer; - GRN_UINT32_INIT(§ion_value_buffer, 0); - - MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(bool, specified_sections, n_sections); - for (uint i = 0; i < n_sections; ++i) { - specified_sections[i] = false; - } - - uint n_weights = 0; - while (keyword_length >= 1) { - if (n_weights >= 1) { - if (keyword[0] != ',') { - break; - } - uint n_used_keyword_length = 1; - *consumed_keyword_length += n_used_keyword_length; - keyword_length -= n_used_keyword_length; - keyword += n_used_keyword_length; - if (keyword_length == 0) { - break; - } - } - - uint section = 0; - if ('1' <= keyword[0] && keyword[0] <= '9') { - const char *section_start = keyword; - const char *keyword_end = keyword + keyword_length; - const char *keyword_rest; - section = grn_atoui(section_start, keyword_end, &keyword_rest); - if (section_start == keyword_rest) { - break; - } - if (!(0 < section && section <= n_sections)) { - break; - } - section -= 1; - specified_sections[section] = true; - uint n_used_keyword_length = keyword_rest - keyword; - *consumed_keyword_length += n_used_keyword_length; - keyword_length -= n_used_keyword_length; - keyword += n_used_keyword_length; - } else { - break; - } - - int weight = 1; - if (keyword_length >= 2 && keyword[0] == ':') { - const char *weight_start = keyword + 1; - const char *keyword_end = keyword + keyword_length; - const char *keyword_rest; - weight = grn_atoi(weight_start, keyword_end, &keyword_rest); - if (weight_start == keyword_rest) { - break; - } - uint n_used_keyword_length = keyword_rest - keyword; - *consumed_keyword_length += n_used_keyword_length; - keyword_length -= n_used_keyword_length; - keyword += n_used_keyword_length; - } - - n_weights++; - - generic_ft_init_ext_parse_pragma_w_append_section(info, - index_column, - match_columns, - section, - §ion_value_buffer, - weight, - n_weights); - } - - for (uint section = 0; section < n_sections; ++section) { - if (specified_sections[section]) { - continue; - } - - ++n_weights; - - int default_weight = 1; - generic_ft_init_ext_parse_pragma_w_append_section(info, - index_column, - match_columns, - section, - §ion_value_buffer, - default_weight, - n_weights); - } - MRN_FREE_VARIABLE_LENGTH_ARRAYS(specified_sections); - - GRN_OBJ_FIN(info->ctx, §ion_value_buffer); - - DBUG_RETURN(n_weights > 0); -} - -grn_expr_flags ha_mroonga::expr_flags_in_boolean_mode() -{ - MRN_DBUG_ENTER_METHOD(); - - ulonglong syntax_flags = MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT; -#ifdef MRN_SUPPORT_THDVAR_SET - syntax_flags = THDVAR(ha_thd(), boolean_mode_syntax_flags); -#endif - grn_expr_flags expression_flags = 0; - if (syntax_flags == MRN_BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT) { - expression_flags = GRN_EXPR_SYNTAX_QUERY | GRN_EXPR_ALLOW_LEADING_NOT; - } else { - if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT) { - expression_flags |= GRN_EXPR_SYNTAX_SCRIPT; - } else { - expression_flags |= GRN_EXPR_SYNTAX_QUERY; - } - if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN) { - expression_flags |= GRN_EXPR_ALLOW_COLUMN; - } - if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE) { - expression_flags |= GRN_EXPR_ALLOW_UPDATE; - } - if (syntax_flags & MRN_BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT) { - expression_flags |= GRN_EXPR_ALLOW_LEADING_NOT; - } - } - - DBUG_RETURN(expression_flags); -} - grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode( struct st_mrn_ft_info *info, String *key, grn_obj *index_column, grn_obj *match_columns, - grn_obj *expression, - grn_obj *tmp_objects) + grn_obj *expression) { MRN_DBUG_ENTER_METHOD(); - grn_rc rc = GRN_SUCCESS; - - const char *keyword, *keyword_original; - uint keyword_length, keyword_length_original; - grn_operator default_operator = GRN_OP_OR; - grn_bool weight_specified = false; - keyword = keyword_original = key->ptr(); - keyword_length = keyword_length_original = key->length(); - // WORKAROUND: support only "D" and "W" pragmas. - if (keyword_length >= 2 && keyword[0] == '*') { - bool parsed = false; - bool done = false; - keyword++; - keyword_length--; - while (!done) { - uint consumed_keyword_length = 0; - switch (keyword[0]) { - case 'D': - if (generic_ft_init_ext_parse_pragma_d(info, - keyword + 1, - keyword_length - 1, - &default_operator, - &consumed_keyword_length)) { - parsed = true; - consumed_keyword_length += 1; - keyword += consumed_keyword_length; - keyword_length -= consumed_keyword_length; - } else { - done = true; - } - break; - case 'W': - if (generic_ft_init_ext_parse_pragma_w(info, - keyword + 1, - keyword_length - 1, - index_column, - match_columns, - &consumed_keyword_length, - tmp_objects)) { - parsed = true; - weight_specified = true; - consumed_keyword_length += 1; - keyword += consumed_keyword_length; - keyword_length -= consumed_keyword_length; - } else { - done = true; - } - break; - default: - done = true; - break; - } - } - if (!parsed) { - keyword = keyword_original; - keyword_length = keyword_length_original; - } - } - // WORKAROUND: ignore the first '+' to support "+apple macintosh" pattern. - while (keyword_length > 0 && keyword[0] == ' ') { - keyword++; - keyword_length--; - } - if (keyword_length > 0 && keyword[0] == '+') { - keyword++; - keyword_length--; - } - if (!weight_specified) { - grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); - } - rc = grn_expr_parse(info->ctx, expression, - keyword, keyword_length, - match_columns, GRN_OP_MATCH, default_operator, - expr_flags_in_boolean_mode()); - if (rc) { - char error_message[MRN_MESSAGE_BUFFER_SIZE]; - snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, - "failed to parse fulltext search keyword: <%.*s>: <%s>", - keyword_length_original, keyword_original, - info->ctx->errbuf); - ulong action = THDVAR(ha_thd(), action_on_fulltext_query_error); - switch (static_cast(action)) { - case MRN_ACTION_ON_ERROR_ERROR: - my_message(ER_PARSE_ERROR, error_message, MYF(0)); - break; - case MRN_ACTION_ON_ERROR_ERROR_AND_LOG: - my_message(ER_PARSE_ERROR, error_message, MYF(0)); - GRN_LOG(info->ctx, GRN_LOG_ERROR, "%s", error_message); - break; - case MRN_ACTION_ON_ERROR_IGNORE: - break; - case MRN_ACTION_ON_ERROR_IGNORE_AND_LOG: - GRN_LOG(info->ctx, GRN_LOG_ERROR, "%s", error_message); - break; - } - } + mrn::QueryParser query_parser(info->ctx, + ha_thd(), + expression, + index_column, + KEY_N_KEY_PARTS(info->key_info), + match_columns); + grn_rc rc = query_parser.parse(key->ptr(), key->length()); DBUG_RETURN(rc); } @@ -8128,8 +8503,7 @@ grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_normal_mode( String *key, grn_obj *index_column, grn_obj *match_columns, - grn_obj *expression, - grn_obj *tmp_objects) + grn_obj *expression) { MRN_DBUG_ENTER_METHOD(); @@ -8163,6 +8537,18 @@ struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, info->result = grn_table_create(info->ctx, NULL, 0, NULL, GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, grn_table, 0); + if (!info->result) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "[mroonga][ft-init] failed to create a table " + "to store matched records for one search: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + delete info; + DBUG_RETURN(NULL); + } + info->score_column = grn_obj_column(info->ctx, info->result, MRN_COLUMN_NAME_SCORE, strlen(MRN_COLUMN_NAME_SCORE)); @@ -8188,8 +8574,6 @@ struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, grn_obj *expression, *expression_variable; GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->table, expression, expression_variable); - grn_obj tmp_objects; - GRN_PTR_INIT(&tmp_objects, GRN_OBJ_VECTOR, GRN_ID_NIL); grn_rc rc = GRN_SUCCESS; if (flags & FT_BOOL) { @@ -8197,15 +8581,13 @@ struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, key, index_column, match_columns, - expression, - &tmp_objects); + expression); } else { rc = generic_ft_init_ext_prepare_expression_in_normal_mode(info, key, index_column, match_columns, - expression, - &tmp_objects); + expression); } if (rc == GRN_SUCCESS) { @@ -8221,12 +8603,6 @@ struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, grn_obj_unlink(info->ctx, expression); grn_obj_unlink(info->ctx, match_columns); - uint n_tmp_objects = GRN_BULK_VSIZE(&tmp_objects) / sizeof(grn_obj *); - for (uint i = 0; i < n_tmp_objects; ++i) { - grn_obj_unlink(info->ctx, GRN_PTR_VALUE_AT(&tmp_objects, i)); - } - grn_obj_unlink(info->ctx, &tmp_objects); - DBUG_RETURN(info); } @@ -8234,7 +8610,7 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) { MRN_DBUG_ENTER_METHOD(); - check_count_skip(0, 0, true); + check_count_skip(0); mrn_change_encoding(ctx, system_charset_info); grn_operator operation = GRN_OP_OR; @@ -8242,6 +8618,16 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) matched_record_keys = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, grn_table, 0); + if (!matched_record_keys) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "[mroonga][ft-init] " + "failed to create a table to store all matched records: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + DBUG_RETURN(NULL); + } } grn_table_sort_key *sort_keys = NULL; @@ -8249,8 +8635,10 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) longlong limit = -1; check_fast_order_limit(&sort_keys, &n_sort_keys, &limit); - struct st_mrn_ft_info *info = - generic_ft_init_ext_select(flags, key_nr, key); + struct st_mrn_ft_info *info = generic_ft_init_ext_select(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } grn_rc rc; rc = grn_table_setoperation(ctx, matched_record_keys, info->result, @@ -8264,6 +8652,9 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); } if (fast_order_limit) { + if (sorted_result) { + grn_obj_close(ctx, sorted_result); + } sorted_result = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY, NULL, @@ -8302,20 +8693,31 @@ FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) FT_INFO *ha_mroonga::wrapper_ft_init_ext(uint flags, uint key_nr, String *key) { MRN_DBUG_ENTER_METHOD(); + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; mrn_ft_info->please = &mrn_wrapper_ft_vft; #ifdef HA_CAN_FULLTEXT_EXT mrn_ft_info->could_you = &mrn_wrapper_ft_vft_ext; #endif ++wrap_ft_init_count; + DBUG_RETURN(info); } FT_INFO *ha_mroonga::storage_ft_init_ext(uint flags, uint key_nr, String *key) { MRN_DBUG_ENTER_METHOD(); + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; mrn_ft_info->please = &mrn_storage_ft_vft; #ifdef HA_CAN_FULLTEXT_EXT @@ -8464,7 +8866,8 @@ const Item *ha_mroonga::storage_cond_push(const Item *cond) const Item *reminder_cond = cond; if (!pushed_cond) { mrn::ConditionConverter converter(ctx, grn_table, true); - if (converter.find_match_against(cond) && converter.is_convertable(cond)) { + if (converter.count_match_against(cond) == 1 && + converter.is_convertable(cond)) { reminder_cond = NULL; } } @@ -8577,6 +8980,47 @@ bool ha_mroonga::have_unique_index() DBUG_RETURN(false); } +bool ha_mroonga::is_foreign_key_field(const char *table_name, + const char *field_name) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *table = grn_ctx_get(ctx, table_name, -1); + if (!table) { + DBUG_RETURN(false); + } + + mrn::ColumnName column_name(field_name); + grn_obj *column = grn_obj_column(ctx, + table, + column_name.c_str(), + column_name.length()); + if (!column) { + DBUG_RETURN(false); + } + + grn_obj *range = grn_ctx_at(ctx, grn_obj_get_range(ctx, column)); + if (!range) { + DBUG_RETURN(false); + } + + if (!mrn::grn::is_table(range)) { + DBUG_RETURN(false); + } + + grn_obj *foreign_index_column; + mrn::IndexColumnName index_column_name(table_name, field_name); + foreign_index_column = grn_obj_column(ctx, range, + index_column_name.c_str(), + index_column_name.length()); + if (foreign_index_column) { + grn_obj_unlink(ctx, foreign_index_column); + DBUG_RETURN(true); + } + + DBUG_RETURN(false); +} + void ha_mroonga::push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag) { char search_name[MRN_BUFFER_SIZE]; @@ -8756,7 +9200,7 @@ void ha_mroonga::remove_related_files(const char *base_path) if (stat(entry->d_name, &file_status) != 0) { continue; } - if (!((file_status.st_mode & S_IFMT) & S_IFREG)) { + if (!((file_status.st_mode & S_IFMT) && S_IFREG)) { continue; } if (strncmp(entry->d_name, base_path, base_path_length) == 0) { @@ -8817,6 +9261,11 @@ int ha_mroonga::drop_index(MRN_SHARE *target_share, uint key_index) grn_obj *index_table = grn_ctx_get(ctx, index_table_name.c_str(), index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } if (index_table) { target_name_length = grn_obj_name(ctx, index_table, target_name, GRN_TABLE_MAX_KEY_SIZE); @@ -8964,7 +9413,9 @@ int ha_mroonga::drop_indexes_normal(const char *table_name, grn_obj *table) DBUG_RETURN(error); } -int ha_mroonga::drop_indexes_multiple(const char *table_name, grn_obj *table) +int ha_mroonga::drop_indexes_multiple(const char *table_name, + grn_obj *table, + const char *index_table_name_separator) { MRN_DBUG_ENTER_METHOD(); @@ -8972,7 +9423,7 @@ int ha_mroonga::drop_indexes_multiple(const char *table_name, grn_obj *table) char index_table_name_prefix[GRN_TABLE_MAX_KEY_SIZE]; snprintf(index_table_name_prefix, GRN_TABLE_MAX_KEY_SIZE, - "%s%s", table_name, mrn::IndexTableName::SEPARATOR); + "%s%s", table_name, index_table_name_separator); grn_table_cursor *cursor = grn_table_cursor_open(ctx, grn_ctx_db(ctx), @@ -9061,7 +9512,12 @@ int ha_mroonga::drop_indexes(const char *table_name) error = drop_indexes_normal(table_name, table.get()); if (error == 0) { - error = drop_indexes_multiple(table_name, table.get()); + error = drop_indexes_multiple(table_name, table.get(), + mrn::IndexTableName::SEPARATOR); + } + if (error == 0) { + error = drop_indexes_multiple(table_name, table.get(), + mrn::IndexTableName::OLD_SEPARATOR); } DBUG_RETURN(error); @@ -9188,6 +9644,26 @@ grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length) DBUG_RETURN(tokenizer); } +bool ha_mroonga::have_custom_normalizer(KEY *key) const +{ + MRN_DBUG_ENTER_METHOD(); + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (key->option_struct && key->option_struct->normalizer) { + DBUG_RETURN(true); + } +#endif + + if (key->comment.length > 0) { + mrn::ParametersParser parser(key->comment.str, + key->comment.length); + parser.parse(); + DBUG_RETURN(parser["normalizer"] != NULL); + } + + DBUG_RETURN(false); +} + grn_obj *ha_mroonga::find_normalizer(KEY *key) { MRN_DBUG_ENTER_METHOD(); @@ -9234,7 +9710,7 @@ grn_obj *ha_mroonga::find_normalizer(KEY *key, const char *name) DBUG_RETURN(normalizer); } -bool ha_mroonga::find_index_column_flags(KEY *key, grn_obj_flags *index_column_flags) +bool ha_mroonga::find_index_column_flags(KEY *key, grn_column_flags *index_column_flags) { MRN_DBUG_ENTER_METHOD(); bool found = false; @@ -9615,154 +10091,51 @@ bool ha_mroonga::should_normalize(Field *field) const DBUG_RETURN(need_normalize_p); } -bool ha_mroonga::is_temporary_table_name(const char *name) const -{ - MRN_DBUG_ENTER_METHOD(); - DBUG_PRINT("info", ("mroonga: table name = %s", name)); -#ifdef MRN_USE_MYSQL_DATA_HOME - bool temporary_table_name_p = false; - if (name[0] != '.') { - int len = strlen(name); - int mysql_data_home_len = strlen(mysql_data_home); - if (len < mysql_data_home_len || - strncmp(name, mysql_data_home, mysql_data_home_len) || - !strchr(&name[mysql_data_home_len], FN_LIBCHAR)) { - temporary_table_name_p = true; - } - } -#else - bool temporary_table_name_p = (name[0] != '.'); -#endif - DBUG_RETURN(temporary_table_name_p); -} - -void ha_mroonga::check_count_skip(key_part_map start_key_part_map, - key_part_map end_key_part_map, bool fulltext) +void ha_mroonga::check_count_skip(key_part_map target_key_part_map) { MRN_DBUG_ENTER_METHOD(); if (!is_enable_optimization()) { - DBUG_PRINT("info", ("mroonga: count skip: optimization is disabled")); + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] optimization is disabled"); + count_skip = false; + DBUG_VOID_RETURN; + } + + if (thd_sql_command(ha_thd()) != SQLCOM_SELECT) { + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not SELECT"); + count_skip = false; + DBUG_VOID_RETURN; + } + + if (share->wrapper_mode && + !(wrap_handler->ha_table_flags() & HA_NO_TRANSACTIONS)) { + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] wrapped engine is transactional"); count_skip = false; DBUG_VOID_RETURN; } st_select_lex *select_lex = table->pos_in_table_list->select_lex; - - if ( - thd_sql_command(ha_thd()) == SQLCOM_SELECT && - select_lex->item_list.elements == 1 && - !select_lex->group_list.elements && - !MRN_SELECT_LEX_GET_HAVING_COND(select_lex) && - select_lex->table_list.elements == 1 - ) { - Item *info = (Item *) select_lex->item_list.first_node()->info; - if ( - info->type() != Item::SUM_FUNC_ITEM || - ((Item_sum *) info)->sum_func() != Item_sum::COUNT_FUNC || - ((Item_sum *) info)->nest_level || - ((Item_sum *) info)->aggr_level || - ((Item_sum *) info)->max_arg_level != -1 || - ((Item_sum *) info)->max_sum_func_level != -1 - ) { - DBUG_PRINT("info", ("mroonga: count skip: sum func is not match")); - count_skip = false; - DBUG_VOID_RETURN; - } - - uint i = 0; - Item *where; - if (fulltext) { - DBUG_PRINT("info", ("mroonga: count skip: fulltext")); - where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex); - if (!where || - where->type() != Item::FUNC_ITEM || - ((Item_func *)where)->functype() != Item_func::FT_FUNC) { - DBUG_PRINT("info", ("mroonga: count skip: ft func is not match")); - count_skip = false; - DBUG_VOID_RETURN; - } - if (select_lex->select_n_where_fields != 1) { - DBUG_PRINT("info", - ("mroonga: count skip: " - "where clause is not fulltext search only")); - count_skip = false; - DBUG_VOID_RETURN; - } - if (share->wrapper_mode && - !(wrap_handler->ha_table_flags() & HA_NO_TRANSACTIONS)) { - DBUG_PRINT("info", ("mroonga: count skip: transactional wrapper mode")); - count_skip = false; - DBUG_VOID_RETURN; - } - DBUG_PRINT("info", ("mroonga: count skip: skip enabled")); - count_skip = true; - mrn_count_skip++; - DBUG_VOID_RETURN; - } else if (share->wrapper_mode) { - DBUG_PRINT("info", ("mroonga: count skip: wrapper mode")); - count_skip = false; - DBUG_VOID_RETURN; - } else { - DBUG_PRINT("info", ("mroonga: count skip: without fulltext")); - uint key_nr = active_index; - KEY *key_info = &(table->key_info[key_nr]); - KEY_PART_INFO *key_part = key_info->key_part; - for (where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex); - where; - where = where->next) { - Item *target = where; - - if (where->type() == Item::FUNC_ITEM) { - Item_func *func_item = static_cast(where); - if (func_item->argument_count() == 0) { - break; - } - target = func_item->key_item(); - where = where->next; - if (func_item->arguments()[0] == where) { - uint n_args = func_item->argument_count(); - for (; n_args > 0; --n_args) { - where = where->next; - } - } - } - - if (target->type() == Item::FIELD_ITEM) - { - Field *field = ((Item_field *)target)->field; - if (!field) - break; - if (field->table != table) - break; - uint j; - for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { - if (key_part[j].field == field) - { - if (!(start_key_part_map >> j) && !(end_key_part_map >> j)) - j = KEY_N_KEY_PARTS(key_info); - else - i++; - break; - } - } - if (j >= KEY_N_KEY_PARTS(key_info)) - break; - } - if (i >= select_lex->select_n_where_fields) - { - DBUG_PRINT("info", ("mroonga: count skip: skip enabled")); - count_skip = true; - mrn_count_skip++; - DBUG_VOID_RETURN; - } - } - DBUG_PRINT("info", ("mroonga: count skip: skip disabled")); - } + KEY *key_info = NULL; + if (active_index != MAX_KEY) { + key_info = &(table->key_info[active_index]); + } + mrn::CountSkipChecker checker(ctx, + table, + select_lex, + key_info, + target_key_part_map, + !share->wrapper_mode); + if (checker.check()) { + count_skip = true; + mrn_count_skip++; + DBUG_VOID_RETURN; + } else { + count_skip = false; + DBUG_VOID_RETURN; } - DBUG_PRINT("info", ("mroonga: count skip: select type is not match")); - count_skip = false; - DBUG_VOID_RETURN; } bool ha_mroonga::is_grn_zero_column_value(grn_obj *column, grn_obj *value) @@ -9872,15 +10245,22 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys, if (!converter.is_convertable(where)) { DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " - "not groonga layer condition search")); + "not Groonga layer condition search")); fast_order_limit = false; DBUG_VOID_RETURN; } - match_against = converter.find_match_against(where); - if (!match_against) { + unsigned int n_match_againsts = converter.count_match_against(where); + if (n_match_againsts == 0) { DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " - "groonga layer condition but not fulltext search")); + "Groonga layer condition but not fulltext search")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + if (n_match_againsts > 1) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "MATCH AGAINST must be only one")); fast_order_limit = false; DBUG_VOID_RETURN; } @@ -9901,8 +10281,7 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys, if (item->type() == Item::FIELD_ITEM) { Field *field = static_cast(item)->field; - const char *column_name = field->field_name.str; - int column_name_size = field->field_name.length; + mrn::ColumnName column_name(field->field_name); if (should_normalize(field)) { @@ -9917,7 +10296,8 @@ void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys, if (is_storage_mode) { (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys, - column_name, column_name_size); + column_name.c_str(), + column_name.length()); } else { if (is_primary_key_field(field)) { (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys, @@ -10376,6 +10756,20 @@ int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf) DBUG_RETURN(error); } +#ifdef MRN_HAVE_MYSQL_TYPE_JSON +int ha_mroonga::generic_store_bulk_json(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String buffer; + Field_json *json = static_cast(field); + String *value = json->val_str(&buffer, NULL); + grn_obj_reinit(ctx, buf, GRN_DB_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value->ptr(), value->length()); + DBUG_RETURN(error); +} +#endif + int ha_mroonga::generic_store_bulk(Field *field, grn_obj *buf) { MRN_DBUG_ENTER_METHOD(); @@ -10466,6 +10860,11 @@ int ha_mroonga::generic_store_bulk(Field *field, grn_obj *buf) case MYSQL_TYPE_GEOMETRY: error = generic_store_bulk_geometry(field, buf); break; +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + error = generic_store_bulk_json(field, buf); + break; +#endif default: error = HA_ERR_UNSUPPORTED; break; @@ -10826,6 +11225,18 @@ void ha_mroonga::storage_store_field_geometry(Field *field, DBUG_VOID_RETURN; } +#ifdef MRN_HAVE_MYSQL_TYPE_JSON +void ha_mroonga::storage_store_field_json(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_json *json = static_cast(field); + json->store(value, value_length, field->charset()); + DBUG_VOID_RETURN; +} +#endif + void ha_mroonga::storage_store_field(Field *field, const char *value, uint value_length) { @@ -10912,6 +11323,11 @@ void ha_mroonga::storage_store_field(Field *field, case MYSQL_TYPE_VARCHAR_COMPRESSED: case MYSQL_TYPE_BLOB_COMPRESSED: DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + storage_store_field_json(field, value, value_length); + break; +#endif } } @@ -10920,6 +11336,10 @@ void ha_mroonga::storage_store_field_column(Field *field, bool is_primary_key, { MRN_DBUG_ENTER_METHOD(); + if (!grn_columns[nth_column]) { + DBUG_VOID_RETURN; + } + grn_obj *column = grn_columns[nth_column]; grn_id range_id = grn_obj_get_range(ctx, column); grn_obj *range = grn_column_ranges[nth_column]; @@ -11055,6 +11475,11 @@ void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data, for (i = 0; i < n_columns; i++) { Field *field = table->field[i]; +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif if ( !bitmap_is_set(table->read_set, field->field_index) && !bitmap_is_set(table->write_set, field->field_index) && @@ -11673,8 +12098,10 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info, } int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, - const key_range *start, - const key_range *end, + const uchar *start, + uint start_size, + const uchar *end, + uint end_size, uchar *min_buffer, uint *min_encoded_size, uchar *max_buffer, @@ -11686,14 +12113,14 @@ int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, uint encoded_key_size = codec.size(); if (start) { memset(min_buffer, 0, encoded_key_size); - error = codec.encode(start->key, start->length, + error = codec.encode(start, start_size, min_buffer, min_encoded_size); // TODO: handle error? *min_encoded_size = encoded_key_size; } if (end) { memset(max_buffer, 0xff, encoded_key_size); - error = codec.encode(end->key, end->length, + error = codec.encode(end, end_size, max_buffer, max_encoded_size); // TODO: handle error? *max_encoded_size = encoded_key_size; @@ -11701,6 +12128,40 @@ int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, DBUG_RETURN(error); } +int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, + const key_range *start, + const key_range *end, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size) +{ + MRN_DBUG_ENTER_METHOD(); + + const uchar *start_data = NULL; + uint start_size = 0; + const uchar *end_data = NULL; + uint end_size = 0; + if (start) { + start_data = start->key; + start_size = start->length; + } + if (end) { + end_data = end->key; + end_size = end->length; + } + + int error = storage_encode_multiple_column_key_range(key_info, + start_data, start_size, + end_data, end_size, + min_buffer, + min_encoded_size, + max_buffer, + max_encoded_size); + + DBUG_RETURN(error); +} + int ha_mroonga::generic_reset() { MRN_DBUG_ENTER_METHOD(); @@ -12364,6 +12825,29 @@ int ha_mroonga::storage_delete_all_rows() { MRN_DBUG_ENTER_METHOD(); int error = generic_delete_all_rows(grn_table, __FUNCTION__); + if (!error) { + uint n_keys = table->s->keys; + for (uint i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + continue; + } + + error = generic_delete_all_rows(index_table, __FUNCTION__); + if (error) { + break; + } + } + } DBUG_RETURN(error); } @@ -12527,6 +13011,10 @@ int ha_mroonga::truncate() } else { error = storage_truncate(); } + if (!error) { + operations_->clear(table->s->table_name.str, + table->s->table_name.length); + } DBUG_RETURN(error); } @@ -12607,6 +13095,7 @@ double ha_mroonga::read_time(uint index, uint ranges, ha_rows rows) DBUG_RETURN(time); } +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING const key_map *ha_mroonga::wrapper_keys_to_use_for_scanning() { const key_map *res; @@ -12637,6 +13126,7 @@ const key_map *ha_mroonga::keys_to_use_for_scanning() } DBUG_RETURN(key_map); } +#endif ha_rows ha_mroonga::wrapper_estimate_rows_upper_bound() { @@ -12791,11 +13281,16 @@ int ha_mroonga::wrapper_rename_index(const char *from, const char *to, for (i = 0; i < tmp_table_share->keys; i++) { const char *mysql_index_name = tmp_table_share->key_info[i].name.str; mrn::IndexTableName from_index_table_name(from_table_name, mysql_index_name); - mrn::IndexTableName to_index_table_name(to_table_name, mysql_index_name); + mrn::IndexTableName to_index_table_name(to_table_name, mysql_index_name); grn_obj *index_table; index_table = grn_ctx_get(ctx, from_index_table_name.c_str(), from_index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + from_index_table_name.old_c_str(), + from_index_table_name.old_length()); + } if (index_table) { rc = grn_table_rename(ctx, index_table, to_index_table_name.c_str(), @@ -12861,6 +13356,11 @@ int ha_mroonga::storage_rename_table(const char *from, const char *to, index_table = grn_ctx_get(ctx, from_index_table_name.c_str(), from_index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + from_index_table_name.old_c_str(), + from_index_table_name.old_length()); + } if (index_table) { rc = grn_table_rename(ctx, index_table, to_index_table_name.c_str(), @@ -12914,34 +13414,32 @@ int ha_mroonga::storage_rename_foreign_key(MRN_SHARE *tmp_share, MRN_DBUG_ENTER_METHOD(); for (i = 0; i < n_columns; ++i) { Field *field = tmp_table_share->field[i]; - const char *column_name = field->field_name.str; - uint column_name_size = field->field_name.length; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (!is_foreign_key_field(from_table_name, field->field_name.str)) { continue; } - column = grn_obj_column(ctx, grn_table, - column_name, column_name_size); + grn_obj *grn_from_table = grn_ctx_get(ctx, from_table_name, -1); + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_from_table, + column_name.c_str(), + column_name.length()); if (!column) { continue; } grn_id ref_table_id = grn_obj_get_range(ctx, column); grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); - if (ref_table->header.type != GRN_TABLE_NO_KEY && - ref_table->header.type != GRN_TABLE_HASH_KEY && - ref_table->header.type != GRN_TABLE_PAT_KEY && - ref_table->header.type != GRN_TABLE_DAT_KEY) { - continue; - } - mrn::IndexColumnName from_index_column_name(from_table_name, column_name); + mrn::IndexColumnName from_index_column_name(from_table_name, + column_name.c_str()); ref_column = grn_obj_column(ctx, ref_table, from_index_column_name.c_str(), from_index_column_name.length()); if (!ref_column) { continue; } - mrn::IndexColumnName to_index_column_name(to_table_name, column_name); + mrn::IndexColumnName to_index_column_name(to_table_name, + column_name.c_str()); rc = grn_column_rename(ctx, ref_column, to_index_column_name.c_str(), to_index_column_name.length()); @@ -13124,6 +13622,11 @@ int ha_mroonga::generic_disable_index(int i, KEY *key_info) grn_obj *index_table = grn_ctx_get(ctx, index_table_name.c_str(), index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } if (index_table) { grn_obj_remove(ctx, index_table); } @@ -13140,6 +13643,42 @@ int ha_mroonga::generic_disable_index(int i, KEY *key_info) DBUG_RETURN(error); } +int ha_mroonga::wrapper_disable_indexes_mroonga(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + for (i = 0; i < table_share->keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + continue; + } + + int sub_error = generic_disable_index(i, key_info); + if (error != 0 && sub_error != 0) { + error = sub_error; + } + } + } else { + error = HA_ERR_WRONG_COMMAND; + } + DBUG_RETURN(error); +} + int ha_mroonga::wrapper_disable_indexes(uint mode) { int error = 0; @@ -13153,35 +13692,7 @@ int ha_mroonga::wrapper_disable_indexes(uint mode) error = 0; } if (!error) { - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { - uint i; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (share->wrap_key_nr[i] < MAX_KEY) { - continue; - } - if (!grn_index_tables[i]) { - DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); - DBUG_RETURN(0); - } - } - KEY *key_info = table_share->key_info; - for (i = 0; i < table_share->keys; i++) { - if (!(key_info[i].flags & HA_FULLTEXT) && - !mrn_is_geo_key(&key_info[i])) { - continue; - } - - int sub_error = generic_disable_index(i, key_info); - if (error != 0 && sub_error != 0) { - error = sub_error; - } - } - } else { - error = HA_ERR_WRONG_COMMAND; - } + error = wrapper_disable_indexes_mroonga(mode); } DBUG_RETURN(error); } @@ -13235,9 +13746,9 @@ int ha_mroonga::disable_indexes(uint mode) DBUG_RETURN(error); } -int ha_mroonga::wrapper_enable_indexes(uint mode) +int ha_mroonga::wrapper_enable_indexes_mroonga(uint mode) { - int error = 0, tmp_error = 0; + int error = 0; MRN_DBUG_ENTER_METHOD(); if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { uint i, j; @@ -13308,8 +13819,17 @@ int ha_mroonga::wrapper_enable_indexes(uint mode) MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); } else { - tmp_error = HA_ERR_WRONG_COMMAND; + error = HA_ERR_WRONG_COMMAND; } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_enable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + int mroonga_error = wrapper_enable_indexes_mroonga(mode); MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); @@ -13317,7 +13837,7 @@ int ha_mroonga::wrapper_enable_indexes(uint mode) MRN_SET_BASE_SHARE_KEY(share, table->s); MRN_SET_BASE_TABLE_KEY(this, table); if (error == HA_ERR_WRONG_COMMAND) { - error = tmp_error; + error = mroonga_error; } DBUG_RETURN(error); } @@ -13431,10 +13951,10 @@ int ha_mroonga::storage_check(THD* thd, HA_CHECK_OPT* check_opt) { MRN_DBUG_ENTER_METHOD(); mrn::DatabaseRepairer repairer(ctx, thd); - if (repairer.repair()) { - DBUG_RETURN(HA_ADMIN_OK); - } else { + if (repairer.is_corrupt()) { DBUG_RETURN(HA_ADMIN_CORRUPT); + } else { + DBUG_RETURN(HA_ADMIN_OK); } } @@ -13590,10 +14110,16 @@ int ha_mroonga::wrapper_recreate_indexes(THD *thd) "%s.%s", index_table_name.c_str(), INDEX_COLUMN_NAME); remove_grn_obj_force(index_column_full_name); remove_grn_obj_force(index_table_name.c_str()); + + char index_column_full_old_name[MRN_MAX_PATH_SIZE]; + snprintf(index_column_full_old_name, MRN_MAX_PATH_SIZE, + "%s.%s", index_table_name.old_c_str(), INDEX_COLUMN_NAME); + remove_grn_obj_force(index_column_full_old_name); + remove_grn_obj_force(index_table_name.old_c_str()); + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); } - error = wrapper_create_index(table_share->normalized_path.str, table, - NULL, share, mapper.table_name()); + error = wrapper_create_index(table_share->normalized_path.str, table, share); if (error) DBUG_RETURN(error); error = wrapper_open_indexes(table_share->normalized_path.str); @@ -13642,6 +14168,12 @@ int ha_mroonga::storage_recreate_indexes(THD *thd) "%s.%s", index_table_name.c_str(), INDEX_COLUMN_NAME); remove_grn_obj_force(index_column_full_name); remove_grn_obj_force(index_table_name.c_str()); + + char index_column_full_old_name[MRN_MAX_PATH_SIZE]; + snprintf(index_column_full_old_name, MRN_MAX_PATH_SIZE, + "%s.%s", index_table_name.old_c_str(), INDEX_COLUMN_NAME); + remove_grn_obj_force(index_column_full_old_name); + remove_grn_obj_force(index_table_name.old_c_str()); } int error; @@ -13984,8 +14516,8 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter( ( Alter_inplace_info::ADD_COLUMN | Alter_inplace_info::DROP_COLUMN | - Alter_inplace_info::ALTER_STORED_COLUMN_TYPE | - Alter_inplace_info::ALTER_STORED_COLUMN_ORDER | + MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE | + MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER | Alter_inplace_info::ALTER_COLUMN_NULLABLE | Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE | Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE | @@ -14097,15 +14629,22 @@ enum_alter_inplace_result ha_mroonga::storage_check_if_supported_inplace_alter( Alter_inplace_info *ha_alter_info) { MRN_DBUG_ENTER_METHOD(); + Alter_inplace_info::HA_ALTER_FLAGS explicitly_unsupported_flags = + Alter_inplace_info::ADD_FOREIGN_KEY | + Alter_inplace_info::DROP_FOREIGN_KEY; Alter_inplace_info::HA_ALTER_FLAGS supported_flags = Alter_inplace_info::ADD_INDEX | Alter_inplace_info::DROP_INDEX | Alter_inplace_info::ADD_UNIQUE_INDEX | Alter_inplace_info::DROP_UNIQUE_INDEX | - Alter_inplace_info::ADD_COLUMN | + MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN | + MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN | + MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN | Alter_inplace_info::DROP_COLUMN | Alter_inplace_info::ALTER_COLUMN_NAME; - if (ha_alter_info->handler_flags & supported_flags) { + if (ha_alter_info->handler_flags & explicitly_unsupported_flags) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } else if (ha_alter_info->handler_flags & supported_flags) { DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK); } else { DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); @@ -14299,18 +14838,11 @@ bool ha_mroonga::wrapper_inplace_alter_table( need_fill_index = true; } if (!error && need_fill_index) { - my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); - uint n_columns = altered_table->s->fields; - for (i = 0; i < n_columns; ++i) { - Field *field = altered_table->field[i]; - field->move_field_offset(ptr_diff); - } + my_ptrdiff_t diff = + PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); + mrn::TableFieldsOffsetMover mover(altered_table, diff); error = wrapper_fill_indexes(ha_thd(), altered_table->key_info, index_columns, ha_alter_info->key_count); - for (i = 0; i < n_columns; ++i) { - Field *field = altered_table->field[i]; - field->move_field_offset(-ptr_diff); - } } bitmap_set_all(table->read_set); @@ -14369,31 +14901,12 @@ bool ha_mroonga::wrapper_inplace_alter_table( DBUG_RETURN(result); } -bool ha_mroonga::storage_inplace_alter_table_index( +bool ha_mroonga::storage_inplace_alter_table_add_index( TABLE *altered_table, Alter_inplace_info *ha_alter_info) { MRN_DBUG_ENTER_METHOD(); - bool have_error = false; - int error = 0; - uint n_keys; - uint i, j = 0; - KEY *key_info = table_share->key_info; - mrn::PathMapper mapper(share->table_name); - n_keys = ha_alter_info->index_drop_count; - for (i = 0; i < n_keys; ++i) { - KEY *key = ha_alter_info->index_drop_buffer[i]; - while (strcmp(key_info[j].name.str, key->name.str)) { - ++j; - } - error = drop_index(share, j); - if (error) - DBUG_RETURN(true); - grn_index_tables[j] = NULL; - grn_index_columns[j] = NULL; - } - MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, ha_alter_info->key_count); MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, @@ -14439,11 +14952,11 @@ bool ha_mroonga::storage_inplace_alter_table_index( KEY *p_key_info = &table->key_info[table_share->primary_key]; mrn_set_bitmap_by_key(table->read_set, p_key_info); } - n_keys = ha_alter_info->index_add_count; - for (i = 0; i < n_keys; ++i) { + int error = 0; + uint n_keys = ha_alter_info->index_add_count; + for (uint i = 0; i < n_keys; ++i) { uint key_pos = ha_alter_info->index_add_buffer[i]; - KEY *key = - &altered_table->key_info[key_pos]; + KEY *key = &altered_table->key_info[key_pos]; if (share->disable_keys && !(key->flags & HA_NOSAME)) { continue; // key is disabled } @@ -14452,6 +14965,7 @@ bool ha_mroonga::storage_inplace_alter_table_index( break; } DBUG_PRINT("info", ("mroonga: add key pos=%u", key_pos)); + mrn::PathMapper mapper(share->table_name); if ((error = storage_create_index(table, mapper.table_name(), grn_table, tmp_share, key, index_tables, index_columns, key_pos))) @@ -14479,12 +14993,9 @@ bool ha_mroonga::storage_inplace_alter_table_index( } } if (!error && have_multiple_column_index) { - my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); - uint n_columns = altered_table->s->fields; - for (i = 0; i < n_columns; ++i) { - Field *field = altered_table->field[i]; - field->move_field_offset(ptr_diff); - } + my_ptrdiff_t diff = + PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); + mrn::TableFieldsOffsetMover mover(altered_table, diff); error = storage_add_index_multiple_columns(altered_table->key_info, ha_alter_info->key_count, index_tables, @@ -14495,17 +15006,14 @@ bool ha_mroonga::storage_inplace_alter_table_index( } else if (error) { my_message(error, "failed to create multiple column index", MYF(0)); } - for (i = 0; i < n_columns; ++i) { - Field *field = altered_table->field[i]; - field->move_field_offset(-ptr_diff); - } } bitmap_set_all(table->read_set); + bool have_error = false; if (error) { n_keys = ha_alter_info->index_add_count; - for (i = 0; i < n_keys; ++i) { + for (uint i = 0; i < n_keys; ++i) { uint key_pos = ha_alter_info->index_add_buffer[i]; KEY *key = &altered_table->key_info[key_pos]; @@ -14528,6 +15036,33 @@ bool ha_mroonga::storage_inplace_alter_table_index( DBUG_RETURN(have_error); } +bool ha_mroonga::storage_inplace_alter_table_drop_index( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + uint n_keys; + uint i, j = 0; + KEY *key_info = table_share->key_info; + mrn::PathMapper mapper(share->table_name); + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + KEY *key = ha_alter_info->index_drop_buffer[i]; + while (strcmp(key_info[j].name.str, key->name.str) != 0) { + ++j; + } + int error = drop_index(share, j); + if (error != 0) + DBUG_RETURN(true); + grn_index_tables[j] = NULL; + grn_index_columns[j] = NULL; + } + + DBUG_RETURN(have_error); +} + bool ha_mroonga::storage_inplace_alter_table_add_column( TABLE *altered_table, Alter_inplace_info *ha_alter_info) @@ -14581,9 +15116,14 @@ bool ha_mroonga::storage_inplace_alter_table_add_column( } Field *field = altered_table->s->field[i]; - const char *column_name = field->field_name.str; - int column_name_size = field->field_name.length; +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + mrn::ColumnName column_name(field->field_name); int error = mrn_add_column_param(tmp_share, field, i); if (error) { have_error = true; @@ -14608,20 +15148,114 @@ bool ha_mroonga::storage_inplace_alter_table_add_column( char *col_path = NULL; // we don't specify path grn_obj *column_obj = - grn_column_create(ctx, table_obj, column_name, column_name_size, + grn_column_create(ctx, table_obj, + column_name.c_str(), + column_name.length(), col_path, col_flags, col_type); if (ctx->rc) { error = ER_WRONG_COLUMN_NAME; my_message(error, ctx->errbuf, MYF(0)); have_error = true; - } - if (column_obj) { - grn_obj_unlink(ctx, column_obj); - } - - if (have_error) { break; } + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field)) { +# ifndef MRN_MARIADB_P + MY_BITMAP generated_column_bitmap; + if (bitmap_init(&generated_column_bitmap, NULL, + altered_table->s->fields, false)) { + error = HA_ERR_OUT_OF_MEM; + my_message(ER_OUTOFMEMORY, + "mroonga: storage: " + "failed to allocate memory for getting generated value", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + mrn::SmartBitmap smart_generated_column_bitmap(&generated_column_bitmap); + bitmap_set_bit(&generated_column_bitmap, field->field_index); +# endif + + my_ptrdiff_t diff = + PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); + mrn::TableFieldsOffsetMover mover(altered_table, diff); + + error = storage_rnd_init(true); + if (error) { + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + + Field *altered_field = altered_table->field[i]; + grn_obj new_value; + GRN_VOID_INIT(&new_value); + mrn::SmartGrnObj smart_new_value(ctx, &new_value); + while (!have_error) { + int next_error = storage_rnd_next(table->record[0]); + if (next_error == HA_ERR_END_OF_FILE) { + break; + } else if (next_error != 0) { + error = next_error; + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + +# ifdef MRN_MARIADB_P + MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(altered_table, altered_field); +# else + if (update_generated_write_fields(&generated_column_bitmap, altered_table)) { + error = ER_ERROR_ON_WRITE; + my_message(error, + "mroonga: storage: " + "failed to update generated value for updating column", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } +# endif + + error = mrn_change_encoding(ctx, altered_field->charset()); + if (error) { + my_message(error, + "mroonga: storage: " + "failed to change encoding to store generated value", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + error = generic_store_bulk(altered_field, &new_value); + if (error) { + my_message(error, + "mroonga: storage: " + "failed to get generated value for updating column", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + + grn_obj_set_value(ctx, column_obj, record_id, &new_value, GRN_OBJ_SET); + if (ctx->rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + break; + } + } + + int end_error = storage_rnd_end(); + if (end_error != 0 && error == 0) { + error = end_error; + grn_obj_remove(ctx, column_obj); + break; + } + } +#endif } grn_obj_unlink(ctx, table_obj); @@ -14753,16 +15387,14 @@ bool ha_mroonga::storage_inplace_alter_table( have_error = true; } - Alter_inplace_info::HA_ALTER_FLAGS index_related_flags = - Alter_inplace_info::ADD_INDEX | + Alter_inplace_info::HA_ALTER_FLAGS drop_index_related_flags = Alter_inplace_info::DROP_INDEX | - Alter_inplace_info::ADD_UNIQUE_INDEX | Alter_inplace_info::DROP_UNIQUE_INDEX | - Alter_inplace_info::ADD_PK_INDEX | Alter_inplace_info::DROP_PK_INDEX; if (!have_error && - (ha_alter_info->handler_flags & index_related_flags)) { - have_error = storage_inplace_alter_table_index(altered_table, ha_alter_info); + (ha_alter_info->handler_flags & drop_index_related_flags)) { + have_error = storage_inplace_alter_table_drop_index(altered_table, + ha_alter_info); } Alter_inplace_info::HA_ALTER_FLAGS add_column_related_flags = @@ -14786,6 +15418,16 @@ bool ha_mroonga::storage_inplace_alter_table( have_error = storage_inplace_alter_table_rename_column(altered_table, ha_alter_info); } + Alter_inplace_info::HA_ALTER_FLAGS add_index_related_flags = + Alter_inplace_info::ADD_INDEX | + Alter_inplace_info::ADD_UNIQUE_INDEX | + Alter_inplace_info::ADD_PK_INDEX; + if (!have_error && + (ha_alter_info->handler_flags & add_index_related_flags)) { + have_error = storage_inplace_alter_table_add_index(altered_table, + ha_alter_info); + } + DBUG_RETURN(have_error); } @@ -15891,26 +16533,22 @@ char *ha_mroonga::storage_get_foreign_key_create_info() create_info_str.length(0); for (i = 0; i < n_columns; ++i) { Field *field = table_share->field[i]; - const char *column_name = field->field_name.str; - uint column_name_size = field->field_name.length; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (!is_foreign_key_field(table_share->table_name.str, + field->field_name.str)) { continue; } - column = grn_obj_column(ctx, grn_table, - column_name, column_name_size); + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); if (!column) { continue; } grn_id ref_table_id = grn_obj_get_range(ctx, column); grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); - if (ref_table->header.type != GRN_TABLE_NO_KEY && - ref_table->header.type != GRN_TABLE_HASH_KEY && - ref_table->header.type != GRN_TABLE_PAT_KEY && - ref_table->header.type != GRN_TABLE_DAT_KEY) { - continue; - } char ref_table_buff[NAME_LEN + 1]; int ref_table_name_length = grn_obj_name(ctx, ref_table, ref_table_buff, NAME_LEN); @@ -15920,14 +16558,18 @@ char *ha_mroonga::storage_get_foreign_key_create_info() DBUG_RETURN(NULL); } create_info_str.q_append(",\n CONSTRAINT ", 15); - append_identifier(ha_thd(), &create_info_str, column_name, - column_name_size); + append_identifier(ha_thd(), + &create_info_str, + column_name.c_str(), + column_name.length()); if (create_info_str.reserve(14)) { DBUG_RETURN(NULL); } create_info_str.q_append(" FOREIGN KEY (", 14); - append_identifier(ha_thd(), &create_info_str, column_name, - column_name_size); + append_identifier(ha_thd(), + &create_info_str, + column_name.c_str(), + column_name.length()); if (create_info_str.reserve(13)) { DBUG_RETURN(NULL); } @@ -16098,37 +16740,36 @@ int ha_mroonga::storage_get_foreign_key_list(THD *thd, MRN_DBUG_ENTER_METHOD(); for (i = 0; i < n_columns; ++i) { Field *field = table_share->field[i]; - const char *column_name = field->field_name.str; - uint column_name_size = field->field_name.length; - if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (!is_foreign_key_field(table_share->table_name.str, + field->field_name.str)) { continue; } - column = grn_obj_column(ctx, grn_table, - column_name, column_name_size); + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); if (!column) { continue; } grn_id ref_table_id = grn_obj_get_range(ctx, column); grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); - if (ref_table->header.type != GRN_TABLE_NO_KEY && - ref_table->header.type != GRN_TABLE_HASH_KEY && - ref_table->header.type != GRN_TABLE_PAT_KEY && - ref_table->header.type != GRN_TABLE_DAT_KEY) { - continue; - } FOREIGN_KEY_INFO f_key_info; - f_key_info.foreign_id = thd_make_lex_string(thd, NULL, column_name, - column_name_size, TRUE); + f_key_info.foreign_id = thd_make_lex_string(thd, + NULL, + column_name.c_str(), + column_name.length(), + TRUE); f_key_info.foreign_db = thd_make_lex_string(thd, NULL, - table_share->db.str, - table_share->db.length, - TRUE); + table_share->db.str, + table_share->db.length, + TRUE); f_key_info.foreign_table = thd_make_lex_string(thd, NULL, - table_share->table_name.str, - table_share->table_name.length, - TRUE); + table_share->table_name.str, + table_share->table_name.length, + TRUE); f_key_info.referenced_db = f_key_info.foreign_db; char ref_table_buff[NAME_LEN + 1]; @@ -16141,12 +16782,22 @@ int ha_mroonga::storage_get_foreign_key_list(THD *thd, ref_table_buff, ref_table_name_length, TRUE); +#ifdef MRN_FOREIGN_KEY_USE_METHOD_ENUM f_key_info.update_method = FK_OPTION_RESTRICT; f_key_info.delete_method = FK_OPTION_RESTRICT; +#else + f_key_info.update_method = thd_make_lex_string(thd, NULL, "RESTRICT", + 8, TRUE); + f_key_info.delete_method = thd_make_lex_string(thd, NULL, "RESTRICT", + 8, TRUE); +#endif f_key_info.referenced_key_name = thd_make_lex_string(thd, NULL, "PRIMARY", 7, TRUE); - LEX_CSTRING *field_name = thd_make_lex_string(thd, NULL, column_name, - column_name_size, TRUE); + LEX_CSTRING *field_name = thd_make_lex_string(thd, + NULL, + column_name.c_str(), + column_name.length(), + TRUE); f_key_info.foreign_fields.push_back(field_name); char ref_path[FN_REFLEN + 1]; @@ -16348,6 +16999,7 @@ void ha_mroonga::free_foreign_key_create_info(char* str) DBUG_VOID_RETURN; } +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS bool ha_mroonga::check_written_by_row_based_binlog() { MRN_DBUG_ENTER_METHOD(); @@ -16381,6 +17033,7 @@ bool ha_mroonga::check_written_by_row_based_binlog() DBUG_RETURN(true); } +#endif #ifdef MRN_HAVE_HA_REBIND_PSI void ha_mroonga::wrapper_unbind_psi() @@ -16510,3 +17163,20 @@ my_bool ha_mroonga::register_query_cache_table(THD *thd, #ifdef __cplusplus } #endif + +namespace mrn { + namespace variables { + ulonglong get_boolean_mode_syntax_flags(THD *thd) { + ulonglong flags = BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT; +#ifdef MRN_SUPPORT_THDVAR_SET + flags = THDVAR(thd, boolean_mode_syntax_flags); +#endif + return flags; + } + + ActionOnError get_action_on_fulltext_query_error(THD *thd) { + ulong action = THDVAR(thd, action_on_fulltext_query_error); + return static_cast(action); + } + } +} diff --git a/storage/mroonga/ha_mroonga.def b/storage/mroonga/ha_mroonga.def index 5770cde72e7..7f8394fe4ca 100644 --- a/storage/mroonga/ha_mroonga.def +++ b/storage/mroonga/ha_mroonga.def @@ -13,3 +13,6 @@ EXPORTS mroonga_escape mroonga_escape_init mroonga_escape_deinit + mroonga_normalize + mroonga_normalize_init + mroonga_normalize_deinit diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 6416513f0eb..15497e70c59 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -32,6 +32,14 @@ extern "C" { #include #include "mrn_mysql_compat.h" +#include +#include + +#if __cplusplus >= 201402 +# define mrn_override override +#else +# define mrn_override +#endif #if (MYSQL_VERSION_ID >= 50514 && MYSQL_VERSION_ID < 50600) # define MRN_HANDLER_HAVE_FINAL_ADD_INDEX 1 @@ -102,6 +110,13 @@ extern "C" { # define MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE #endif +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +#define MRN_HAVE_HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW +#define MRN_HAVE_HA_EXTRA_BEGIN_ALTER_COPY +#define MRN_HAVE_HA_EXTRA_END_ALTER_COPY +#define MRN_HAVE_HA_EXTRA_NO_AUTOINC_LOCKING +#endif + #if MYSQL_VERSION_ID >= 50607 && \ (!defined(MRN_MARIADB_P) || MYSQL_VERSION_ID < 100008) # define MRN_HAVE_HA_EXTRA_EXPORT @@ -196,6 +211,10 @@ extern "C" { # define MRN_FOREIGN_KEY_USE_CONST_STRING #endif +#if MYSQL_VERSION_ID >= 100203 && defined(MRN_MARIADB_P) +# define MRN_FOREIGN_KEY_USE_METHOD_ENUM +#endif + #if MYSQL_VERSION_ID < 50706 || defined(MRN_MARIADB_P) # define MRN_HANDLER_IS_FATAL_ERROR_HAVE_FLAGS #endif @@ -204,6 +223,45 @@ extern "C" { # define MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT #endif +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50709) || \ + (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100203) +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE \ + Alter_inplace_info::ALTER_STORED_COLUMN_TYPE +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER \ + Alter_inplace_info::ALTER_STORED_COLUMN_ORDER +#else +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE \ + Alter_inplace_info::ALTER_COLUMN_TYPE +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER \ + Alter_inplace_info::ALTER_COLUMN_ORDER +#endif + +#if MYSQL_VERSION_ID >= 50700 && !defined(MRN_MARIADB_P) +# define MRN_HANDLER_RECORDS_RETURN_ERROR +#endif + +#if MYSQL_VERSION_ID < 80002 || defined(MRN_MARIADB_P) +# define MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_ST_MYSQL_PLUGIN_HAVE_CHECK_UNINSTALL +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION +# define MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_HANDLERTON_CREATE_HAVE_PARTITIONED +#endif + +#if defined(HAVE_PSI_INTERFACE) && \ + (MYSQL_VERSION_ID < 80002 || defined(MRN_MARIADB_P)) +# define MRN_HAVE_PSI_SERVER +#endif + class ha_mroonga; /* structs */ @@ -347,6 +405,8 @@ private: // for ft in where clause test Item_func_match *current_ft_item; + mrn::Operations *operations_; + public: ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg); ~ha_mroonga(); @@ -357,8 +417,20 @@ public: ulonglong table_flags() const; // required ulong index_flags(uint idx, uint part, bool all_parts) const; // required - int create(const char *name, TABLE *form, HA_CREATE_INFO *info); // required - int open(const char *name, int mode, uint test_if_locked); // required + // required + int create(const char *name, TABLE *form, HA_CREATE_INFO *info +#ifdef MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION + , + dd::Table *table_def +#endif + ) mrn_override; + // required + int open(const char *name, int mode, uint open_options +#ifdef MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION + , + const dd::Table *table_def +#endif + ) mrn_override; #ifndef MRN_HANDLER_HAVE_HA_CLOSE int close(); // required #endif @@ -419,11 +491,6 @@ public: #endif int index_next_same(uchar *buf, const uchar *key, uint keylen); - int read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted); - int read_range_next(); - int ft_init(); FT_INFO *ft_init_ext(uint flags, uint inx, String *key); int ft_read(uchar *buf); @@ -469,7 +536,9 @@ public: int truncate(); double scan_time(); double read_time(uint index, uint ranges, ha_rows rows); +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING const key_map *keys_to_use_for_scanning(); +#endif ha_rows estimate_rows_upper_bound(); void update_create_info(HA_CREATE_INFO* create_info); int rename_table(const char *from, const char *to); @@ -518,6 +587,11 @@ public: int start_stmt(THD *thd, thr_lock_type lock_type); protected: +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR + int records(ha_rows *num_rows); +#else + ha_rows records(); +#endif #ifdef MRN_HANDLER_HAVE_HA_RND_NEXT int rnd_next(uchar *buf); #endif @@ -580,6 +654,9 @@ private: bool have_unique_index(); + bool is_foreign_key_field(const char *table_name, + const char *field_name); + void push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag); void clear_cursor(); void clear_cursor_geo(); @@ -592,7 +669,8 @@ private: void remove_grn_obj_force(const char *name); int drop_index(MRN_SHARE *target_share, uint key_index); int drop_indexes_normal(const char *table_name, grn_obj *table); - int drop_indexes_multiple(const char *table_name, grn_obj *table); + int drop_indexes_multiple(const char *table_name, grn_obj *table, + const char *index_table_name_separator); int drop_indexes(const char *table_name); bool find_column_flags(Field *field, MRN_SHARE *mrn_share, int i, grn_obj_flags *column_flags); @@ -600,9 +678,10 @@ private: int error_code); grn_obj *find_tokenizer(KEY *key, MRN_SHARE *mrn_share, int i); grn_obj *find_tokenizer(const char *name, int name_length); + bool have_custom_normalizer(KEY *key) const; grn_obj *find_normalizer(KEY *key); grn_obj *find_normalizer(KEY *key, const char *name); - bool find_index_column_flags(KEY *key, grn_obj_flags *index_column_flags); + bool find_index_column_flags(KEY *key, grn_column_flags *index_column_flags); bool find_token_filters(KEY *key, grn_obj *token_filters); bool find_token_filters_put(grn_obj *token_filters, const char *token_filter_name, @@ -622,9 +701,7 @@ private: bool is_dry_write(); bool is_enable_optimization(); bool should_normalize(Field *field) const; - bool is_temporary_table_name(const char *name) const; - void check_count_skip(key_part_map start_key_part_map, - key_part_map end_key_part_map, bool fulltext); + void check_count_skip(key_part_map target_key_part_map); bool is_grn_zero_column_value(grn_obj *column, grn_obj *value); bool is_primary_key_field(Field *field) const; void check_fast_order_limit(grn_table_sort_key **sort_keys, int *n_sort_keys, @@ -652,6 +729,9 @@ private: int generic_store_bulk_new_decimal(Field *field, grn_obj *buf); int generic_store_bulk_blob(Field *field, grn_obj *buf); int generic_store_bulk_geometry(Field *field, grn_obj *buf); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + int generic_store_bulk_json(Field *field, grn_obj *buf); +#endif int generic_store_bulk(Field *field, grn_obj *buf); void storage_store_field_string(Field *field, @@ -687,6 +767,10 @@ private: const char *value, uint value_length); void storage_store_field_geometry(Field *field, const char *value, uint value_length); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + void storage_store_field_json(Field *field, + const char *value, uint value_length); +#endif void storage_store_field(Field *field, const char *value, uint value_length); void storage_store_field_column(Field *field, bool is_primary_key, int nth_column, grn_id record_id); @@ -731,6 +815,15 @@ private: int storage_encode_multiple_column_key(KEY *key_info, const uchar *key, uint key_length, uchar *buffer, uint *encoded_length); + int storage_encode_multiple_column_key_range(KEY *key_info, + const uchar *start, + uint start_size, + const uchar *end, + uint end_size, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size); int storage_encode_multiple_column_key_range(KEY *key_info, const key_range *start, const key_range *end, @@ -758,9 +851,7 @@ private: grn_obj **index_tables, grn_obj **index_columns, MRN_SHARE *tmp_share); - int wrapper_create_index(const char *name, TABLE *table, - HA_CREATE_INFO *info, MRN_SHARE *tmp_share, - const char *grn_table_name); + int wrapper_create_index(const char *name, TABLE *table, MRN_SHARE *tmp_share); int storage_create_validate_pseudo_column(TABLE *table); #ifdef MRN_SUPPORT_FOREIGN_KEYS bool storage_create_foreign_key(TABLE *table, const char *grn_table_name, @@ -778,16 +869,18 @@ private: int storage_create_indexes(TABLE *table, const char *grn_table_name, grn_obj *grn_table, MRN_SHARE *tmp_share); int close_databases(); - int ensure_database_open(const char *name); + int ensure_database_open(const char *name, mrn::Database **db=NULL); int ensure_database_remove(const char *name); int wrapper_delete_table(const char *name, handlerton *wrap_handlerton, const char *table_name); int generic_delete_table(const char *name, const char *table_name); - int wrapper_open(const char *name, int mode, uint test_if_locked); + int wrapper_open(const char *name, int mode, uint open_options); int wrapper_open_indexes(const char *name); - int storage_open(const char *name, int mode, uint test_if_locked); + int storage_reindex(); + int storage_open(const char *name, int mode, uint open_options); int open_table(const char *name); int storage_open_columns(void); + void storage_close_columns(void); int storage_open_indexes(const char *name); void wrapper_overwrite_index_bits(); int wrapper_close(); @@ -875,6 +968,13 @@ private: void storage_info_variable(); void storage_info_variable_records(); void storage_info_variable_data_file_length(); +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR + int wrapper_records(ha_rows *num_rows); + int storage_records(ha_rows *num_rows); +#else + ha_rows wrapper_records(); + ha_rows storage_records(); +#endif int wrapper_rnd_init(bool scan); int storage_rnd_init(bool scan); int wrapper_rnd_end(); @@ -917,14 +1017,6 @@ private: int storage_index_last(uchar *buf); int wrapper_index_next_same(uchar *buf, const uchar *key, uint keylen); int storage_index_next_same(uchar *buf, const uchar *key, uint keylen); - int wrapper_read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted); - int storage_read_range_first(const key_range *start_key, - const key_range *end_key, - bool eq_range, bool sorted); - int wrapper_read_range_next(); - int storage_read_range_next(); int generic_ft_init(); int wrapper_ft_init(); int storage_ft_init(); @@ -932,41 +1024,18 @@ private: FT_INFO *storage_ft_init_ext(uint flags, uint key_nr, String *key); void generic_ft_init_ext_add_conditions_fast_order_limit( struct st_mrn_ft_info *info, grn_obj *expression); - bool generic_ft_init_ext_parse_pragma_d(struct st_mrn_ft_info *info, - const char *keyword, - uint keyword_length, - grn_operator *default_operator, - uint *consumed_keyword_length); - void generic_ft_init_ext_parse_pragma_w_append_section( - struct st_mrn_ft_info *info, - grn_obj *index_column, - grn_obj *match_columns, - uint section, - grn_obj *section_value_buffer, - int weight, - uint n_weights); - bool generic_ft_init_ext_parse_pragma_w(struct st_mrn_ft_info *info, - const char *keyword, - uint keyword_length, - grn_obj *index_column, - grn_obj *match_columns, - uint *consumed_keyword_length, - grn_obj *tmp_objects); - grn_expr_flags expr_flags_in_boolean_mode(); grn_rc generic_ft_init_ext_prepare_expression_in_boolean_mode( struct st_mrn_ft_info *info, String *key, grn_obj *index_column, grn_obj *match_columns, - grn_obj *expression, - grn_obj *tmp_objects); + grn_obj *expression); grn_rc generic_ft_init_ext_prepare_expression_in_normal_mode( struct st_mrn_ft_info *info, String *key, grn_obj *index_column, grn_obj *match_columns, - grn_obj *expression, - grn_obj *tmp_objects); + grn_obj *expression); struct st_mrn_ft_info *generic_ft_init_ext_select(uint flags, uint key_nr, String *key); @@ -1044,8 +1113,10 @@ private: double storage_scan_time(); double wrapper_read_time(uint index, uint ranges, ha_rows rows); double storage_read_time(uint index, uint ranges, ha_rows rows); +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING const key_map *wrapper_keys_to_use_for_scanning(); const key_map *storage_keys_to_use_for_scanning(); +#endif ha_rows wrapper_estimate_rows_upper_bound(); ha_rows storage_estimate_rows_upper_bound(); void wrapper_update_create_info(HA_CREATE_INFO* create_info); @@ -1072,8 +1143,10 @@ private: bool wrapper_auto_repair(int error) const; bool storage_auto_repair(int error) const; int generic_disable_index(int i, KEY *key_info); + int wrapper_disable_indexes_mroonga(uint mode); int wrapper_disable_indexes(uint mode); int storage_disable_indexes(uint mode); + int wrapper_enable_indexes_mroonga(uint mode); int wrapper_enable_indexes(uint mode); int storage_enable_indexes(uint mode); int wrapper_check(THD* thd, HA_CHECK_OPT* check_opt); @@ -1114,8 +1187,10 @@ private: Alter_inplace_info *ha_alter_info); bool wrapper_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info); - bool storage_inplace_alter_table_index(TABLE *altered_table, - Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_add_index(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_drop_index(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); bool storage_inplace_alter_table_add_column(TABLE *altered_table, Alter_inplace_info *ha_alter_info); bool storage_inplace_alter_table_drop_column(TABLE *altered_table, @@ -1211,7 +1286,9 @@ private: void storage_free_foreign_key_create_info(char* str); void wrapper_set_keys_in_use(); void storage_set_keys_in_use(); +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS bool check_written_by_row_based_binlog(); +#endif #ifdef MRN_HAVE_HA_REBIND_PSI void wrapper_unbind_psi(); void storage_unbind_psi(); diff --git a/storage/mroonga/lib/libmrn_need_mysql_sources.am b/storage/mroonga/lib/libmrn_need_mysql_sources.am index 575f38adbd1..e8c03c63a92 100644 --- a/storage/mroonga/lib/libmrn_need_mysql_sources.am +++ b/storage/mroonga/lib/libmrn_need_mysql_sources.am @@ -28,4 +28,23 @@ libmrn_need_mysql_la_SOURCES = \ mrn_value_decoder.cpp \ mrn_value_decoder.hpp \ mrn_database_repairer.cpp \ - mrn_database_repairer.hpp + mrn_database_repairer.hpp \ + mrn_context_pool.cpp \ + mrn_context_pool.hpp \ + mrn_operations.cpp \ + mrn_operations.hpp \ + mrn_operation.cpp \ + mrn_operation.hpp \ + mrn_database.cpp \ + mrn_database.hpp \ + mrn_column_name.cpp \ + mrn_column_name.hpp \ + mrn_count_skip_checker.cpp \ + mrn_count_skip_checker.hpp \ + mrn_query_parser.cpp \ + mrn_query_parser.hpp \ + mrn_current_thread.hpp \ + mrn_smart_bitmap.cpp \ + mrn_smart_bitmap.hpp \ + mrn_table_fields_offset_mover.cpp \ + mrn_table_fields_offset_mover.hpp diff --git a/storage/mroonga/lib/mrn_column_name.cpp b/storage/mroonga/lib/mrn_column_name.cpp new file mode 100644 index 00000000000..e2e8f6d8f63 --- /dev/null +++ b/storage/mroonga/lib/mrn_column_name.cpp @@ -0,0 +1,69 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include + +#include "mrn_column_name.hpp" + +#include + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::ColumnName" + +namespace mrn { + ColumnName::ColumnName(const char *mysql_name) + : mysql_name_(mysql_name) { + encode(mysql_name, strlen(mysql_name)); + } + + ColumnName::ColumnName(const LEX_CSTRING &mysql_name) + : mysql_name_(mysql_name.str) { + encode(mysql_name.str, mysql_name.length); + } + + const char *ColumnName::mysql_name() { + return mysql_name_; + } + + const char *ColumnName::c_str() { + return name_; + } + + size_t ColumnName::length() { + return length_; + } + + void ColumnName::encode(const char *mysql_name, + size_t mysql_name_length) { + MRN_DBUG_ENTER_METHOD(); + uint errors; + length_ = mrn_strconvert(system_charset_info, + mysql_name, + mysql_name_length, + &my_charset_filename, + name_, + MRN_MAX_PATH_SIZE, + &errors); + name_[length_] = '\0'; + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_column_name.hpp b/storage/mroonga/lib/mrn_column_name.hpp new file mode 100644 index 00000000000..e68e0182f5e --- /dev/null +++ b/storage/mroonga/lib/mrn_column_name.hpp @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include + +namespace mrn { + class ColumnName { + public: + ColumnName(const char *mysql_name); + ColumnName(const LEX_CSTRING &mysql_name); + const char *mysql_name(); + const char *c_str(); + size_t length(); + private: + const char *mysql_name_; + char name_[MRN_MAX_PATH_SIZE]; + size_t length_; + + void encode(const char *mysql_name, size_t mysql_name_length); + }; +} diff --git a/storage/mroonga/lib/mrn_condition_converter.cpp b/storage/mroonga/lib/mrn_condition_converter.cpp index d1f0fe21615..579292a7f89 100644 --- a/storage/mroonga/lib/mrn_condition_converter.cpp +++ b/storage/mroonga/lib/mrn_condition_converter.cpp @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2013-2014 Kouhei Sutou + Copyright(C) 2013-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -175,7 +175,7 @@ namespace mrn { bool convertable = false; - enum_field_types field_type = field_item->field_type(); + enum_field_types field_type = field_item->field->real_type(); NormalizedType normalized_type = normalize_field_type(field_type); switch (normalized_type) { case STRING_TYPE: @@ -185,7 +185,12 @@ namespace mrn { } break; case INT_TYPE: - convertable = value_item->type() == Item::INT_ITEM; + if (field_type == MYSQL_TYPE_ENUM) { + convertable = (value_item->type() == Item::STRING_ITEM || + value_item->type() == Item::INT_ITEM); + } else { + convertable = value_item->type() == Item::INT_ITEM; + } break; case TIME_TYPE: if (is_valid_time_value(field_item, value_item)) { @@ -206,7 +211,7 @@ namespace mrn { bool convertable = false; - enum_field_types field_type = field_item->field_type(); + enum_field_types field_type = field_item->field->type(); NormalizedType normalized_type = normalize_field_type(field_type); switch (normalized_type) { case STRING_TYPE: @@ -251,7 +256,7 @@ namespace mrn { bool error; Item *real_value_item = value_item->real_item(); - switch (field_item->field_type()) { + switch (field_item->field->type()) { case MYSQL_TYPE_TIME: error = real_value_item->get_time(mysql_time); break; @@ -355,6 +360,11 @@ namespace mrn { case MYSQL_TYPE_VARCHAR_COMPRESSED: case MYSQL_TYPE_BLOB_COMPRESSED: DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + type = STRING_TYPE; + break; +#endif } DBUG_RETURN(type); @@ -407,11 +417,11 @@ namespace mrn { DBUG_RETURN(have); } - const Item_func *ConditionConverter::find_match_against(const Item *item) { + unsigned int ConditionConverter::count_match_against(const Item *item) { MRN_DBUG_ENTER_METHOD(); if (!item) { - DBUG_RETURN(NULL); + DBUG_RETURN(0); } switch (item->type()) { @@ -419,14 +429,13 @@ namespace mrn { if (is_storage_mode_) { Item_cond *cond_item = (Item_cond *)item; if (cond_item->functype() == Item_func::COND_AND_FUNC) { + unsigned int n_match_againsts = 0; List_iterator iterator(*((cond_item)->argument_list())); const Item *sub_item; while ((sub_item = iterator++)) { - const Item_func *match_against = find_match_against(sub_item); - if (match_against) { - DBUG_RETURN(match_against); - } + n_match_againsts += count_match_against(sub_item); } + DBUG_RETURN(n_match_againsts); } } break; @@ -435,7 +444,7 @@ namespace mrn { const Item_func *func_item = (const Item_func *)item; switch (func_item->functype()) { case Item_func::FT_FUNC: - DBUG_RETURN(func_item); + DBUG_RETURN(1); break; default: break; @@ -446,7 +455,7 @@ namespace mrn { break; } - DBUG_RETURN(NULL); + DBUG_RETURN(0); } void ConditionConverter::convert(const Item *where, grn_obj *expression) { @@ -563,7 +572,7 @@ namespace mrn { grn_obj *expression) { MRN_DBUG_ENTER_METHOD(); - enum_field_types field_type = field_item->field_type(); + enum_field_types field_type = field_item->field->real_type(); NormalizedType normalized_type = normalize_field_type(field_type); switch (normalized_type) { @@ -577,7 +586,21 @@ namespace mrn { break; case INT_TYPE: grn_obj_reinit(ctx_, &value_, GRN_DB_INT64, 0); - GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + if (field_type == MYSQL_TYPE_ENUM) { + if (const_item->type() == Item::STRING_ITEM) { + String *string; + string = const_item->val_str(NULL); + Field_enum *enum_field = static_cast(field_item->field); + int enum_value = find_type(string->c_ptr(), + enum_field->typelib, + FIND_TYPE_BASIC); + GRN_INT64_SET(ctx_, &value_, enum_value); + } else { + GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + } + } else { + GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + } break; case TIME_TYPE: grn_obj_reinit(ctx_, &value_, GRN_DB_TIME, 0); diff --git a/storage/mroonga/lib/mrn_condition_converter.hpp b/storage/mroonga/lib/mrn_condition_converter.hpp index 3a7fbd048dc..f8a48b6209a 100644 --- a/storage/mroonga/lib/mrn_condition_converter.hpp +++ b/storage/mroonga/lib/mrn_condition_converter.hpp @@ -33,7 +33,7 @@ namespace mrn { ~ConditionConverter(); bool is_convertable(const Item *item); - const Item_func *find_match_against(const Item *item); + unsigned int count_match_against(const Item *item); // caller must check "where" can be convertable by // is_convertable(). This method doesn't validate "where". void convert(const Item *where, grn_obj *expression); diff --git a/storage/mroonga/lib/mrn_context_pool.cpp b/storage/mroonga/lib/mrn_context_pool.cpp new file mode 100644 index 00000000000..a6000df29e3 --- /dev/null +++ b/storage/mroonga/lib/mrn_context_pool.cpp @@ -0,0 +1,120 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_context_pool.hpp" +#include "mrn_lock.hpp" + +#include + +namespace mrn { + // for debug +#define MRN_CLASS_NAME "mrn::ContextPool::Impl" + + class ContextPool::Impl { + public: + Impl(mysql_mutex_t *mutex) + : mutex_(mutex), + pool_(NULL), + last_pull_time_(0) { + } + + ~Impl(void) { + clear(); + } + + grn_ctx *pull(void) { + MRN_DBUG_ENTER_METHOD(); + grn_ctx *ctx = NULL; + + { + time_t now; + time(&now); + + mrn::Lock lock(mutex_); + if (pool_) { + ctx = static_cast(pool_->data); + list_pop(pool_); + if ((uint) (now - last_pull_time_) >= CLEAR_THREATHOLD_IN_SECONDS) { + clear(); + } + } + last_pull_time_ = now; + } + + if (!ctx) { + ctx = grn_ctx_open(0); + } + + DBUG_RETURN(ctx); + } + + void release(grn_ctx *ctx) { + MRN_DBUG_ENTER_METHOD(); + + { + mrn::Lock lock(mutex_); + list_push(pool_, ctx); + grn_ctx_use(ctx, NULL); + } + + DBUG_VOID_RETURN; + } + + private: + static const unsigned int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5; + + mysql_mutex_t *mutex_; + LIST *pool_; + time_t last_pull_time_; + + void clear(void) { + MRN_DBUG_ENTER_METHOD(); + while (pool_) { + grn_ctx *ctx = static_cast(pool_->data); + grn_ctx_close(ctx); + list_pop(pool_); + } + DBUG_VOID_RETURN; + } + }; + + // For debug +#undef MRN_CLASS_NAME +#define MRN_CLASS_NAME "mrn::ContextPool" + + ContextPool::ContextPool(mysql_mutex_t *mutex) + : impl_(new Impl(mutex)) { + } + + ContextPool::~ContextPool(void) { + delete impl_; + } + + grn_ctx *ContextPool::pull(void) { + MRN_DBUG_ENTER_METHOD(); + grn_ctx *ctx = impl_->pull(); + DBUG_RETURN(ctx); + } + + void ContextPool::release(grn_ctx *ctx) { + MRN_DBUG_ENTER_METHOD(); + impl_->release(ctx); + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_context_pool.hpp b/storage/mroonga/lib/mrn_context_pool.hpp new file mode 100644 index 00000000000..4c64933ac81 --- /dev/null +++ b/storage/mroonga/lib/mrn_context_pool.hpp @@ -0,0 +1,41 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_CONTEXT_POOL_HPP_ +#define MRN_CONTEXT_POOL_HPP_ + +#include + +#include + +namespace mrn { + class ContextPool { + public: + ContextPool(mysql_mutex_t *mutex); + ~ContextPool(void); + grn_ctx *pull(void); + void release(grn_ctx *context); + + private: + class Impl; + Impl *impl_; + }; +} + +#endif /* MRN_CONTEXT_POOL_HPP_ */ diff --git a/storage/mroonga/lib/mrn_count_skip_checker.cpp b/storage/mroonga/lib/mrn_count_skip_checker.cpp new file mode 100644 index 00000000000..07852d9dda6 --- /dev/null +++ b/storage/mroonga/lib/mrn_count_skip_checker.cpp @@ -0,0 +1,303 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_count_skip_checker.hpp" + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::CountSkipChecker" + +namespace mrn { + CountSkipChecker::CountSkipChecker(grn_ctx *ctx, + TABLE *table, + SELECT_LEX *select_lex, + KEY *key_info, + key_part_map target_key_part_map, + bool is_storage_mode) + : ctx_(ctx), + table_(table), + select_lex_(select_lex), + key_info_(key_info), + target_key_part_map_(target_key_part_map), + is_storage_mode_(is_storage_mode) { + } + + CountSkipChecker::~CountSkipChecker() { + } + + bool CountSkipChecker::check() { + MRN_DBUG_ENTER_METHOD(); + + if (select_lex_->item_list.elements != 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not only one item: %u", + select_lex_->item_list.elements); + DBUG_RETURN(false); + } + if (select_lex_->group_list.elements > 0) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] have groups: %u", + select_lex_->group_list.elements); + DBUG_RETURN(false); + } + if (MRN_SELECT_LEX_GET_HAVING_COND(select_lex_)) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] have HAVING"); + DBUG_RETURN(false); + } + if (select_lex_->table_list.elements != 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not only one table: %u", + select_lex_->table_list.elements); + DBUG_RETURN(false); + } + + Item *info = static_cast(select_lex_->item_list.first_node()->info); + if (info->type() != Item::SUM_FUNC_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] item isn't sum function: %u", + info->type()); + DBUG_RETURN(false); + } + Item_sum *sum_item = static_cast(info); + if (sum_item->sum_func() != Item_sum::COUNT_FUNC) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not COUNT: %u", + sum_item->sum_func()); + DBUG_RETURN(false); + } + if (ITEM_SUM_GET_NEST_LEVEL(sum_item) != 0 || + ITEM_SUM_GET_AGGR_LEVEL(sum_item) != 0 || + ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) != -1 || + sum_item->max_sum_func_level != -1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not simple COUNT(*): %d:%d:%d:%d", + ITEM_SUM_GET_NEST_LEVEL(sum_item), + ITEM_SUM_GET_AGGR_LEVEL(sum_item), + ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item), + sum_item->max_sum_func_level); + DBUG_RETURN(false); + } + + Item *where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex_); + if (!where) { + if (is_storage_mode_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] no condition"); + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] no condition with wrapper mode"); + DBUG_RETURN(false); + } + } + + bool skippable = is_skippable(where); + DBUG_RETURN(skippable); + } + + bool CountSkipChecker::is_skippable(Item *where) { + MRN_DBUG_ENTER_METHOD(); + + bool skippable = false; + switch (where->type()) { + case Item::COND_ITEM: + { + Item_cond *cond_item = static_cast(where); + skippable = is_skippable(cond_item); + if (skippable) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] skippable multiple conditions"); + } + } + break; + case Item::FUNC_ITEM: + { + Item_func *func_item = static_cast(where); + if (func_item->functype() == Item_func::FT_FUNC) { + if (select_lex_->select_n_where_fields == 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] " + "only one full text search condition"); + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "full text search condition and more conditions: %u", + select_lex_->select_n_where_fields); + DBUG_RETURN(false); + } + } else { + skippable = is_skippable(func_item); + if (skippable) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] skippable condition"); + } + } + } + break; + default: + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] unsupported top level item: %u", + where->type()); + break; + } + + DBUG_RETURN(skippable); + } + + bool CountSkipChecker::is_skippable(Item_cond *cond_item) { + MRN_DBUG_ENTER_METHOD(); + + List_iterator iterator(*(cond_item->argument_list())); + Item *sub_item; + while ((sub_item = iterator++)) { + if (sub_item->type() != Item::FUNC_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "sub condition isn't function item: %u", + sub_item->type()); + DBUG_RETURN(false); + } + if (!is_skippable(static_cast(sub_item))) { + DBUG_RETURN(false); + } + } + DBUG_RETURN(true); + } + + bool CountSkipChecker::is_skippable(Item_func *func_item) { + MRN_DBUG_ENTER_METHOD(); + + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + case Item_func::EQUAL_FUNC: + case Item_func::NE_FUNC: + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GE_FUNC: + case Item_func::GT_FUNC: + { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + if (left_item->type() != Item::FIELD_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not field: %u:%u", + func_item->functype(), + left_item->type()); + DBUG_RETURN(false); + } + + bool skippable = is_skippable(static_cast(left_item)); + DBUG_RETURN(skippable); + } + break; + case Item_func::BETWEEN: + { + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + if (target_item->type() != Item::FIELD_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] BETWEEN target isn't field: %u", + target_item->type()); + DBUG_RETURN(false); + } + + bool skippable = is_skippable(static_cast(target_item)); + DBUG_RETURN(skippable); + } + break; + case Item_func::MULT_EQUAL_FUNC: +#ifdef MRN_HAVE_ITEM_EQUAL_FIELDS_ITERATOR + { + Item_equal *equal_item = static_cast(func_item); + Item_equal_fields_iterator iterator(*equal_item); + Item *field_item; + while ((field_item = iterator++)) { + bool skippable = is_skippable(static_cast(field_item)); + if (!skippable) { + DBUG_RETURN(skippable); + } + } + DBUG_RETURN(true); + } +#endif + break; + default: + break; + } + + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] unsupported function item: %u", + func_item->functype()); + DBUG_RETURN(false); + } + + bool CountSkipChecker::is_skippable(Item_field *field_item) { + MRN_DBUG_ENTER_METHOD(); + + Field *field = field_item->field; + if (!field) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] field is missing"); + DBUG_RETURN(false); + } + + if (field->table != table_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] external table's field"); + DBUG_RETURN(false); + } + + if (!key_info_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] no active index: <%s>:<%s>", + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } + + uint i; + KEY_PART_INFO *key_part = key_info_->key_part; + for (i = 0; i < KEY_N_KEY_PARTS(key_info_); i++) { + if (key_part[i].field == field) { + if ((target_key_part_map_ >> i) & 1) { + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "field's index are out of key part map: %u:%lu: <%s>:<%s>", + i, + target_key_part_map_, + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } + } + } + + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] field isn't indexed: <%s>:<%s>", + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } +} diff --git a/storage/mroonga/lib/mrn_count_skip_checker.hpp b/storage/mroonga/lib/mrn_count_skip_checker.hpp new file mode 100644 index 00000000000..b813ecdcc08 --- /dev/null +++ b/storage/mroonga/lib/mrn_count_skip_checker.hpp @@ -0,0 +1,57 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_COUNT_SKIP_CHECKER_HPP_ +#define MRN_COUNT_SKIP_CHECKER_HPP_ + +#include + +#include + +#include + +namespace mrn { + class CountSkipChecker { + public: + CountSkipChecker(grn_ctx *ctx, + TABLE *table, + SELECT_LEX *select_lex, + KEY *key_info, + key_part_map target_key_part_map, + bool is_storage_mode); + ~CountSkipChecker(); + + bool check(); + + private: + grn_ctx *ctx_; + TABLE *table_; + SELECT_LEX *select_lex_; + KEY *key_info_; + key_part_map target_key_part_map_; + bool is_storage_mode_; + + bool is_skippable(Item *where); + bool is_skippable(Item_cond *cond_item); + bool is_skippable(Item_func *func_item); + bool is_skippable(Item_field *field_item); + }; +} + +#endif /* MRN_COUNT_SKIP_CHECKER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_current_thread.hpp b/storage/mroonga/lib/mrn_current_thread.hpp new file mode 100644 index 00000000000..367057fce66 --- /dev/null +++ b/storage/mroonga/lib/mrn_current_thread.hpp @@ -0,0 +1,27 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# include +#endif diff --git a/storage/mroonga/lib/mrn_database.cpp b/storage/mroonga/lib/mrn_database.cpp new file mode 100644 index 00000000000..52e315e1b77 --- /dev/null +++ b/storage/mroonga/lib/mrn_database.cpp @@ -0,0 +1,89 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_database.hpp" +#include "mrn_operations.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Database" + +namespace mrn { + Database::Database(grn_ctx *ctx, grn_obj *db) + : ctx_(ctx), + db_(db), + broken_table_names_(NULL), + is_broken_(false) { + Operations operations(ctx_); + broken_table_names_ = operations.collect_processing_table_names(); + is_broken_ = operations.is_locked(); + } + + Database::~Database(void) { + close(); + } + + void Database::close() { + MRN_DBUG_ENTER_METHOD(); + if (db_) { + grn_hash_close(ctx_, broken_table_names_); + broken_table_names_ = NULL; + grn_obj_close(ctx_, db_); + db_ = NULL; + } + DBUG_VOID_RETURN; + } + + grn_rc Database::remove() { + MRN_DBUG_ENTER_METHOD(); + grn_rc rc = GRN_SUCCESS; + if (db_) { + grn_hash_close(ctx_, broken_table_names_); + broken_table_names_ = NULL; + rc = grn_obj_remove(ctx_, db_); + if (rc == GRN_SUCCESS) { + db_ = NULL; + } + } + DBUG_RETURN(rc); + } + + grn_obj *Database::get() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(db_); + } + + bool Database::is_broken() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(is_broken_); + } + + bool Database::is_broken_table(const char *name, size_t name_size) { + MRN_DBUG_ENTER_METHOD(); + grn_id id = grn_hash_get(ctx_, broken_table_names_, name, name_size, NULL); + DBUG_RETURN(id != GRN_ID_NIL); + } + + void Database::mark_table_repaired(const char *name, size_t name_size) { + MRN_DBUG_ENTER_METHOD(); + grn_hash_delete(ctx_, broken_table_names_, name, name_size, NULL); + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_database.hpp b/storage/mroonga/lib/mrn_database.hpp new file mode 100644 index 00000000000..c2c7e460b58 --- /dev/null +++ b/storage/mroonga/lib/mrn_database.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_DATABASE_HPP_ +#define MRN_DATABASE_HPP_ + +#include + +namespace mrn { + class Database { + public: + Database(grn_ctx *ctx, grn_obj *db); + ~Database(void); + + void close(); + grn_rc remove(); + grn_obj *get(); + + bool is_broken(); + bool is_broken_table(const char *name, size_t name_size); + void mark_table_repaired(const char *name, size_t name_size); + + private: + grn_ctx *ctx_; + grn_obj *db_; + grn_hash *broken_table_names_; + bool is_broken_; + }; +} + +#endif /* MRN_DATABASE_HPP_ */ diff --git a/storage/mroonga/lib/mrn_database_manager.cpp b/storage/mroonga/lib/mrn_database_manager.cpp index 753d1551ff4..d52d2639d7d 100644 --- a/storage/mroonga/lib/mrn_database_manager.cpp +++ b/storage/mroonga/lib/mrn_database_manager.cpp @@ -56,9 +56,9 @@ namespace mrn { if (cache_) { void *db_address; GRN_HASH_EACH(ctx_, cache_, id, NULL, 0, &db_address, { - grn_obj *db; + Database *db; memcpy(&db, db_address, sizeof(grn_obj *)); - grn_obj_unlink(ctx_, db); + delete db; }); grn_hash_close(ctx_, cache_); } @@ -80,7 +80,7 @@ namespace mrn { DBUG_RETURN(true); } - int DatabaseManager::open(const char *path, grn_obj **db) { + int DatabaseManager::open(const char *path, Database **db) { MRN_DBUG_ENTER_METHOD(); int error = 0; @@ -100,36 +100,54 @@ namespace mrn { mapper.db_name(), strlen(mapper.db_name()), &db_address); if (id == GRN_ID_NIL) { + grn_obj *grn_db; struct stat db_stat; if (stat(mapper.db_path(), &db_stat)) { GRN_LOG(ctx_, GRN_LOG_INFO, "database not found. creating...: <%s>", mapper.db_path()); if (path[0] == FN_CURLIB && - (path[1] == FN_LIBCHAR || path[1] == FN_LIBCHAR2)) { + mrn_is_directory_separator(path[1])) { ensure_database_directory(); } - *db = grn_db_create(ctx_, mapper.db_path(), NULL); + grn_db = grn_db_create(ctx_, mapper.db_path(), NULL); if (ctx_->rc) { error = ER_CANT_CREATE_TABLE; my_message(error, ctx_->errbuf, MYF(0)); DBUG_RETURN(error); } } else { - *db = grn_db_open(ctx_, mapper.db_path()); + grn_db = grn_db_open(ctx_, mapper.db_path()); if (ctx_->rc) { error = ER_CANT_OPEN_FILE; my_message(error, ctx_->errbuf, MYF(0)); DBUG_RETURN(error); } } + *db = new Database(ctx_, grn_db); grn_hash_add(ctx_, cache_, mapper.db_name(), strlen(mapper.db_name()), &db_address, NULL); - memcpy(db_address, db, sizeof(grn_obj *)); - error = ensure_normalizers_registered(*db); + memcpy(db_address, db, sizeof(Database *)); + error = ensure_normalizers_registered((*db)->get()); + if (!error) { + if ((*db)->is_broken()) { + error = ER_CANT_OPEN_FILE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: database: open: " + "The database maybe broken. " + "We recommend you to recreate the database. " + "If the database isn't broken, " + "you can remove this error by running " + "'groonga %s table_remove mroonga_operations' " + "on server. But the latter isn't recommended.", + mapper.db_path()); + my_message(error, error_message, MYF(0)); + } + } } else { - memcpy(db, db_address, sizeof(grn_obj *)); - grn_ctx_use(ctx_, *db); + memcpy(db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, (*db)->get()); } DBUG_RETURN(error); @@ -150,10 +168,11 @@ namespace mrn { DBUG_VOID_RETURN; } - grn_obj *db = NULL; - memcpy(&db, db_address, sizeof(grn_obj *)); + Database *db = NULL; + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); if (db) { - grn_obj_close(ctx_, db); + delete db; } grn_hash_delete_by_id(ctx_, cache_, id, NULL); @@ -173,29 +192,35 @@ namespace mrn { mapper.db_name(), strlen(mapper.db_name()), &db_address); - grn_obj *db = NULL; + Database *db = NULL; if (id == GRN_ID_NIL) { struct stat dummy; if (stat(mapper.db_path(), &dummy) == 0) { - db = grn_db_open(ctx_, mapper.db_path()); + grn_obj *grn_db = grn_db_open(ctx_, mapper.db_path()); + db = new Database(ctx_, grn_db); } } else { - memcpy(&db, db_address, sizeof(grn_obj *)); + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); } if (!db) { DBUG_RETURN(false); } - if (grn_obj_remove(ctx_, db) == GRN_SUCCESS) { + if (db->remove() == GRN_SUCCESS) { if (id != GRN_ID_NIL) { grn_hash_delete_by_id(ctx_, cache_, id, NULL); } + delete db; DBUG_RETURN(true); } else { GRN_LOG(ctx_, GRN_LOG_ERROR, "failed to drop database: <%s>: <%s>", mapper.db_path(), ctx_->errbuf); + if (id == GRN_ID_NIL) { + delete db; + } DBUG_RETURN(false); } } @@ -223,22 +248,28 @@ namespace mrn { break; } void *db_address; - grn_obj *db; + Database *db; grn_hash_cursor_get_value(ctx_, cursor, &db_address); - memcpy(&db, db_address, sizeof(grn_obj *)); + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); grn_rc rc = grn_hash_cursor_delete(ctx_, cursor, NULL); if (rc) { error = ER_ERROR_ON_READ; my_message(error, ctx_->errbuf, MYF(0)); break; } - grn_obj_close(ctx_, db); + delete db; } grn_hash_cursor_close(ctx_, cursor); DBUG_RETURN(error); } + const char *DatabaseManager::error_message() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(ctx_->errbuf); + } + void DatabaseManager::mkdir_p(const char *directory) { MRN_DBUG_ENTER_METHOD(); @@ -246,8 +277,7 @@ namespace mrn { char sub_directory[MRN_MAX_PATH_SIZE]; sub_directory[0] = '\0'; while (true) { - if (directory[i] == FN_LIBCHAR || - directory[i] == FN_LIBCHAR2 || + if (mrn_is_directory_separator(directory[i]) || directory[i] == '\0') { sub_directory[i] = '\0'; struct stat directory_status; @@ -290,8 +320,10 @@ namespace mrn { const char *last_path_separator; last_path_separator = strrchr(path_prefix, FN_LIBCHAR); +#ifdef FN_LIBCHAR2 if (!last_path_separator) last_path_separator = strrchr(path_prefix, FN_LIBCHAR2); +#endif if (!last_path_separator) DBUG_VOID_RETURN; if (path_prefix == last_path_separator) diff --git a/storage/mroonga/lib/mrn_database_manager.hpp b/storage/mroonga/lib/mrn_database_manager.hpp index 76c76dab6d5..877b7ca889a 100644 --- a/storage/mroonga/lib/mrn_database_manager.hpp +++ b/storage/mroonga/lib/mrn_database_manager.hpp @@ -22,6 +22,8 @@ #ifndef MRN_DATABASE_MANAGER_HPP_ #define MRN_DATABASE_MANAGER_HPP_ +#include "mrn_database.hpp" + #include namespace mrn { @@ -30,10 +32,11 @@ namespace mrn { DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex); ~DatabaseManager(void); bool init(void); - int open(const char *path, grn_obj **db); + int open(const char *path, Database **db); void close(const char *path); bool drop(const char *path); int clear(void); + const char *error_message(); private: grn_ctx *ctx_; diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp index f04c027f8bb..47badbd8b93 100644 --- a/storage/mroonga/lib/mrn_database_repairer.cpp +++ b/storage/mroonga/lib/mrn_database_repairer.cpp @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015 Kouhei Sutou + Copyright(C) 2015-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -36,6 +36,16 @@ #endif namespace mrn { + struct CheckResult { + CheckResult() : + is_crashed(false), + is_corrupt(false) { + } + + bool is_crashed; + bool is_corrupt; + }; + DatabaseRepairer::DatabaseRepairer(grn_ctx *ctx, THD *thd) : ctx_(ctx), thd_(thd), @@ -53,10 +63,19 @@ namespace mrn { bool DatabaseRepairer::is_crashed(void) { MRN_DBUG_ENTER_METHOD(); - bool is_crashed = false; - each_database(&DatabaseRepairer::is_crashed_body, &is_crashed); + CheckResult result; + each_database(&DatabaseRepairer::check_body, &result); - DBUG_RETURN(is_crashed); + DBUG_RETURN(result.is_crashed); + } + + bool DatabaseRepairer::is_corrupt(void) { + MRN_DBUG_ENTER_METHOD(); + + CheckResult result; + each_database(&DatabaseRepairer::check_body, &result); + + DBUG_RETURN(result.is_corrupt); } bool DatabaseRepairer::repair(void) { @@ -81,9 +100,19 @@ namespace mrn { DBUG_VOID_RETURN; } - do { - each_database_body(data.cFileName, each_body_func, user_data); - } while (FindNextFile(finder, &data) != 0); + grn_ctx ctx; + grn_rc rc = grn_ctx_init(&ctx, 0); + if (rc == GRN_SUCCESS) { + do { + each_database_body(data.cFileName, &ctx, each_body_func, user_data); + } while (FindNextFile(finder, &data) != 0); + grn_ctx_fin(&ctx); + } else { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "[mroonga][database][repairer][each] " + "failed to initialize grn_ctx: %d: %s", + rc, grn_rc_to_string(rc)); + } FindClose(finder); #else DIR *dir = opendir(base_directory_); @@ -91,8 +120,18 @@ namespace mrn { DBUG_VOID_RETURN; } - while (struct dirent *entry = readdir(dir)) { - each_database_body(entry->d_name, each_body_func, user_data); + grn_ctx ctx; + grn_rc rc = grn_ctx_init(&ctx, 0); + if (rc == GRN_SUCCESS) { + while (struct dirent *entry = readdir(dir)) { + each_database_body(entry->d_name, &ctx, each_body_func, user_data); + } + grn_ctx_fin(&ctx); + } else { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "[mroonga][database][repairer][each] " + "failed to initialize grn_ctx: %d: %s", + rc, grn_rc_to_string(rc)); } closedir(dir); #endif @@ -101,6 +140,7 @@ namespace mrn { } void DatabaseRepairer::each_database_body(const char *base_path, + grn_ctx *ctx, EachBodyFunc each_body_func, void *user_data) { MRN_DBUG_ENTER_METHOD(); @@ -123,14 +163,14 @@ namespace mrn { char db_path[MRN_MAX_PATH_SIZE]; snprintf(db_path, MRN_MAX_PATH_SIZE, "%s%c%s", base_directory_, FN_LIBCHAR, base_path); - grn_obj *db = grn_db_open(ctx_, db_path); + grn_obj *db = grn_db_open(ctx, db_path); if (!db) { DBUG_VOID_RETURN; } - (this->*each_body_func)(db, db_path, user_data); + (this->*each_body_func)(ctx, db, db_path, user_data); - grn_obj_close(ctx_, db); + grn_obj_close(ctx, db); DBUG_VOID_RETURN; } @@ -150,8 +190,7 @@ namespace mrn { size_t raw_path_prefix_length = strlen(raw_path_prefix); size_t separator_position = raw_path_prefix_length; for (; separator_position > 0; separator_position--) { - if (base_directory_buffer_[separator_position] == FN_LIBCHAR || - base_directory_buffer_[separator_position] == FN_LIBCHAR2) { + if (mrn_is_directory_separator(base_directory_buffer_[separator_position])) { break; } } @@ -169,34 +208,46 @@ namespace mrn { DBUG_VOID_RETURN; } - void DatabaseRepairer::is_crashed_body(grn_obj *db, - const char *db_path, - void *user_data) { + void DatabaseRepairer::check_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data) { MRN_DBUG_ENTER_METHOD(); - bool *is_crashed = static_cast(user_data); + CheckResult *result = static_cast(user_data); - if (grn_obj_is_locked(ctx_, db)) { - *is_crashed = true; + if (grn_obj_is_locked(ctx, db)) { + result->is_crashed = true; + result->is_corrupt = true; DBUG_VOID_RETURN; } grn_table_cursor *cursor; - cursor = grn_table_cursor_open(ctx_, db, + cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1, GRN_CURSOR_BY_ID); if (!cursor) { - *is_crashed = true; + result->is_crashed = true; + result->is_corrupt = true; DBUG_VOID_RETURN; } grn_id id; - while ((id = grn_table_cursor_next(ctx_, cursor)) != GRN_ID_NIL) { - grn_obj *object = grn_ctx_at(ctx_, id); + while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) { + if (grn_id_is_builtin(ctx, id)) { + continue; + } + + grn_obj *object = grn_ctx_at(ctx, id); if (!object) { - continue; + if (ctx->rc == GRN_SUCCESS) { + continue; + } else { + result->is_corrupt = true; + break; + } } switch (object->header.type) { @@ -207,37 +258,40 @@ namespace mrn { case GRN_COLUMN_FIX_SIZE: case GRN_COLUMN_VAR_SIZE: case GRN_COLUMN_INDEX: - grn_obj_is_locked(ctx_, object); - *is_crashed = true; + if (grn_obj_is_locked(ctx_, object)) { + result->is_crashed = true; + result->is_corrupt = true; + } break; default: break; } - grn_obj_unlink(ctx_, object); + grn_obj_unlink(ctx, object); - if (*is_crashed) { + if (result->is_crashed || result->is_corrupt) { break; } } - grn_table_cursor_close(ctx_, cursor); + grn_table_cursor_close(ctx, cursor); DBUG_VOID_RETURN; } - void DatabaseRepairer::repair_body(grn_obj *db, + void DatabaseRepairer::repair_body(grn_ctx *ctx, + grn_obj *db, const char *db_path, void *user_data) { MRN_DBUG_ENTER_METHOD(); bool *succeeded = static_cast(user_data); - if (grn_db_recover(ctx_, db) != GRN_SUCCESS) { + if (grn_db_recover(ctx, db) != GRN_SUCCESS) { push_warning_printf(thd_, MRN_SEVERITY_WARNING, ER_NOT_KEYFILE, "mroonga: repair: " "Failed to recover database: <%s>: <%s>", - db_path, ctx_->errbuf); + db_path, ctx->errbuf); *succeeded = false; } diff --git a/storage/mroonga/lib/mrn_database_repairer.hpp b/storage/mroonga/lib/mrn_database_repairer.hpp index 12e2bbc9c79..d46ae838072 100644 --- a/storage/mroonga/lib/mrn_database_repairer.hpp +++ b/storage/mroonga/lib/mrn_database_repairer.hpp @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015 Kouhei Sutou + Copyright(C) 2015-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,7 @@ namespace mrn { DatabaseRepairer(grn_ctx *ctx, THD *thd); ~DatabaseRepairer(void); bool is_crashed(void); + bool is_corrupt(void); bool repair(void); private: @@ -40,18 +41,26 @@ namespace mrn { size_t path_prefix_length_; size_t mrn_db_file_suffix_length_; - typedef void (DatabaseRepairer::*EachBodyFunc)(grn_obj *db, + typedef void (DatabaseRepairer::*EachBodyFunc)(grn_ctx *ctx, + grn_obj *db, const char *db_path, void *user_data); void each_database(EachBodyFunc each_body_func, void *user_data); void each_database_body(const char *base_path, + grn_ctx *ctx, EachBodyFunc each_body_func, void *user_data); void detect_paths(void); - void is_crashed_body(grn_obj *db, const char *db_path, void *user_data); - void repair_body(grn_obj *db, const char *db_path, void *user_data); + void check_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data); + void repair_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data); }; } diff --git a/storage/mroonga/lib/mrn_index_table_name.cpp b/storage/mroonga/lib/mrn_index_table_name.cpp index a4a687c7996..1cc510ad7db 100644 --- a/storage/mroonga/lib/mrn_index_table_name.cpp +++ b/storage/mroonga/lib/mrn_index_table_name.cpp @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2011 Kentoku SHIBA - Copyright(C) 2011-2012 Kouhei Sutou + Copyright(C) 2011-2015 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,8 @@ #define MRN_CLASS_NAME "mrn::IndexTableName" namespace mrn { - const char *IndexTableName::SEPARATOR = "-"; + const char *IndexTableName::SEPARATOR = "#"; + const char *IndexTableName::OLD_SEPARATOR = "-"; bool IndexTableName::is_custom_name(const char *table_name, size_t table_name_length, @@ -43,9 +44,12 @@ namespace mrn { DBUG_RETURN(true); } - if (strncmp(SEPARATOR, - index_table_name + table_name_length, - strlen(SEPARATOR)) != 0) { + if ((strncmp(OLD_SEPARATOR, + index_table_name + table_name_length, + strlen(OLD_SEPARATOR)) != 0) && + (strncmp(SEPARATOR, + index_table_name + table_name_length, + strlen(SEPARATOR)) != 0)) { DBUG_RETURN(true); } @@ -63,6 +67,12 @@ namespace mrn { encoded_mysql_index_name_multibyte + MRN_MAX_KEY_SIZE, mysql_index_name_multibyte, mysql_index_name_multibyte + strlen(mysql_index_name_)); + snprintf(old_name_, MRN_MAX_KEY_SIZE, + "%s%s%s", + table_name_, + OLD_SEPARATOR, + encoded_mysql_index_name_multibyte); + old_length_ = strlen(old_name_); snprintf(name_, MRN_MAX_KEY_SIZE, "%s%s%s", table_name_, @@ -79,6 +89,14 @@ namespace mrn { return length_; } + const char *IndexTableName::old_c_str() { + return old_name_; + } + + size_t IndexTableName::old_length() { + return old_length_; + } + uint IndexTableName::encode(uchar *encoded_start, uchar *encoded_end, const uchar *mysql_string_start, diff --git a/storage/mroonga/lib/mrn_index_table_name.hpp b/storage/mroonga/lib/mrn_index_table_name.hpp index c4f16228610..abaccfae220 100644 --- a/storage/mroonga/lib/mrn_index_table_name.hpp +++ b/storage/mroonga/lib/mrn_index_table_name.hpp @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2011 Kentoku SHIBA - Copyright(C) 2011-2012 Kouhei Sutou + Copyright(C) 2011-2015 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,6 +27,7 @@ namespace mrn { class IndexTableName { public: static const char *SEPARATOR; + static const char *OLD_SEPARATOR; static bool is_custom_name(const char *table_name, size_t table_name_length, @@ -36,9 +37,13 @@ namespace mrn { IndexTableName(const char *table_name, const char *mysql_index_name); const char *c_str(); size_t length(); + const char *old_c_str(); + size_t old_length(); private: const char *table_name_; const char *mysql_index_name_; + char old_name_[MRN_MAX_KEY_SIZE]; + size_t old_length_; char name_[MRN_MAX_KEY_SIZE]; size_t length_; diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp index d189a31c5de..b2e0e0444b8 100644 --- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -288,6 +288,7 @@ namespace mrn { decode_long_long_int(current_grn_key, &grn_time); TimeConverter time_converter; MYSQL_TIME mysql_time; + mysql_time.neg = FALSE; mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME; time_converter.grn_time_to_mysql_time(grn_time, &mysql_time); long long int mysql_datetime_packed = @@ -521,6 +522,14 @@ namespace mrn { case MYSQL_TYPE_VARCHAR_COMPRESSED: case MYSQL_TYPE_BLOB_COMPRESSED: DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_JSON")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif } DBUG_VOID_RETURN; } diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp index 2b3f935d4e4..14003cda9f5 100644 --- a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp @@ -20,11 +20,11 @@ #ifndef MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ #define MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ -#include - #include #include +#include + namespace mrn { class MultipleColumnKeyCodec { public: diff --git a/storage/mroonga/lib/mrn_operation.cpp b/storage/mroonga/lib/mrn_operation.cpp new file mode 100644 index 00000000000..2dab41108a7 --- /dev/null +++ b/storage/mroonga/lib/mrn_operation.cpp @@ -0,0 +1,51 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_operation.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Operation" + +namespace mrn { + Operation::Operation(mrn::Operations *operations, + const char *type, + const char *table_name, + size_t table_name_size) + : operations_(operations), + id_(operations_->start(type, table_name, table_name_size)) { + } + + Operation::~Operation() { + MRN_DBUG_ENTER_METHOD(); + + operations_->finish(id_); + + DBUG_VOID_RETURN; + } + + void Operation::record_target(grn_id record_id) { + MRN_DBUG_ENTER_METHOD(); + + operations_->record_target(id_, record_id); + + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_operation.hpp b/storage/mroonga/lib/mrn_operation.hpp new file mode 100644 index 00000000000..899c92e9508 --- /dev/null +++ b/storage/mroonga/lib/mrn_operation.hpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_OPERATION_HPP_ +#define MRN_OPERATION_HPP_ + +#include + +namespace mrn { + class Operation { + public: + Operation(mrn::Operations *operations, + const char *type, + const char *table_name, + size_t table_name_size); + ~Operation(); + + void record_target(grn_id record_id); + + private: + mrn::Operations *operations_; + grn_id id_; + }; +} + +#endif /* MRN_OPERATION_HPP_ */ diff --git a/storage/mroonga/lib/mrn_operations.cpp b/storage/mroonga/lib/mrn_operations.cpp new file mode 100644 index 00000000000..572907cdc55 --- /dev/null +++ b/storage/mroonga/lib/mrn_operations.cpp @@ -0,0 +1,401 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include + +#include "mrn_operations.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Operations" + +#define TABLE_NAME "mroonga_operations" +#define COLUMN_TYPE_NAME "type" +#define COLUMN_TABLE_NAME "table" +#define COLUMN_RECORD_NAME "record" + +namespace mrn { + Operations::Operations(grn_ctx *ctx) + : ctx_(ctx) { + MRN_DBUG_ENTER_METHOD(); + + GRN_TEXT_INIT(&text_buffer_, GRN_OBJ_DO_SHALLOW_COPY); + GRN_UINT32_INIT(&id_buffer_, 0); + + table_ = grn_ctx_get(ctx_, TABLE_NAME, -1); + if (!table_) { + table_ = grn_table_create(ctx_, + TABLE_NAME, strlen(TABLE_NAME), + NULL, + GRN_OBJ_TABLE_NO_KEY | GRN_OBJ_PERSISTENT, + NULL, NULL); + columns_.type_ = + grn_column_create(ctx_, table_, + COLUMN_TYPE_NAME, strlen(COLUMN_TYPE_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_SHORT_TEXT)); + columns_.table_ = + grn_column_create(ctx_, table_, + COLUMN_TABLE_NAME, strlen(COLUMN_TABLE_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_SHORT_TEXT)); + columns_.record_ = + grn_column_create(ctx_, table_, + COLUMN_RECORD_NAME, strlen(COLUMN_RECORD_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_UINT32)); + } else { + columns_.type_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_TYPE_NAME, -1); + columns_.table_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_TABLE_NAME, -1); + columns_.record_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_RECORD_NAME, -1); + } + + is_enabled_recording_ = true; + + DBUG_VOID_RETURN; + } + + Operations::~Operations() { + MRN_DBUG_ENTER_METHOD(); + + GRN_OBJ_FIN(ctx_, &id_buffer_); + GRN_OBJ_FIN(ctx_, &text_buffer_); + + DBUG_VOID_RETURN; + } + + bool Operations::is_locked() { + MRN_DBUG_ENTER_METHOD(); + + if (grn_obj_is_locked(ctx_, table_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.type_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.table_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.record_) > 0) + DBUG_RETURN(true); + + DBUG_RETURN(false); + } + + grn_id Operations::start(const char *type, + const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_RETURN(GRN_ID_NIL); + } + + grn_id id = grn_table_add(ctx_, table_, NULL, 0, NULL); + + GRN_TEXT_SETS(ctx_, &text_buffer_, type); + grn_obj_set_value(ctx_, columns_.type_, id, &text_buffer_, GRN_OBJ_SET); + + GRN_TEXT_SET(ctx_, &text_buffer_, table_name, table_name_size); + grn_obj_set_value(ctx_, columns_.table_, id, &text_buffer_, GRN_OBJ_SET); + + DBUG_RETURN(id); + } + + void Operations::record_target(grn_id id, grn_id record_id) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_VOID_RETURN; + } + + GRN_UINT32_SET(ctx_, &id_buffer_, record_id); + grn_obj_set_value(ctx_, columns_.record_, id, &id_buffer_, GRN_OBJ_SET); + + DBUG_VOID_RETURN; + } + + void Operations::finish(grn_id id) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_VOID_RETURN; + } + + grn_table_delete_by_id(ctx_, table_, id); + + DBUG_VOID_RETURN; + } + + void Operations::enable_recording() { + MRN_DBUG_ENTER_METHOD(); + + is_enabled_recording_ = true; + + DBUG_VOID_RETURN; + } + + void Operations::disable_recording() { + MRN_DBUG_ENTER_METHOD(); + + is_enabled_recording_ = false; + + DBUG_VOID_RETURN; + } + + grn_hash *Operations::collect_processing_table_names() { + MRN_DBUG_ENTER_METHOD(); + + grn_hash *table_names = + grn_hash_create(ctx_, NULL, GRN_TABLE_MAX_KEY_SIZE, 0, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_KEY_VAR_SIZE); + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + GRN_LOG(ctx_, GRN_LOG_NOTICE, + "[operations] failed to open cursor: %s", + ctx_->errbuf); + DBUG_RETURN(table_names); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if (GRN_TEXT_LEN(&text_buffer_) > 0) { + grn_hash_add(ctx_, table_names, + GRN_TEXT_VALUE(&text_buffer_), + GRN_TEXT_LEN(&text_buffer_), + NULL, + NULL); + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(table_names); + } + + int Operations::repair(const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + error = HA_ERR_CRASHED_ON_USAGE; + if (ctx_->rc) { + my_message(error, ctx_->errbuf, MYF(0)); + } else { + my_message(error, + "mroonga: repair: " + "failed to open cursor for operations table", + MYF(0)); + } + DBUG_RETURN(error); + } + + grn_obj *target_table = grn_ctx_get(ctx_, table_name, table_name_size); + if (!target_table) { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "table doesn't exist for auto repair: <%.*s>", + static_cast(table_name_size), table_name); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if (!((static_cast(GRN_TEXT_LEN(&text_buffer_)) == + table_name_size) && + memcmp(GRN_TEXT_VALUE(&text_buffer_), + table_name, + table_name_size) == 0)) { + continue; + } + + if (!target_table) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an orphan operation: " + "[%u]: <%.*s>[%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + continue; + } + + GRN_BULK_REWIND(&id_buffer_); + grn_obj_get_value(ctx_, columns_.record_, id, &id_buffer_); + grn_id record_id = GRN_UINT32_VALUE(&id_buffer_); + if (record_id == GRN_ID_NIL) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: " + "failed to delete an operation that has no related record: " + "[%u]: <%.*s>[%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + continue; + } + + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + if (strcmp(GRN_TEXT_VALUE(&text_buffer_), "write") == 0 || + strcmp(GRN_TEXT_VALUE(&text_buffer_), "delete") == 0) { + grn_rc rc = grn_table_delete_by_id(ctx_, target_table, record_id); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an incomplete record: " + "[%u]: <%.*s>[%u]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + record_id, + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + + rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an incomplete operation: " + "[%u]: <%.*s>[%u][%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + record_id, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + } else if (strcmp(GRN_TEXT_VALUE(&text_buffer_), "update") == 0) { + error = HA_ERR_CRASHED_ON_USAGE; + my_message(error, + "mroonga: repair: can't recover from crash while updating", + MYF(0)); + break; + } else { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: unknown operation type: " + "[%u]: <%.*s>[%u]: <%s>", + id, + static_cast(table_name_size), table_name, + record_id, + GRN_TEXT_VALUE(&text_buffer_)); + my_message(error, error_message, MYF(0)); + break; + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } + + int Operations::clear(const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + error = HA_ERR_CRASHED_ON_USAGE; + if (ctx_->rc) { + my_message(error, ctx_->errbuf, MYF(0)); + } else { + my_message(error, + "mroonga: clear: " + "failed to open cursor for operations table", + MYF(0)); + } + DBUG_RETURN(error); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if ((static_cast(GRN_TEXT_LEN(&text_buffer_)) == + table_name_size) && + memcmp(GRN_TEXT_VALUE(&text_buffer_), + table_name, + table_name_size) == 0) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + GRN_BULK_REWIND(&id_buffer_); + grn_obj_get_value(ctx_, columns_.record_, id, &id_buffer_); + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: clear: failed to delete an operation: " + "[%u]: <%.*s>[%u][%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_UINT32_VALUE(&id_buffer_), + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } +} diff --git a/storage/mroonga/lib/mrn_operations.hpp b/storage/mroonga/lib/mrn_operations.hpp new file mode 100644 index 00000000000..762a5ee9d43 --- /dev/null +++ b/storage/mroonga/lib/mrn_operations.hpp @@ -0,0 +1,60 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_OPERATIONS_HPP_ +#define MRN_OPERATIONS_HPP_ + +#include + +namespace mrn { + class Operations { + public: + Operations(grn_ctx *ctx); + ~Operations(); + + bool is_locked(); + + grn_id start(const char *type, + const char *table_name, size_t table_name_size); + void record_target(grn_id id, grn_id target_id); + void finish(grn_id id); + + void enable_recording(); + void disable_recording(); + + grn_hash *collect_processing_table_names(); + + int repair(const char *table_name, size_t table_name_size); + int clear(const char *table_name, size_t table_name_size); + + private: + grn_ctx *ctx_; + grn_obj text_buffer_; + grn_obj id_buffer_; + grn_obj *table_; + struct { + grn_obj *type_; + grn_obj *table_; + grn_obj *record_; + } columns_; + bool is_enabled_recording_; + }; +} + +#endif /* MRN_OPERATIONS_HPP_ */ diff --git a/storage/mroonga/lib/mrn_path_mapper.cpp b/storage/mroonga/lib/mrn_path_mapper.cpp index 7a595986f01..43f276f4e82 100644 --- a/storage/mroonga/lib/mrn_path_mapper.cpp +++ b/storage/mroonga/lib/mrn_path_mapper.cpp @@ -222,4 +222,8 @@ namespace mrn { mysql_path_[i] = '\0'; return mysql_path_; } + + bool PathMapper::is_internal_table_name() { + return mysql_table_name()[0] == '#'; + } } diff --git a/storage/mroonga/lib/mrn_path_mapper.hpp b/storage/mroonga/lib/mrn_path_mapper.hpp index 607bfe4cdce..9849d5e28ef 100644 --- a/storage/mroonga/lib/mrn_path_mapper.hpp +++ b/storage/mroonga/lib/mrn_path_mapper.hpp @@ -38,6 +38,8 @@ namespace mrn { const char *table_name(); const char *mysql_table_name(); const char *mysql_path(); + bool is_internal_table_name(); + bool is_temporary_table_name(); private: const char *original_mysql_path_; const char *path_prefix_; diff --git a/storage/mroonga/lib/mrn_query_parser.cpp b/storage/mroonga/lib/mrn_query_parser.cpp new file mode 100644 index 00000000000..4e05069a3a9 --- /dev/null +++ b/storage/mroonga/lib/mrn_query_parser.cpp @@ -0,0 +1,361 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_query_parser.hpp" + +#include + +extern "C" { + /* Groonga's internal functions */ + int grn_atoi(const char *nptr, const char *end, const char **rest); + uint grn_atoui(const char *nptr, const char *end, const char **rest); +} + +#define MRN_CLASS_NAME "mrn::QueryParser" + +namespace mrn { + QueryParser::QueryParser(grn_ctx *ctx, + THD *thd, + grn_obj *expression, + grn_obj *default_column, + uint n_sections, + grn_obj *match_columns) + : ctx_(ctx), + thd_(thd), + expression_(expression), + default_column_(default_column), + n_sections_(n_sections), + match_columns_(match_columns) { + } + + QueryParser::~QueryParser() { + } + + grn_rc QueryParser::parse(const char *query, size_t query_length) { + MRN_DBUG_ENTER_METHOD(); + + const char *raw_query = NULL; + size_t raw_query_length = 0; + grn_operator default_operator = GRN_OP_OR; + grn_expr_flags expression_flags = 0; + parse_pragma(query, + query_length, + &raw_query, + &raw_query_length, + &default_operator, + &expression_flags); + + grn_obj *default_column = default_column_; + if (match_columns_) { + default_column = match_columns_; + } + grn_rc rc = grn_expr_parse(ctx_, + expression_, + raw_query, + raw_query_length, + default_column, + GRN_OP_MATCH, + default_operator, + expression_flags); + if (rc != GRN_SUCCESS) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to parse fulltext search keyword: <%.*s>: <%s>", + static_cast(query_length), + query, + ctx_->errbuf); + variables::ActionOnError action = + variables::get_action_on_fulltext_query_error(thd_); + switch (action) { + case variables::ACTION_ON_ERROR_ERROR: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + break; + case variables::ACTION_ON_ERROR_ERROR_AND_LOG: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + GRN_LOG(ctx_, GRN_LOG_ERROR, "%s", error_message); + break; + case variables::ACTION_ON_ERROR_IGNORE: + break; + case variables::ACTION_ON_ERROR_IGNORE_AND_LOG: + GRN_LOG(ctx_, GRN_LOG_ERROR, "%s", error_message); + break; + } + } + + DBUG_RETURN(rc); + } + + void QueryParser::parse_pragma(const char *query, + size_t query_length, + const char **raw_query, + size_t *raw_query_length, + grn_operator *default_operator, + grn_expr_flags *flags) { + MRN_DBUG_ENTER_METHOD(); + + const char *current_query = query; + size_t current_query_length = query_length; + + *default_operator = GRN_OP_OR; + + if (current_query_length >= 4 && memcmp(current_query, "*SS ", 4) == 0) { + *raw_query = current_query + 4; + *raw_query_length = current_query_length - 4; + *flags = GRN_EXPR_SYNTAX_SCRIPT; + DBUG_VOID_RETURN; + } + + bool weight_specified = false; + *raw_query = query; + *raw_query_length = query_length; + *flags = default_expression_flags(); + if (current_query_length >= 2 && current_query[0] == '*') { + bool parsed = false; + bool done = false; + current_query++; + current_query_length--; + while (!done) { + size_t consumed_query_length = 0; + switch (current_query[0]) { + case 'D': + if (parse_pragma_d(current_query + 1, + current_query_length - 1, + default_operator, + &consumed_query_length)) { + parsed = true; + consumed_query_length += 1; + current_query += consumed_query_length; + current_query_length -= consumed_query_length; + } else { + done = true; + } + break; + case 'W': + if (parse_pragma_w(current_query + 1, + current_query_length - 1, + &consumed_query_length)) { + parsed = true; + weight_specified = true; + consumed_query_length += 1; + current_query += consumed_query_length; + current_query_length -= consumed_query_length; + } else { + done = true; + } + break; + default: + done = true; + break; + } + } + if (parsed) { + *raw_query = current_query; + *raw_query_length = current_query_length; + } + } + + // WORKAROUND: ignore the first '+' to support "+apple macintosh" pattern. + while (*raw_query_length > 0 && (*raw_query)[0] == ' ') { + (*raw_query)++; + (*raw_query_length)--; + } + if (*raw_query_length > 0 && (*raw_query)[0] == '+') { + (*raw_query)++; + (*raw_query_length)--; + } + if (!weight_specified && match_columns_) { + grn_expr_append_obj(ctx_, match_columns_, default_column_, GRN_OP_PUSH, 1); + } + + DBUG_VOID_RETURN; + } + + bool QueryParser::parse_pragma_w(const char *query, + size_t query_length, + size_t *consumed_query_length) { + MRN_DBUG_ENTER_METHOD(); + + *consumed_query_length = 0; + + grn_obj section_value_buffer; + GRN_UINT32_INIT(§ion_value_buffer, 0); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(bool, specified_sections, n_sections_); + for (uint i = 0; i < n_sections_; ++i) { + specified_sections[i] = false; + } + + uint n_weights = 0; + while (query_length >= 1) { + if (n_weights >= 1) { + if (query[0] != ',') { + break; + } + size_t n_used_query_length = 1; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + if (query_length == 0) { + break; + } + } + + uint section = 0; + if ('1' <= query[0] && query[0] <= '9') { + const char *section_start = query; + const char *query_end = query + query_length; + const char *query_rest; + section = grn_atoui(section_start, query_end, &query_rest); + if (section_start == query_rest) { + break; + } + if (!(0 < section && section <= n_sections_)) { + break; + } + section -= 1; + specified_sections[section] = true; + size_t n_used_query_length = query_rest - query; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + } else { + break; + } + + int weight = 1; + if (query_length >= 2 && query[0] == ':') { + const char *weight_start = query + 1; + const char *query_end = query + query_length; + const char *query_rest; + weight = grn_atoi(weight_start, query_end, &query_rest); + if (weight_start == query_rest) { + break; + } + size_t n_used_query_length = query_rest - query; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + } + + n_weights++; + + append_section(section, + §ion_value_buffer, + weight, + n_weights); + } + + for (uint section = 0; section < n_sections_; ++section) { + if (specified_sections[section]) { + continue; + } + + ++n_weights; + + int default_weight = 1; + append_section(section, + §ion_value_buffer, + default_weight, + n_weights); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(specified_sections); + + GRN_OBJ_FIN(ctx_, §ion_value_buffer); + + DBUG_RETURN(n_weights > 0); + } + + void QueryParser::append_section(uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights) { + MRN_DBUG_ENTER_METHOD(); + + if (!match_columns_) { + DBUG_VOID_RETURN; + } + + grn_expr_append_obj(ctx_, match_columns_, default_column_, GRN_OP_PUSH, 1); + GRN_UINT32_SET(ctx_, section_value_buffer, section); + grn_expr_append_const(ctx_, match_columns_, section_value_buffer, + GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, match_columns_, GRN_OP_GET_MEMBER, 2); + + if (weight != 1) { + grn_expr_append_const_int(ctx_, match_columns_, weight, GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, match_columns_, GRN_OP_STAR, 2); + } + + if (n_weights >= 2) { + grn_expr_append_op(ctx_, match_columns_, GRN_OP_OR, 2); + } + + DBUG_VOID_RETURN; + } + + bool QueryParser::parse_pragma_d(const char *query, + size_t query_length, + grn_operator *default_operator, + size_t *consumed_query_length) { + MRN_DBUG_ENTER_METHOD(); + + bool succeeded = true; + if (query_length >= 1 && query[0] == '+') { + *default_operator = GRN_OP_AND; + *consumed_query_length = 1; + } else if (query_length >= 1 && query[0] == '-') { + *default_operator = GRN_OP_AND_NOT; + *consumed_query_length = 1; + } else if (query_length >= 2 && memcmp(query, "OR", 2) == 0) { + *default_operator = GRN_OP_OR; + *consumed_query_length = 2; + } else { + succeeded = false; + } + + DBUG_RETURN(succeeded); + } + + grn_expr_flags QueryParser::default_expression_flags() { + MRN_DBUG_ENTER_METHOD(); + + ulonglong syntax_flags = variables::get_boolean_mode_syntax_flags(thd_); + grn_expr_flags expression_flags = 0; + if (syntax_flags == variables::BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT) { + expression_flags = GRN_EXPR_SYNTAX_QUERY | GRN_EXPR_ALLOW_LEADING_NOT; + } else { + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT) { + expression_flags |= GRN_EXPR_SYNTAX_SCRIPT; + } else { + expression_flags |= GRN_EXPR_SYNTAX_QUERY; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN) { + expression_flags |= GRN_EXPR_ALLOW_COLUMN; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE) { + expression_flags |= GRN_EXPR_ALLOW_UPDATE; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT) { + expression_flags |= GRN_EXPR_ALLOW_LEADING_NOT; + } + } + + DBUG_RETURN(expression_flags); + } +} diff --git a/storage/mroonga/lib/mrn_query_parser.hpp b/storage/mroonga/lib/mrn_query_parser.hpp new file mode 100644 index 00000000000..8b3c4084c8d --- /dev/null +++ b/storage/mroonga/lib/mrn_query_parser.hpp @@ -0,0 +1,67 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include + +#include + +namespace mrn { + class QueryParser { + public: + QueryParser(grn_ctx *ctx, + THD *thd, + grn_obj *expression, + grn_obj *default_column, + uint n_sections, + grn_obj *match_columns=NULL); + ~QueryParser(); + + grn_rc parse(const char *query, size_t query_length); + void parse_pragma(const char *query, + size_t query_length, + const char **raw_query, + size_t *raw_query_length, + grn_operator *default_operator, + grn_expr_flags *flags); + + private: + grn_ctx *ctx_; + THD *thd_; + grn_obj *expression_; + grn_obj *default_column_; + uint n_sections_; + grn_obj *match_columns_; + + bool parse_pragma_w(const char *query, + size_t query_length, + size_t *consumed_query_length); + void append_section(uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights); + bool parse_pragma_d(const char *query, + size_t query_length, + grn_operator *default_operator, + size_t *consumed_query_length); + grn_expr_flags default_expression_flags(); + }; +} diff --git a/storage/mroonga/lib/mrn_smart_bitmap.cpp b/storage/mroonga/lib/mrn_smart_bitmap.cpp new file mode 100644 index 00000000000..9dc91ff29d5 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_bitmap.cpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_smart_bitmap.hpp" + +namespace mrn { + SmartBitmap::SmartBitmap(MY_BITMAP *bitmap) + : bitmap_(bitmap) { + } + + SmartBitmap::~SmartBitmap() { + if (bitmap_) { + bitmap_free(bitmap_); + } + } + + MY_BITMAP *SmartBitmap::get() { + return bitmap_; + } + + MY_BITMAP *SmartBitmap::release() { + MY_BITMAP *bitmap = bitmap_; + bitmap_ = NULL; + return bitmap; + } +} diff --git a/storage/mroonga/lib/mrn_smart_bitmap.hpp b/storage/mroonga/lib/mrn_smart_bitmap.hpp new file mode 100644 index 00000000000..dfb56956024 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_bitmap.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include + +namespace mrn { + class SmartBitmap { + public: + SmartBitmap(MY_BITMAP *bitmap); + ~SmartBitmap(); + + MY_BITMAP *get(); + MY_BITMAP *release(); + private: + MY_BITMAP *bitmap_; + }; +} diff --git a/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp b/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp new file mode 100644 index 00000000000..7f1dae266c7 --- /dev/null +++ b/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp @@ -0,0 +1,41 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_table_fields_offset_mover.hpp" + +namespace mrn { + TableFieldsOffsetMover::TableFieldsOffsetMover(TABLE *table, + my_ptrdiff_t diff) + : table_(table), + diff_(diff) { + uint n_columns = table_->s->fields; + for (uint i = 0; i < n_columns; ++i) { + Field *field = table_->field[i]; + field->move_field_offset(diff_); + } + } + + TableFieldsOffsetMover::~TableFieldsOffsetMover() { + uint n_columns = table_->s->fields; + for (uint i = 0; i < n_columns; ++i) { + Field *field = table_->field[i]; + field->move_field_offset(-diff_); + } + } +} diff --git a/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp b/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp new file mode 100644 index 00000000000..a8d12be19ed --- /dev/null +++ b/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp @@ -0,0 +1,33 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include + +namespace mrn { + class TableFieldsOffsetMover { + public: + TableFieldsOffsetMover(TABLE *table, my_ptrdiff_t diff); + ~TableFieldsOffsetMover(); + private: + TABLE *table_; + my_ptrdiff_t diff_; + }; +} diff --git a/storage/mroonga/mrn_err.h b/storage/mroonga/mrn_err.h index d109f87bb48..95b1b047c79 100644 --- a/storage/mroonga/mrn_err.h +++ b/storage/mroonga/mrn_err.h @@ -39,5 +39,8 @@ #define ER_MRN_INVALID_INDEX_FLAG_NUM 16508 #define ER_MRN_INVALID_INDEX_FLAG_STR \ "The index flag '%-.64s' is invalid. It is ignored" +#define ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM 16509 +#define ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR \ + "Index for virtual generated column is not supported: %s" #endif /* MRN_ERR_H_ */ diff --git a/storage/mroonga/mrn_mysql.h b/storage/mroonga/mrn_mysql.h index 8a42637a8e4..60f535f791f 100644 --- a/storage/mroonga/mrn_mysql.h +++ b/storage/mroonga/mrn_mysql.h @@ -43,21 +43,18 @@ #define MYSQL_SERVER 1 #include -#if MYSQL_VERSION_ID < 50500 -# include -# include -#else -# include -# include -# include -# include -#endif -#include - #ifdef MARIADB_BASE_VERSION # define MRN_MARIADB_P 1 #endif +#include +#include +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID < 80002) +# include +#endif +#include +#include + #define MRN_MESSAGE_BUFFER_SIZE 1024 #define MRN_DBUG_ENTER_FUNCTION() DBUG_ENTER(__FUNCTION__) diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h index 660c72b4d25..d33a8c88d87 100644 --- a/storage/mroonga/mrn_mysql_compat.h +++ b/storage/mroonga/mrn_mysql_compat.h @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2011-2015 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,10 @@ # define MRN_HAVE_MYSQL_TYPE_TIME2 #endif +#if MYSQL_VERSION_ID >= 50709 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_MYSQL_TYPE_JSON +#endif + #if MYSQL_VERSION_ID < 50603 typedef MYSQL_ERROR Sql_condition; #endif @@ -42,6 +46,10 @@ typedef char *range_id_t; #endif +#if defined(MRN_MARIADB_P) || MYSQL_VERSION_ID < 80002 + typedef st_select_lex SELECT_LEX; +#endif + #if MYSQL_VERSION_ID >= 50609 # define MRN_KEY_HAS_USER_DEFINED_KEYPARTS #endif @@ -99,6 +107,9 @@ #if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100009 # define MRN_HAVE_TDC_ACQUIRE_SHARE +# if MYSQL_VERSION_ID < 100200 +# define MRN_TDC_ACQUIRE_SHARE_REQUIRE_KEY +# endif #endif #if MYSQL_VERSION_ID >= 50613 @@ -206,6 +217,26 @@ # define MRN_SUPPORT_CUSTOM_OPTIONS #endif +#ifdef MRN_MARIADB_P +# define MRN_HAVE_ITEM_EQUAL_FIELDS_ITERATOR +#endif + +#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P) +# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \ + ((select_lex)->where_cond()) +# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \ + ((select_lex)->having_cond()) +# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \ + ((select_lex)->active_options()) +#else +# define MRN_SELECT_LEX_GET_WHERE_COND(select_lex) \ + ((select_lex)->where) +# define MRN_SELECT_LEX_GET_HAVING_COND(select_lex) \ + ((select_lex)->having) +# define MRN_SELECT_LEX_GET_ACTIVE_OPTIONS(select_lex) \ + ((select_lex)->options) +#endif + #if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000 # if MYSQL_VERSION_ID >= 100104 # define mrn_init_sql_alloc(thd, mem_root) \ @@ -221,17 +252,25 @@ MYF(0)) # endif #else +# if MYSQL_VERSION_ID >= 50709 +# define mrn_init_sql_alloc(thd, mem_root) \ + init_sql_alloc(mrn_memory_key, \ + mem_root, \ + TABLE_ALLOC_BLOCK_SIZE, \ + 0) +# else # define mrn_init_sql_alloc(thd, mem_root) \ init_sql_alloc(mem_root, \ TABLE_ALLOC_BLOCK_SIZE, \ 0) +# endif #endif #ifdef MRN_MARIADB_P # define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning #else # if MYSQL_VERSION_ID >= 50706 -# define MRN_ABORT_ON_WARNING(thd) false +# define MRN_ABORT_ON_WARNING(thd) thd->is_strict_mode() # else # define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning # endif @@ -240,4 +279,204 @@ #define MRN_ERROR_CODE_DATA_TRUNCATE(thd) \ (MRN_ABORT_ON_WARNING(thd) ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED) +#if MYSQL_VERSION_ID >= 50709 && !defined(MRN_MARIADB_P) +# define mrn_my_hash_init(hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags) \ + my_hash_init(hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags, \ + mrn_memory_key) +#else +# define mrn_my_hash_init(hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags) \ + my_hash_init(hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags) +#endif + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000 +# define mrn_strconvert(from_cs, \ + from, \ + from_length, \ + to_cs, \ + to, \ + to_length, \ + errors) \ + strconvert((from_cs), \ + (from), \ + (from_length), \ + (to_cs), \ + (to), \ + (to_length), \ + (errors)) +#else +# define mrn_strconvert(from_cs, \ + from, \ + from_length, \ + to_cs, \ + to, \ + to_length, \ + errors) \ + strconvert((from_cs), \ + (from), \ + (to_cs), \ + (to), \ + (to_length), \ + (errors)) +#endif + +#if MYSQL_VERSION_ID >= 50717 && !defined(MRN_MARIADB_P) +# define mrn_is_directory_separator(c) \ + is_directory_separator((c)) +#else +# define mrn_is_directory_separator(c) \ + (c == FN_LIBCHAR || c == FN_LIBCHAR2) +#endif + +#if ((MYSQL_VERSION_ID < 50636) || \ + (MYSQL_VERSION_ID >= 50700 && MYSQL_VERSION_ID < 50718)) && !defined(MRN_MARIADB_P) +# define MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED +#endif + +#if defined(MRN_MARIADB_P) && \ + ((MYSQL_VERSION_ID >= 100207) || \ + ((MYSQL_VERSION_ID >= 100126) && (MYSQL_VERSION_ID < 100200)) || \ + ((MYSQL_VERSION_ID >= 100032) && (MYSQL_VERSION_ID < 100100)) || \ + ((MYSQL_VERSION_ID >= 50557) && (MYSQL_VERSION_ID < 100000))) +# define mrn_create_partition_name(out, \ + out_length, \ + in1, \ + in2, \ + name_variant, \ + translate) \ + create_partition_name(out, out_length, in1, in2, name_variant, translate) +# define mrn_create_subpartition_name(out, \ + out_length, \ + in1, \ + in2, \ + in3, \ + name_variant) \ + create_subpartition_name(out, out_length, in1, in2, in3, name_variant) +#else +# define mrn_create_partition_name(out, \ + out_length, \ + in1, \ + in2, \ + name_variant, \ + translate) \ + (create_partition_name(out, in1, in2, name_variant, translate), 0) +# define mrn_create_subpartition_name(out, \ + out_length, \ + in1, \ + in2, \ + in3, \ + name_variant) \ + (create_subpartition_name(out, in1, in2, in3, name_variant), 0) +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define ITEM_SUM_GET_NEST_LEVEL(sum_item) (sum_item)->base_select->nest_level +# define ITEM_SUM_GET_AGGR_LEVEL(sum_item) (sum_item)->aggr_select->nest_level +# define ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) (sum_item)->max_aggr_level +#else +# define ITEM_SUM_GET_NEST_LEVEL(sum_item) (sum_item)->nest_level +# define ITEM_SUM_GET_AGGR_LEVEL(sum_item) (sum_item)->aggr_level +# define ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) (sum_item)->max_arg_level +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) + typedef bool mrn_bool; +#else + typedef my_bool mrn_bool; +#endif + +#define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \ + type *variable_name = \ + (type *)mrn_my_malloc(sizeof(type) * (variable_size), MYF(MY_WME)) +#define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) \ + my_free(variable_name) + +#if ((defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100203)) || \ + (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50711) +# define MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN \ + Alter_inplace_info::ADD_VIRTUAL_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN \ + Alter_inplace_info::ADD_STORED_BASE_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN \ + Alter_inplace_info::ADD_STORED_GENERATED_COLUMN +#else +# define MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN 0 +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN \ + Alter_inplace_info::ADD_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN 0 +#endif + +#if (defined(HA_CAN_VIRTUAL_COLUMNS) || defined(HA_GENERATED_COLUMNS)) +# define MRN_SUPPORT_GENERATED_COLUMNS +#endif + +#ifdef MRN_MARIADB_P +# if (MYSQL_VERSION_ID >= 100200) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db()) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->vcol_info && field->vcol_info->is_stored()) +# elif (MYSQL_VERSION_ID >= 50500) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->vcol_info && field->vcol_info->is_stored()) +# else +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) false +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) false +# endif +#else +# if (MYSQL_VERSION_ID >= 50708) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (field->is_virtual_gcol()) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->is_gcol() && !field->is_virtual_gcol()) +# elif (MYSQL_VERSION_ID >= 50706) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->gcol_info && field->gcol_info->get_field_stored()) +# else +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) false +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) false +# endif +#endif + +#ifdef MRN_MARIADB_P +# if (MYSQL_VERSION_ID >= 100203) +# define MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(table, field) \ + (table->update_virtual_field(field)) +# else +# define MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(table, field) \ + (field->vcol_info->expr_item->save_in_field(field, 0)) +# endif +#endif + #endif /* MRN_MYSQL_COMPAT_H_ */ diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp index 8984db3bfbf..bb7c8fdb7ba 100644 --- a/storage/mroonga/mrn_table.cpp +++ b/storage/mroonga/mrn_table.cpp @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2011-2013 Kentoku SHIBA - Copyright(C) 2011-2015 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -202,7 +202,6 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, const TABLE *table, partition_element **part_elem, partition_element **sub_elem) { - char tmp_name[FN_REFLEN + 1]; partition_info *part_info = table->part_info; partition_element *tmp_part_elem = NULL, *tmp_sub_elem = NULL; bool tmp_flg = FALSE, tmp_find_flg = FALSE; @@ -224,18 +223,24 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, List_iterator sub_it((*part_elem)->subpartitions); while ((*sub_elem = sub_it++)) { - if (create_subpartition_name(tmp_name, sizeof(tmp_name), table->s->path.str, - (*part_elem)->partition_name, (*sub_elem)->partition_name, - NORMAL_PART_NAME)) + char subpartition_name[FN_REFLEN + 1]; + int error = mrn_create_subpartition_name(subpartition_name, + sizeof(subpartition_name), + table->s->path.str, + (*part_elem)->partition_name, + (*sub_elem)->partition_name, + NORMAL_PART_NAME); + if (error != 0) DBUG_VOID_RETURN; - DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); - if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) + DBUG_PRINT("info", ("mroonga subpartition name=%s", subpartition_name)); + if (table_name && + memcmp(table_name, subpartition_name, table_name_length + 1) == 0) DBUG_VOID_RETURN; if ( tmp_flg && table_name && - *(tmp_name + table_name_length - 5) == '\0' && - !memcmp(table_name, tmp_name, table_name_length - 5) + *(subpartition_name + table_name_length - 5) == '\0' && + memcmp(table_name, subpartition_name, table_name_length - 5) == 0 ) { tmp_part_elem = *part_elem; tmp_sub_elem = *sub_elem; @@ -244,17 +249,24 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, } } } else { - if (create_partition_name(tmp_name, sizeof(tmp_name), table->s->path.str, - (*part_elem)->partition_name, NORMAL_PART_NAME, TRUE)) + char partition_name[FN_REFLEN + 1]; + int error = mrn_create_partition_name(partition_name, + sizeof(partition_name), + table->s->path.str, + (*part_elem)->partition_name, + NORMAL_PART_NAME, + TRUE); + if (error != 0) DBUG_VOID_RETURN; - DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); - if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) + DBUG_PRINT("info", ("mroonga partition name=%s", partition_name)); + if (table_name && + memcmp(table_name, partition_name, table_name_length + 1) == 0) DBUG_VOID_RETURN; if ( tmp_flg && table_name && - *(tmp_name + table_name_length - 5) == '\0' && - !memcmp(table_name, tmp_name, table_name_length - 5) + *(partition_name + table_name_length - 5) == '\0' && + memcmp(table_name, partition_name, table_name_length - 5) == 0 ) { tmp_part_elem = *part_elem; tmp_flg = FALSE; @@ -518,6 +530,7 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i) char *sprit_ptr[2]; char *tmp_ptr, *start_ptr; #endif + THD *thd = current_thd; MRN_DBUG_ENTER_FUNCTION(); #if MYSQL_VERSION_ID >= 50500 @@ -580,6 +593,10 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i) MRN_PARAM_STR_LIST("table", index_table, i); break; case 6: + push_warning_printf(thd, MRN_SEVERITY_WARNING, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), + "parser", "tokenizer"); MRN_PARAM_STR_LIST("parser", key_tokenizer, i); break; case 9: @@ -1000,26 +1017,31 @@ int mrn_free_share(MRN_SHARE *share) TABLE_SHARE *mrn_get_table_share(TABLE_LIST *table_list, int *error) { - uint key_length __attribute__((unused)); TABLE_SHARE *share; THD *thd = current_thd; MRN_DBUG_ENTER_FUNCTION(); -#ifdef MRN_HAVE_GET_TABLE_DEF_KEY +#if defined(MRN_HAVE_TDC_ACQUIRE_SHARE) && \ + !defined(MRN_TDC_ACQUIRE_SHARE_REQUIRE_KEY) + share = tdc_acquire_share(thd, table_list, GTS_TABLE); +#else + uint key_length; +# ifdef MRN_HAVE_GET_TABLE_DEF_KEY const char *key; key_length = get_table_def_key(table_list, &key); -#else +# else char key[MAX_DBKEY_LENGTH]; key_length = create_table_def_key(thd, key, table_list, FALSE); -#endif -#ifdef MRN_HAVE_TABLE_DEF_CACHE +# endif +# ifdef MRN_HAVE_TABLE_DEF_CACHE my_hash_value_type hash_value; hash_value = my_calc_hash(mrn_table_def_cache, (uchar*) key, key_length); share = get_table_share(thd, table_list, key, key_length, 0, error, hash_value); -#elif defined(MRN_HAVE_TDC_ACQUIRE_SHARE) +# elif defined(MRN_HAVE_TDC_ACQUIRE_SHARE) share = tdc_acquire_share(thd, table_list, GTS_TABLE); -#else +# else share = get_table_share(thd, table_list, key, key_length, 0, error); +# endif #endif DBUG_RETURN(share); } @@ -1050,7 +1072,7 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path *error = ER_CANT_OPEN_FILE; DBUG_RETURN(NULL); } - share->tmp_table = INTERNAL_TMP_TABLE; // TODO: is this right? + share->tmp_table = NO_TMP_TABLE; // TODO: is this right? share->path.str = (char *) path; share->path.length = strlen(share->path.str); share->normalized_path.str = mrn_my_strdup(path, MYF(MY_WME)); diff --git a/storage/mroonga/mrn_variables.hpp b/storage/mroonga/mrn_variables.hpp index 6bc948a1cac..0866403e54c 100644 --- a/storage/mroonga/mrn_variables.hpp +++ b/storage/mroonga/mrn_variables.hpp @@ -26,4 +26,28 @@ extern PSI_memory_key mrn_memory_key; #endif +namespace mrn { + namespace variables { + enum BooleanModeSyntaxFlag { + BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT = (1 << 0), + BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_QUERY = (1 << 1), + BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT = (1 << 2), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN = (1 << 3), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE = (1 << 4), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT = (1 << 5) + }; + + ulonglong get_boolean_mode_syntax_flags(THD *thd); + + enum ActionOnError { + ACTION_ON_ERROR_ERROR, + ACTION_ON_ERROR_ERROR_AND_LOG, + ACTION_ON_ERROR_IGNORE, + ACTION_ON_ERROR_IGNORE_AND_LOG, + }; + + ActionOnError get_action_on_fulltext_query_error(THD *thd); + } +} + #endif /* MRN_VARIABLES_HPP_ */ diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc similarity index 83% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc index 1b3cf9c0942..06b5361f3bd 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc @@ -12,14 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA disable_query_log; disable_warnings; -let $VERSION_COMPILE_64BIT= - `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; +let $version_compile_64bit= + `SELECT IF(@@version_compile_machine LIKE '%64%', 1, 0)`; enable_warnings; enable_query_log; -if (!$VERSION_COMPILE_64BIT) { - skip Need a 64 binary; -} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc index 39503a9c68d..7449724b5de 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log -let $VERSION_COMPILE_OS_FREEBSD=`SELECT IF(@@version_compile_os like 'FREEBSD%', 1, 0);`; +let $version_compile_os_freebsd= + `SELECT IF(@@version_compile_os LIKE '%freebsd%', 1, 0);`; --enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc index b2212fd94a8..7063c1d1b3d 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_windows.inc diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc index 6f89f05b869..f608f5f220f 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $libgroonga_embedded = `SELECT @@mroonga_libgroonga_embedded;`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc index 076be2582ba..a61058b92ff 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $libgroonga_support_lz4 = diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc index 5d4862957ae..8f79d05af29 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $libgroonga_support_zlib = diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc new file mode 100644 index 00000000000..1038fe9eea6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--disable_query_log +let $libgroonga_support_zstd = + `SELECT @@mroonga_libgroonga_support_zstd;`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc index 0ef2199b704..50ee66d64c6 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $mariadb = `SELECT LOCATE('MariaDB', @@global.version) > 0`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc index a664a9c51f4..2808e107bc8 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc @@ -1,4 +1,5 @@ # Copyright(C) 2014 Toshihisa Tashiro +# Copyright(C) 2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +13,19 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log -let $VERSION_COMPILE_OS_OSX=`SELECT IF(@@version_compile_os like 'osx%', 1, 0);`; +let $version_compile_os_osx=`SELECT IF(@@version_compile_os like 'osx%', 1, 0);`; +if ($version_compile_os_osx) { + let $version_compile_os_osx_10_8_or_later= + `SELECT IF(@@version_compile_os = 'osx10.6', 0, 1);`; + if ($version_compile_os_osx_10_8_or_later) { + let $version_compile_os_osx_10_8_or_later= + `SELECT IF(@@version_compile_os = 'osx10.7', 0, 1);`; + } +} +if (!$version_comiple_os_osx) { + let $version_compile_os_osx_10_8_or_later=0; +} --enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc similarity index 77% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc index 350f51616ba..cad909d022a 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/check_version.inc - -if (!$version_56_or_later) { - skip This test is for MySQL version 5.6.x or later; -} +--disable_query_log +let $version_compile_os_solaris= + `SELECT IF(@@version_compile_os LIKE 'sun-solaris%', 1, 0);`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc new file mode 100644 index 00000000000..88dfd6602e9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--disable_query_log +let $strict_sql_mode = + `SELECT @@sql_mode LIKE '%STRICT_TRANS_TABLES%' OR + @@sql_mode LIKE '%STRICT_ALL_TABLES%'`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc index cfa7c008e51..aaf4f8dacc8 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2012-2015 Kouhei Sutou +# Copyright(C) 2012-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,19 +12,22 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $version_major_minor = `SELECT CAST(SUBSTRING_INDEX(@@global.version, '.', 2) AS DECIMAL(4, 2))`; -let $version_55 = `SELECT $version_major_minor = 5.5`; -let $version_56 = `SELECT $version_major_minor = 5.6`; -let $version_57 = `SELECT $version_major_minor = 5.7`; -let $version_100 = `SELECT $version_major_minor = 10.0`; +let $version_5_5 = `SELECT $version_major_minor = 5.5`; +let $version_5_6 = `SELECT $version_major_minor = 5.6`; +let $version_5_7 = `SELECT $version_major_minor = 5.7`; +let $version_10_0 = `SELECT $version_major_minor = 10.0`; +let $version_10_1 = `SELECT $version_major_minor = 10.1`; +let $version_10_2 = `SELECT $version_major_minor = 10.2`; -let $version_55_or_later = `SELECT $version_major_minor >= 5.5`; -let $version_56_or_later = `SELECT $version_major_minor >= 5.6`; -let $version_57_or_later = `SELECT $version_major_minor >= 5.7`; -let $version_100_or_later = `SELECT $version_major_minor >= 10.0`; +let $version_5_5_or_later = `SELECT $version_major_minor >= 5.5`; +let $version_5_6_or_later = `SELECT $version_major_minor >= 5.6`; +let $version_5_7_or_later = `SELECT $version_major_minor >= 5.7`; +let $version_10_0_or_later = `SELECT $version_major_minor >= 10.0`; +let $version_10_2_or_later = `SELECT $version_major_minor >= 10.2`; --enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc index b258225fa9f..179e0329600 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log let $VERSION_COMPILE_OS_WIN=`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc deleted file mode 100644 index ae44649df9e..00000000000 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright(C) 2013 Kentoku SHIBA -# Copyright(C) 2014 Toshihisa Tashiro -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - ---source ../../include/mroonga/skip_osx.inc - -disable_query_log; -disable_warnings; -let $VERSION_COMPILE_64BIT= - `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; -enable_warnings; -enable_query_log; -if ($VERSION_COMPILE_64BIT) { - skip Need a 32 bit machine/binary; -} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc index 90a203c91ef..88f8594c352 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_mariadb.inc --source ../../include/mroonga/check_version.inc @@ -22,11 +22,11 @@ if ($mariadb) { } if (!$mariadb) { - if ($version_56) { + if ($version_5_6) { let $fractional_seconds = `SELECT @@global.version >= '5.6'`; } } if (!$fractional_seconds) { - skip fractional seconds in time values are available in MySQL version 5.6 or later or MariaDB; + --skip fractional seconds in time values are available in MySQL version 5.6 or later or MariaDB } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc index fc6cddc5b14..3daf0e7c379 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_freebsd.inc -if (!$VERSION_COMPILE_OS_FREEBSD) { - skip Need OS FreeBSD; +if (!$version_compile_os_freebsd) { + --skip Need OS FreeBSD } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc index dfd3ae12c93..19b52287cc1 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_libgroonga_embedded.inc if ($libgroonga_embedded) { --source ../../include/mroonga/have_mroonga_deinit.inc - skip "This test requires plugin_register of Groonga. libgroonga embedded build doesn't support it."; + --skip This test requires plugin_register of Groonga. libgroonga embedded build doesn't support it. } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc index 7f76ef05021..5f38c66c2c5 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_mariadb.inc if (!$mariadb) { - skip This test is for MariaDB; + --skip This test is for MariaDB } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc new file mode 100644 index 00000000000..e11c15ec796 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if (!$mariadb) { + --skip This test is for MariaDB version 10.2.x or later +} + +if (!$version_10_2_or_later) { + --skip This test is for MariaDB version 10.2.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc index 7bb3ca8b371..b88839e55fe 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_ha_mroonga_so.inc diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc index bd5e4cf7f9f..bd5242c8d34 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA disable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc index f0bad1a490d..0d93ce03bd7 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc @@ -12,6 +12,6 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -let $MYSQLD_DATADIR= `select @@datadir`; +let MYSQLD_DATADIR= `select @@datadir`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc index e2a791aff5e..f3c2129203e 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_mariadb.inc if ($mariadb) { - skip This test is for MySQL; + --skip This test is for MySQL } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc new file mode 100644 index 00000000000..cf638a9c73a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + --skip This test is for MySQL version 5.7.x or later +} + +if (!$version_5_7_or_later) { + --skip This test is for MySQL version 5.7.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc new file mode 100644 index 00000000000..90eca856e5e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_64bit.inc +--source ../../include/mroonga/check_osx.inc + +if (!$version_compile_64bit) { + --skip Need a 64 binary for signed 64bit time_t +} + +if ($version_compile_os_osx) { + if (!$version_compile_os_osx_10_8_or_later) { + --skip Need OS X 10.8 or later for signed 64bit time_t + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc new file mode 100644 index 00000000000..fc89e733f0e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_solaris.inc + +if (!$version_compile_os_solaris) { + --skip Need Solaris +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc new file mode 100644 index 00000000000..678ba6ab460 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_strict_sql_mode.inc + +if (!$strict_sql_mode) { + --skip This test is for STRICT_ALL_TABLES or STRICT_TRANS_TABLES +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc new file mode 100644 index 00000000000..356b2295743 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_10_0) { + --skip This test is for MariaDB version 10.0.x +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc similarity index 82% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc index 09e5acc0187..1a8883f0478 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc -if (!$version_100_or_later) { - skip This test is for MariaDB version 10.0.x or later; +if (!$version_10_0_or_later) { + --skip This test is for MariaDB version 10.0.x or later } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc similarity index 84% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc index fbb4152fc4a..b1708abe195 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc -if (!$version_56) { - skip This test is for MySQL version 5.6.x; +if (!$version_5_5) { + --skip This test is for MySQL version 5.5.x } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc similarity index 90% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc index a08d789d6f2..cfa3c7ac60d 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc -if (!$version_55) { - skip This test is for MySQL version 5.5.x; +if (!$version_5_6) { + --skip This test is for MySQL version 5.6.x } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc similarity index 88% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc index b48d4e9d1bb..b9481afdee8 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc -if (!$version_100) { - skip This test is for MariaDB version 10.0.x; +if (!$version_5_6_or_later) { + --skip This test is for MySQL version 5.6.x or later } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc similarity index 90% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc index ca2d06ae617..4b65def9463 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_57.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc -if (!$version_57) { - skip This test is for MySQL version 5.7.x; +if (!$version_5_7) { + --skip This test is for MySQL version 5.7.x } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc new file mode 100644 index 00000000000..1b18b5749ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_7_or_later) { + --skip This test is for MySQL version 5.7.x or later or MariaDB 10.0.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc index 6e563721fc7..9ca1b0d1168 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_ha_mroonga_so.inc @@ -21,4 +21,8 @@ eval CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME $ha_mroonga_so; eval CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME $ha_mroonga_so; eval CREATE FUNCTION mroonga_command RETURNS STRING SONAME $ha_mroonga_so; eval CREATE FUNCTION mroonga_escape RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_snippet_html RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_normalize RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_highlight_html RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_query_expand RETURNS STRING SONAME $ha_mroonga_so; --enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc new file mode 100644 index 00000000000..d5f8c1293d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc @@ -0,0 +1,8 @@ +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +perl; +open(F, '<', $_="$ENV{MYSQLD_DATADIR}/groonga-query-log.log") or die "open(<$_): $!"; +while () { + s/^[^|]+\|[^|]+\|[^|]+\| *//; + print; +} +EOF diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc index ed13b737fb5..bf0bed98480 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_freebsd.inc -if ($VERSION_COMPILE_OS_FREEBSD) { - skip This test is not for FreeBSD; +if ($version_compile_os_freebsd) { + --skip This test is not for FreeBSD } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc new file mode 100644 index 00000000000..5fd84f1b2a8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2012-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if ($version_10_0_or_later) { + --skip This test is not for MariaDB 10.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc similarity index 85% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc index 93eead8791e..b954d1c75f7 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2012-2013 Kouhei Sutou +# Copyright(C) 2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,13 +12,13 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc --source ../../include/mroonga/check_mariadb.inc -if ($version_55) { +if ($version_10_1) { if ($mariadb) { - skip This test is not for MariaDB 5.5.x; + --skip This test is not for MariaDB 10.1.x } } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc new file mode 100644 index 00000000000..2af6f2adb0d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if (!$version_10_2_or_later) { + --skip This test is not for MariaDB 5.x, MariaDB 10.0.x nor 10.1.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc new file mode 100644 index 00000000000..5f67748a179 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if ($version_10_2_or_later) { + --skip This test is not for MariaDB 10.2.x or later + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc similarity index 85% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc index 9fbfd222df4..0695b96fa23 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_100_or_later.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2012-2015 Kouhei Sutou +# Copyright(C) 2012-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,13 +12,13 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc --source ../../include/mroonga/check_mariadb.inc -if ($version_100_or_later) { +if ($version_5_5) { if ($mariadb) { - skip This test is not for MariaDB 10.x; + --skip This test is not for MariaDB 5.5.x } } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc similarity index 85% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc index e29fae84d46..633450e9c0d 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,13 +12,13 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc --source ../../include/mroonga/check_mariadb.inc -if ($version_55) { +if ($version_5_5) { if (!$mariadb) { - skip This test is not for MySQL 5.5.x; + --skip This test is not for MySQL 5.5.x } } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc similarity index 91% rename from storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc rename to storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc index 39ee22834e7..e984d60f760 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_57.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc @@ -12,13 +12,13 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_version.inc --source ../../include/mroonga/check_mariadb.inc -if ($version_57) { +if ($version_5_7) { if (!$mariadb) { - skip This test is not for MySQL 5.7.x; + --skip This test is not for MySQL 5.7.x } } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc new file mode 100644 index 00000000000..075e6044197 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_5_7_or_later) { + if (!$mariadb) { + --skip This test is not for MySQL 5.7.x or later + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc index 45a70d34ad7..c2979589211 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_osx.inc if ($VERSION_COMPILE_OS_OSX) { - skip This test is not for OSX; + --skip This test is not for OSX } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc new file mode 100644 index 00000000000..1ba1d09be60 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_64bit.inc +--source ../../include/mroonga/check_osx.inc + +if ($version_compile_64bit) { + --skip This test is for environment that doesn't have signed 64bit time_t +} + +if ($version_compile_os_osx) { + if (!$version_compile_os_osx_10_8_or_later) { + --skip This test is not for OS X 10.7 or earlier that isn't detected signed 64bit time_t availability + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc new file mode 100644 index 00000000000..6bf74224923 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_solaris.inc + +if ($version_compile_os_solaris) { + --skip This test is not for Solaris +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc deleted file mode 100644 index 7cee5c38c53..00000000000 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc +++ /dev/null @@ -1,3 +0,0 @@ -if (`SELECT @@version_compile_os='solaris10'`) { - skip This test is not for Solaris 10; -} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc new file mode 100644 index 00000000000..fc0d665b302 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_strict_sql_mode.inc + +if ($strict_sql_mode) { + --skip This test is not for STRICT_ALL_TABLES nor STRICT_TRANS_TABLES +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc index 5e21a446f1b..249c6b59b17 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_libgroonga_support_lz4.inc if (!$libgroonga_support_lz4) { --source ../../include/mroonga/have_mroonga_deinit.inc - skip "This test is for libgroonga supports lz4"; + --skip This test is for libgroonga supports lz4 } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc index d04826aa7dd..fd8b9e998a0 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_libgroonga_support_zlib.inc if (!$libgroonga_support_zlib) { --source ../../include/mroonga/have_mroonga_deinit.inc - skip "This test is for libgroonga supports zlib"; + --skip This test is for libgroonga supports zlib } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc new file mode 100644 index 00000000000..0e7ca446020 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_libgroonga_support_zstd.inc + +if (!$libgroonga_support_zstd) { + --source ../../include/mroonga/have_mroonga_deinit.inc + --skip This test is for libgroonga supports zstd +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc index 8d0d13f9125..cbe345a7e04 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,11 +12,15 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --disable_query_log DROP FUNCTION last_insert_grn_id; DROP FUNCTION mroonga_snippet; DROP FUNCTION mroonga_command; DROP FUNCTION mroonga_escape; +DROP FUNCTION mroonga_snippet_html; +DROP FUNCTION mroonga_normalize; +DROP FUNCTION mroonga_highlight_html; +DROP FUNCTION mroonga_query_expand; --enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc index dcc049078f8..210058edc3c 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_libgroonga_support_lz4.inc if ($libgroonga_support_lz4) { --source ../../include/mroonga/have_mroonga_deinit.inc - skip "This test is for libgroonga doesn't support lz4"; + --skip This test is for libgroonga doesn't support lz4 } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc index 7533f786f22..cb00da15a87 100644 --- a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/check_libgroonga_support_zlib.inc if ($libgroonga_support_zlib) { --source ../../include/mroonga/have_mroonga_deinit.inc - skip "This test is for libgroonga doesn't support zlib"; + --skip This test is for libgroonga doesn't support zlib } diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc new file mode 100644 index 00000000000..037e66a9e7c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/check_libgroonga_support_zstd.inc + +if ($libgroonga_support_zstd) { + --source ../../include/mroonga/have_mroonga_deinit.inc + --skip This test is for libgroonga doesn't support zstd +} diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result index 16077d23155..15cd3499d4c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result @@ -1,22 +1,22 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -body TEXT +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 -ALTER TABLE diaries ADD title TEXT AFTER id; +ALTER TABLE diaries ADD title VARCHAR(40) AFTER id; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result index 2e1e87ab722..8b3de1bf7de 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result @@ -1,22 +1,22 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -body TEXT +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 -ALTER TABLE diaries ADD title TEXT FIRST; +ALTER TABLE diaries ADD title VARCHAR(40) FIRST; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result index e441df32c92..de0482e626c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result @@ -4,6 +4,11 @@ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + table_create tags TABLE_PAT_KEY UInt32 column_create tags id COLUMN_SCALAR UInt32 column_create tags name COLUMN_VECTOR ShortText diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result index 6f2a1870ac7..b3c9875faeb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result @@ -11,6 +11,11 @@ tags CREATE TABLE `tags` ( ) ENGINE=Mroonga DEFAULT CHARSET=utf8 SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + table_create tags TABLE_PAT_KEY UInt32 column_create tags id COLUMN_SCALAR UInt32 column_create tags name COLUMN_VECTOR ShortText diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result index 0bd8985f2e8..8a1c18b731d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result @@ -7,12 +7,17 @@ id INT UNSIGNED PRIMARY KEY ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY UInt32 -column_create tags id COLUMN_SCALAR UInt32 - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 + column_create bugs name COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result index fe484372999..85330471c44 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result @@ -10,17 +10,21 @@ Table Create Table bugs CREATE TABLE `bugs` ( `id` int(10) unsigned NOT NULL, `name` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags', - PRIMARY KEY (`id`), - CONSTRAINT `name` FOREIGN KEY (`name`) REFERENCES `test`.`tags` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT + PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY UInt32 -column_create tags id COLUMN_SCALAR UInt32 - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 + column_create bugs name COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result new file mode 100644 index 00000000000..6fb1a1071f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int PRIMARY KEY +) DEFAULT CHARSET=cp932; +ALTER TABLE users +ADD COLUMN –¼‘O text, +ADD FULLTEXT INDEX (–¼‘O); +INSERT INTO users VALUES (1, "‚â‚Ü‚¾"); +INSERT INTO users VALUES (2, "‚½‚È‚©"); +INSERT INTO users VALUES (3, "‚·‚¸‚«"); +SELECT * FROM users; +id –¼‘O +1 ‚â‚Ü‚¾ +2 ‚½‚È‚© +3 ‚·‚¸‚« +SELECT * FROM users +WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +id –¼‘O +2 ‚½‚È‚© +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_PAT_KEY Int32 +column_create users @540d@524d COLUMN_SCALAR LongText +column_create users id COLUMN_SCALAR Int32 + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result new file mode 100644 index 00000000000..70c9ea0c546 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE users +ADD COLUMN åå‰ text, +ADD FULLTEXT INDEX (åå‰); +INSERT INTO users VALUES (1, "ã‚„ã¾ã "); +INSERT INTO users VALUES (2, "ãŸãªã‹"); +INSERT INTO users VALUES (3, "ã™ãšã"); +SELECT * FROM users; +id åå‰ +1 ã‚„ã¾ã  +2 ãŸãªã‹ +3 ã™ãšã +SELECT * FROM users +WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +id åå‰ +2 ãŸãªã‹ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_PAT_KEY Int32 +column_create users @540d@524d COLUMN_SCALAR LongText +column_create users id COLUMN_SCALAR Int32 + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result index 2222334060c..6c6024e4773 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result @@ -1,13 +1,13 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT +title VARCHAR(40) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title) VALUES ("survey"); @@ -15,7 +15,7 @@ SELECT * FROM diaries; id title 1 survey ALTER TABLE diaries -ADD COLUMN body TEXT FIRST, +ADD COLUMN body VARCHAR(140) FIRST, ADD COLUMN published BOOLEAN AFTER id, ADD COLUMN created_at DATETIME; UPDATE diaries SET body = "will start groonga!"; @@ -34,10 +34,10 @@ started groonga. 3 0 groonga (2) 2014-02-09 12:19:00 SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, `published` tinyint(1) DEFAULT NULL, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, `created_at` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result index a7bb15d5c84..5a5d3715621 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result @@ -1,20 +1,20 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT +title VARCHAR(40) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; id title 1 survey -ALTER TABLE diaries ADD COLUMN body TEXT; +ALTER TABLE diaries ADD COLUMN body VARCHAR(140); UPDATE diaries SET body = "will start groonga!"; SELECT * FROM diaries; id title body @@ -30,8 +30,8 @@ SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result index b4c3044c7d5..5136282687c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result @@ -7,12 +7,17 @@ id INT UNSIGNED PRIMARY KEY ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY UInt32 -column_create tags id COLUMN_SCALAR UInt32 - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 + column_create bugs name COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result index 65e608dddeb..373c70e81be 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result @@ -11,7 +11,12 @@ mroonga_command("dump --dump_plugins no") table_create memos TABLE_NO_KEY column_create memos content COLUMN_SCALAR ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result index 974cb125626..a9b192e999e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result @@ -1,24 +1,24 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 -ALTER TABLE diaries CHANGE body description TEXT AFTER id; +ALTER TABLE diaries CHANGE body description VARCHAR(140) AFTER id; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` text DEFAULT NULL, - `title` text DEFAULT NULL, + `description` varchar(140) DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result index 5baf7cdb125..4faf39ad1ad 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result @@ -1,24 +1,24 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 -ALTER TABLE diaries CHANGE body description TEXT FIRST; +ALTER TABLE diaries CHANGE body description VARCHAR(140) FIRST; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `description` text DEFAULT NULL, + `description` varchar(140) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result index c8360f2fbfa..f640e8de23b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result @@ -1,34 +1,32 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 ALTER TABLE diaries -CHANGE body description TEXT FIRST, -CHANGE title subject TEXT AFTER internal_id, -CHANGE id internal_id INT; +CHANGE body description VARCHAR(140) FIRST, +CHANGE title subject VARCHAR(40) AFTER internal_id, +CHANGE id internal_id INT AUTO_INCREMENT; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `description` text DEFAULT NULL, - `internal_id` int(11) NOT NULL, - `subject` text DEFAULT NULL, + `description` varchar(140) DEFAULT NULL, + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `subject` varchar(40) DEFAULT NULL, PRIMARY KEY (`internal_id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT IGNORE INTO diaries (subject, description) VALUES ("groonga (1)", "starting groonga."); -Warnings: -Warning 1364 Field 'internal_id' doesn't have a default value SELECT * FROM diaries; description internal_id subject -starting groonga. 0 groonga (1) +starting groonga. 1 groonga (1) DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result index de6f0e3abc0..d49acc52611 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result @@ -1,24 +1,24 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 -ALTER TABLE diaries CHANGE body description TEXT; +ALTER TABLE diaries CHANGE body description VARCHAR(140); SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `description` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `description` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result similarity index 62% rename from storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result rename to storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result index cf4fc866335..dc2ae025336 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result @@ -1,37 +1,34 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, temperature DECIMAL(6, 3) ) ENGINE InnoDB DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, `temperature` decimal(6,3) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (temperature) VALUES (21.281); SELECT * FROM diaries; -id title temperature -1 clear day 21.281 +id temperature +1 21.281 ALTER TABLE diaries ENGINE = mroonga; SELECT * FROM diaries; -id title temperature -1 clear day 21.281 -INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); -INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +id temperature +1 21.281 +INSERT INTO diaries (temperature) VALUES (14.213); +INSERT INTO diaries (temperature) VALUES (17.821); SELECT * FROM diaries; -id title temperature -1 clear day 21.281 -2 rainy day 14.213 -3 cloudy day 17.821 +id temperature +1 21.281 +2 14.213 +3 17.821 SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, `temperature` decimal(6,3) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result similarity index 62% rename from storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result rename to storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result index fb1cb9b5a93..706764a5105 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result @@ -6,16 +6,11 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) ENGINE MyISAM DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries MyISAM INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); SELECT * FROM diaries @@ -24,16 +19,11 @@ MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); id title body 1 survey will start groonga! ALTER TABLE diaries ENGINE = mroonga; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries Mroonga SELECT * FROM diaries WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result index 60d302cc6a5..9fc3b408474 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result @@ -12,14 +12,19 @@ FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI -column_create terms is_stop_word COLUMN_SCALAR Int8 -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText + column_create terms content COLUMN_INDEX|WITH_POSITION memos content ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; SELECT mroonga_command("dump --dump_plugins no"); @@ -28,6 +33,11 @@ table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord column_create terms is_stop_word COLUMN_SCALAR Int8 column_create terms term COLUMN_SCALAR ShortText @@ -39,6 +49,11 @@ table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord column_create terms is_stop_word COLUMN_SCALAR Int8 column_create terms term COLUMN_SCALAR ShortText diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result index ba6cf6c24ed..7416481e390 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result @@ -10,22 +10,32 @@ FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText + column_create terms content_index COLUMN_INDEX|WITH_POSITION memos content ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result index 26c429846ea..a8b8edf2f63 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result @@ -1,15 +1,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result index c911eecda3a..569bba2f557 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result @@ -1,15 +1,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); @@ -21,7 +21,7 @@ SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result index 452caa574f9..7b3b2863e5f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result @@ -11,22 +11,32 @@ FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText + column_create terms content_index COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result index 5910f28ddb3..cf6840a9897 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result @@ -7,15 +7,7 @@ INSERT INTO memos (content) values ("Starting Groonga..."); INSERT INTO memos (content) values ("Started Groonga."); INSERT INTO memos (content) values ("Starting Mroonga..."); ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content_index` (`content`) -) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 -SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); +SELECT * FROM memos WHERE MATCH(content) AGAINST("+groonga" IN BOOLEAN MODE); id content 1 Starting Groonga... 2 Started Groonga. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result index 2893f417f41..9b7040bd5c8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result @@ -1,28 +1,28 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); SELECT * FROM diaries; id title body 1 groonga (1) starting groonga. -ALTER TABLE diaries MODIFY body TEXT AFTER id; +ALTER TABLE diaries MODIFY body VARCHAR(140) AFTER id; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - `title` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result index a26249a81e7..f6b3df92c67 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result @@ -1,28 +1,28 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); SELECT * FROM diaries; id title body 1 groonga (1) starting groonga. -ALTER TABLE diaries MODIFY body TEXT FIRST; +ALTER TABLE diaries MODIFY body VARCHAR(140) FIRST; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result index 6d3f4b83f37..e156a7fda03 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result @@ -1,15 +1,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, -body TEXT +title VARCHAR(40), +body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); @@ -22,7 +22,7 @@ Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) DEFAULT NULL, - `body` text DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result index b96bf53ee1c..6ee8f8bafc1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result @@ -5,15 +5,6 @@ title TEXT, body TEXT, FULLTEXT INDEX (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); SELECT * FROM diaries; @@ -35,13 +26,4 @@ SELECT * FROM diaries WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); id title body 1 survey will start groonga! -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result index 043ef2db430..84861ea7162 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result @@ -6,16 +6,11 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries Mroonga INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; id title body @@ -32,14 +27,9 @@ SELECT * FROM memos WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); id title body -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'memos'; +table_name engine +memos Mroonga DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result index 0ec5b2cebe8..ac1a096de4a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS shops; CREATE TABLE shops ( id INT PRIMARY KEY AUTO_INCREMENT, -name TEXT, +name VARCHAR(40), location GEOMETRY NOT NULL ); INSERT INTO shops (name, location) @@ -124,7 +124,7 @@ SHOW CREATE TABLE shops; Table Create Table shops CREATE TABLE `shops` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, + `name` varchar(40) DEFAULT NULL, `location` geometry NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `location_index` (`location`) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result new file mode 100644 index 00000000000..4926a72a77a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result @@ -0,0 +1,18 @@ +SET NAMES UTF8; +CREATE DATABASE check_test; +USE check_test; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +INSERT INTO diaries VALUES ('Hello'); +FLUSH TABLES; +CHECK TABLE diaries; +Table Op Msg_type Msg_text +check_test.diaries check error Corrupt +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +check_test.diaries repair status OK +DROP TABLE diaries; +DROP DATABASE check_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result new file mode 100644 index 00000000000..def3368ecac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result @@ -0,0 +1,13 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT +); +INSERT INTO diaries VALUES ('Hello'); +CHECK TABLE diaries; +Table Op Msg_type Msg_text +test.diaries check status OK +SELECT * FROM diaries; +title +Hello +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result index ab03fe97083..9aec8dd6e79 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, +title VARCHAR(40), created_at DATE, KEY (created_at) ) DEFAULT CHARSET UTF8; @@ -9,7 +9,7 @@ SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, `created_at` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `created_at` (`created_at`) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result index be5aba2020a..4d2166eca0a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result @@ -1,14 +1,14 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, -title TEXT, +title VARCHAR(40), created_at DATE ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, `created_at` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result index c5764cc110c..712d87ca251 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); INSERT IGNORE INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result index a85d60af383..85f091cca86 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT IGNORE INTO diaries (title, created_at) VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); Warnings: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result index 71dfa08c762..9d9e2f610fa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT IGNORE INTO diaries (title, created_at) VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); Warnings: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result index 6044e24ad61..99611268724 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT IGNORE INTO diaries (title, created_at) VALUES ('2012', '2012'); Warnings: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result index f2bc6332be6..f0f03a82c98 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); INSERT INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result index 778ecf29dca..8a775960ef7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result @@ -4,17 +4,9 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) -VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +VALUES ('1000-01-02 00:00:00', '1000-01-02 00:00:00'); SELECT * FROM diaries; id title created_at -1 1000-01-01 00:00:00 1000-01-01 00:00:00 +1 1000-01-02 00:00:00 1000-01-02 00:00:00 DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result index 1477f32ce67..44d20d972f2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result new file mode 100644 index 00000000000..2d5e5e64147 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +ERROR 22007: Incorrect datetime value: '2012' for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result similarity index 65% rename from storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result rename to storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result index 733217fda85..21e715e1f63 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); Warnings: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result similarity index 59% rename from storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result rename to storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result index db22d3d4c7c..3500d651765 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result @@ -4,16 +4,8 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 -SET STATEMENT sql_mode = '' FOR -INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); Warnings: Warning 1265 Data truncated for column 'created_at' at row 1 Warning 1265 Data truncated for column 'created_at' at row 1 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result index db44acf133c..e7094fd4e55 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result @@ -5,15 +5,6 @@ title TEXT, created_at DATETIME(6), KEY (created_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime(6) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `created_at` (`created_at`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01.111111"); INSERT INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result index 21d18bcfe7d..028fb2577a2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME(6) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime(6) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01.111111"); INSERT INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result index 10824d7c28d..a48be4da873 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); Warnings: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result similarity index 61% rename from storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result rename to storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result index c4d73e2f57d..ffd6a707605 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date_strict.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result @@ -3,17 +3,8 @@ CREATE TABLE timestamps ( id INT PRIMARY KEY AUTO_INCREMENT, create_dt DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE timestamps; -Table Create Table -timestamps CREATE TABLE `timestamps` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `create_dt` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 -SET sql_mode='STRICT_TRANS_TABLES'; INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); ERROR 22003: Out of range value for column 'create_dt' at row 1 -SET sql_mode=default; SELECT * FROM timestamps; id create_dt INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result new file mode 100644 index 00000000000..61d2ed8dfd3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result new file mode 100644 index 00000000000..0ca19e548f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; +id create_dt +1 2015-06-17 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result new file mode 100644 index 00000000000..94479c2307d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +ERROR 22007: Incorrect datetime value: '2012-00-01 00:00:00' for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +ERROR 22007: Incorrect datetime value: '2012-01-00 00:00:00' for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result index 849d7d833b4..510fa2dc061 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ('NULL', NULL); SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result index 9c460234261..6f79b31fe24 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result @@ -5,15 +5,6 @@ title TEXT, created_at DATETIME, KEY (created_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `created_at` (`created_at`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01"); INSERT INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result index b6c2b882c8f..8a45ece7813 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01"); INSERT INTO diaries (title, created_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result index 4e05f0a2c52..659c574202a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result @@ -3,27 +3,14 @@ CREATE TABLE timestamps ( id INT PRIMARY KEY AUTO_INCREMENT, create_dt DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE timestamps; -Table Create Table -timestamps CREATE TABLE `timestamps` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `create_dt` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 -SET sql_mode=''; -INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); -Warnings: -Warning 1265 Data truncated for column 'create_dt' at row 1 -INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); -Warnings: -Warning 1265 Data truncated for column 'create_dt' at row 1 -SET sql_mode = DEFAULT; +SET sql_mode='STRICT_TRANS_TABLES'; +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +SET sql_mode=default; SELECT * FROM timestamps; id create_dt -1 2012-01-01 00:00:00 -2 2012-01-01 00:00:00 -SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; id create_dt -1 2012-01-01 00:00:00 -2 2012-01-01 00:00:00 +2 2015-06-17 00:00:00 DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result new file mode 100644 index 00000000000..03633a50b7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result index 8dc2d847acc..196e4b80f60 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result @@ -5,15 +5,6 @@ title TEXT, temperature DECIMAL(6, 3), KEY (temperature) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `temperature` decimal(6,3) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `temperature` (`temperature`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result index 0b3fd4c53e1..b67846bb29c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, temperature DECIMAL(6, 3) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `temperature` decimal(6,3) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result index 97eda9f237a..620e9b6906c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result @@ -5,15 +5,6 @@ title TEXT, temperature DECIMAL, KEY (temperature) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `temperature` decimal(10,0) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `temperature` (`temperature`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result index b635f4db2b7..1ba47b3494a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, temperature DECIMAL ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `temperature` decimal(10,0) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result new file mode 100644 index 00000000000..20213f0cbf8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result new file mode 100644 index 00000000000..1ee7d8f6570 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result new file mode 100644 index 00000000000..5b51851660e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result new file mode 100644 index 00000000000..ff22175ec06 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result new file mode 100644 index 00000000000..fac82467712 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result new file mode 100644 index 00000000000..71fc442dd6f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "shutdown"} "shutdown" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result new file mode 100644 index 00000000000..27c9effc2ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result new file mode 100644 index 00000000000..260c774e200 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs; +id record message +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result new file mode 100644 index 00000000000..bc9339ab074 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result new file mode 100644 index 00000000000..92463c94595 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result new file mode 100644 index 00000000000..1a502edf29b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ALTER TABLE logs ADD INDEX (message); +ERROR HY000: mroonga: storage: failed to create index: Index for virtual generated column is not supported: message +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result new file mode 100644 index 00000000000..16acc89bf09 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL, +FULLTEXT INDEX (message) +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ERROR HY000: mroonga: storage: failed to create index: Index for virtual generated column is not supported: message diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result new file mode 100644 index 00000000000..93046e39ba5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ALTER TABLE logs ADD INDEX (message); +ERROR HY000: Table storage engine 'Mroonga' does not support the create option 'Index on virtual generated column' +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result new file mode 100644 index 00000000000..c4e46d0d4f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "shutdown"} "shutdown" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result index 724d20edd62..f9fc8366270 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result @@ -14,12 +14,17 @@ FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); SELECT mroonga_command("dump --dump_plugins no --dump_records no"); mroonga_command("dump --dump_plugins no --dump_records no") -table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit -column_create tags name COLUMN_SCALAR ShortText - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit +column_create tags name COLUMN_SCALAR ShortText + column_create bugs tags COLUMN_VECTOR tags column_create tags bugs_tags_index COLUMN_INDEX|WITH_POSITION bugs tags diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result index aa7735ef780..0f57885cdb9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result @@ -15,15 +15,20 @@ INSERT INTO bugs (id, priority) VALUES (2, 3); INSERT INTO bugs (id, priority) VALUES (3, -2); SELECT mroonga_command("dump --dump_plugins no --dump_records no"); mroonga_command("dump --dump_plugins no --dump_records no") -table_create priorities TABLE_PAT_KEY Int32 -column_create priorities id COLUMN_SCALAR Int32 - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create priorities TABLE_PAT_KEY Int32 +column_create priorities id COLUMN_SCALAR Int32 + column_create bugs priority COLUMN_SCALAR priorities -column_create priorities bugs_priority_index COLUMN_INDEX|WITH_POSITION bugs priority +column_create priorities bugs_priority_index COLUMN_INDEX bugs priority SELECT * FROM bugs WHERE priority = 3; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.result new file mode 100644 index 00000000000..a9c917f8c8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS entries; +CREATE TABLE entries ( +id INT UNSIGNED PRIMARY KEY, +content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZSTD"' +) DEFAULT CHARSET=utf8; +INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!"); +SELECT * FROM entries; +id content +1 I found Mroonga that is a MySQL storage engine to use Groonga! +DROP TABLE entries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.result new file mode 100644 index 00000000000..b2bb3b89c13 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS entries; +CREATE TABLE entries ( +id INT UNSIGNED PRIMARY KEY, +content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZSTD"' +) DEFAULT CHARSET=utf8; +Warnings: +Warning 16506 The column flag 'COMPRESS_ZSTD' is unsupported. It is ignored +INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!"); +SELECT * FROM entries; +id content +1 I found Mroonga that is a MySQL storage engine to use Groonga! +DROP TABLE entries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result index 515dad1da2e..a6afe72faff 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result @@ -6,8 +6,15 @@ COLLATE=utf8_bin COMMENT='default_tokenizer "TokenDelimit"'; CREATE TABLE bugs ( id INT UNSIGNED PRIMARY KEY, -tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +tags VARCHAR(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"' ) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tags` varchar(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); SELECT * FROM bugs; id tags diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result new file mode 100644 index 00000000000..e6a3aa5ea89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs VALUES ('{"message": "start"}'); +INSERT INTO logs VALUES ('{"message": "restart"}'); +INSERT INTO logs VALUES ('{"message": "shutdown"}'); +SELECT * FROM logs; +record +{"message": "start"} +{"message": "restart"} +{"message": "shutdown"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result new file mode 100644 index 00000000000..eb1a08f2cd3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +–¼‘O text, +FULLTEXT INDEX (–¼‘O) +) DEFAULT CHARSET=cp932; +INSERT INTO users VALUES ("‚â‚Ü‚¾"); +INSERT INTO users VALUES ("‚½‚È‚©"); +INSERT INTO users VALUES ("‚·‚¸‚«"); +SELECT * FROM users; +–¼‘O +‚â‚Ü‚¾ +‚½‚È‚© +‚·‚¸‚« +SELECT * FROM users +WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +–¼‘O +‚½‚È‚© +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_NO_KEY +column_create users @540d@524d COLUMN_SCALAR LongText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result new file mode 100644 index 00000000000..6f63b5b3856 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +åå‰ text, +FULLTEXT INDEX (åå‰) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES ("ã‚„ã¾ã "); +INSERT INTO users VALUES ("ãŸãªã‹"); +INSERT INTO users VALUES ("ã™ãšã"); +SELECT * FROM users; +åå‰ +ã‚„ã¾ã  +ãŸãªã‹ +ã™ãšã +SELECT * FROM users +WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +åå‰ +ãŸãªã‹ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_NO_KEY +column_create users @540d@524d COLUMN_SCALAR LongText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result index fa631bc8471..35434a00160 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result @@ -6,16 +6,6 @@ average TIME(6), max TIME(6), KEY (average) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; -Table Create Table -running_records CREATE TABLE `running_records` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `average` time(6) DEFAULT NULL, - `max` time(6) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `average` (`average`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO running_records (title, average, max) VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); INSERT INTO running_records (title, average, max) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result index 3f0b664d4fe..a0b0350a8e3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result @@ -6,16 +6,6 @@ average TIME, max TIME, KEY (average) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; -Table Create Table -running_records CREATE TABLE `running_records` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `average` time DEFAULT NULL, - `max` time DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `average` (`average`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO running_records (title, average, max) VALUES ("normal condition", "01:00:00", "01:05:00"); INSERT INTO running_records (title, average, max) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result index cd75598a7ee..7ccb1fa234b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result @@ -6,16 +6,6 @@ created_at TIMESTAMP(6), updated_at TIMESTAMP(6), KEY (updated_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - PRIMARY KEY (`id`), - KEY `updated_at` (`updated_at`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at, updated_at) VALUES ("clear day", "2012-01-29 21:51:01.111111", diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result index 3f93ce03ca6..4c221d9ecb6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result @@ -2,20 +2,10 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, -created_at TIMESTAMP, -updated_at TIMESTAMP, +created_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', +updated_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', KEY (updated_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`id`), - KEY `updated_at` (`updated_at`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, created_at, updated_at) VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); INSERT INTO diaries (title, created_at, updated_at) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result index 1fc8e146c17..be97d4fc9cb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result @@ -5,15 +5,6 @@ title TEXT, party_year YEAR, KEY (party_year) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; -Table Create Table -aniversary_memos CREATE TABLE `aniversary_memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `party_year` year(4) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `party_year` (`party_year`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO aniversary_memos (title, party_year) VALUES ("We need a big cake!", "11"); INSERT INTO aniversary_memos (title, party_year) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result index c55bc4c6df5..a56271bccf1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, party_year YEAR ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; -Table Create Table -aniversary_memos CREATE TABLE `aniversary_memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `party_year` year(4) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO aniversary_memos (title, party_year) VALUES ("We need a big cake!", "11"); INSERT INTO aniversary_memos (title, party_year) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result b/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result new file mode 100644 index 00000000000..ab6be3a7b77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int PRIMARY KEY +); +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +SELECT COUNT(*) FROM ids; +COUNT(*) +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result index 54a9a274835..d2a00b777ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result @@ -64,7 +64,7 @@ drop table t1; create table t1 (c1 timestamp); desc t1; Field Type Null Key Default Extra -c1 timestamp NO current_timestamp() on update current_timestamp() +c1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP drop table t1; create table t1 (c1 datetime); desc t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result similarity index 60% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result index af3c19e9bb0..e4c4ea059e7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result @@ -7,4 +7,9 @@ mroonga_command("dump --dump_plugins no") table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 column_create bugs tags COLUMN_VECTOR LongText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result similarity index 59% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result index 63bf6f666e7..9923b91f477 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_flags_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result @@ -2,16 +2,14 @@ CREATE TABLE bugs ( id INT UNSIGNED PRIMARY KEY, tags TEXT FLAGS='COLUMN_VECTOR' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE bugs; -Table Create Table -bugs CREATE TABLE `bugs` ( - `id` int(10) unsigned NOT NULL, - `tags` text DEFAULT NULL `FLAGS`='COLUMN_VECTOR', - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 column_create bugs tags COLUMN_VECTOR LongText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result similarity index 70% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result index 5e5980ac62b..7dede867136 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result @@ -7,12 +7,17 @@ tag VARCHAR(64) COMMENT 'groonga_type "tags"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY ShortText -column_create tags name COLUMN_SCALAR ShortText - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + column_create bugs tag COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_nonexistent.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_nonexistent.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_nonexistent.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result similarity index 74% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result index 24941f043c7..89e28aea6cf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_groonga_type_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result @@ -10,17 +10,21 @@ Table Create Table bugs CREATE TABLE `bugs` ( `id` int(10) unsigned NOT NULL, `tag` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags', - PRIMARY KEY (`id`), - CONSTRAINT `tag` FOREIGN KEY (`tag`) REFERENCES `test`.`tags` (`name`) ON DELETE RESTRICT ON UPDATE RESTRICT + PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY ShortText -column_create tags name COLUMN_SCALAR ShortText - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + column_create bugs tag COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result similarity index 70% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result index dc3f39d286e..357adfdfbd4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result @@ -7,12 +7,17 @@ tag VARCHAR(64) COMMENT 'type "tags"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create tags TABLE_PAT_KEY ShortText -column_create tags name COLUMN_SCALAR ShortText - table_create bugs TABLE_PAT_KEY UInt32 column_create bugs id COLUMN_SCALAR UInt32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + column_create bugs tag COLUMN_SCALAR tags DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_nonexistent.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/create_table_field_type_nonexistent.result rename to storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_nonexistent.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result index 9302037b7e1..0c33fac1deb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result @@ -5,6 +5,11 @@ COLLATE=utf8_bin COMMENT='default_tokenizer "TokenDelimit"'; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit column_create tags name COLUMN_SCALAR ShortText DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result index 828de3ebbad..8d39cac4ee8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result new file mode 100644 index 00000000000..e9d90b0bd48 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result @@ -0,0 +1,10 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +content_size INT NOT NULL, +KEY (content_size) COMMENT 'flags "INDEX_MEDIUM"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); +mroonga_command("dump --dump_plugins no --dump_schema no") +column_create memos#content_size index COLUMN_INDEX|INDEX_MEDIUM memos content_size +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result new file mode 100644 index 00000000000..38a83b899a3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result @@ -0,0 +1,10 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +is_read BOOL NOT NULL, +KEY (is_read) COMMENT 'flags "INDEX_SMALL"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); +mroonga_command("dump --dump_plugins no --dump_schema no") +column_create memos#is_read index COLUMN_INDEX|INDEX_SMALL memos is_read +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result index b5368b433e6..e90fd833d17 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'flags "NONE"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX memos content +column_create memos#content index COLUMN_INDEX memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result index 7e0d29a1e1f..8fbbd197f6c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result @@ -11,5 +11,5 @@ memos CREATE TABLE `memos` ( ) ENGINE=Mroonga DEFAULT CHARSET=utf8 SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result index c9283db72bb..3d31400fbbe 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX memos content +column_create memos#content index COLUMN_INDEX memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result index 853845d5c15..8f0c4995343 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result new file mode 100644 index 00000000000..b6da79c72c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +day content +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); +day content +2013-04-23 ブラックコーヒーを飲んã ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result new file mode 100644 index 00000000000..2a05ccdc62c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create diaries TABLE_PAT_KEY Time +column_create diaries content COLUMN_SCALAR ShortText +column_create diaries day COLUMN_SCALAR Time + +table_create diaries#content TABLE_PAT_KEY ShortText --normalizer NormalizerAuto + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create diaries#content index COLUMN_INDEX diaries content +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result index 5b593ef0383..29f27d156f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result @@ -5,15 +5,11 @@ body text, FULLTEXT INDEX body_index (body) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead INSERT INTO diaries (body) VALUES ("will start Groonga!"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead INSERT INTO diaries (body) VALUES ("starting Groonga..."); INSERT INTO diaries (body) VALUES ("started Groonga."); SELECT * FROM diaries; @@ -29,3 +25,5 @@ id body 2 starting Groonga... 3 started Groonga. DROP TABLE diaries; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result index 284ecdb6184..7f9ddd50e92 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result @@ -6,14 +6,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result index c3791d10399..320fb9a5635 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result @@ -4,15 +4,11 @@ id INT PRIMARY KEY AUTO_INCREMENT, name TEXT, FULLTEXT INDEX (name) COMMENT 'parser "off"' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE variables; -Table Create Table -variables CREATE TABLE `variables` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `name` (`name`) COMMENT 'parser "off"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead INSERT INTO variables (name) VALUES ("mroonga_default_parser"); INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); INSERT INTO variables (name) VALUES ("mroonga_dry_write"); @@ -40,3 +36,5 @@ id name 3 mroonga_default_wrapper_engine 2 mroonga_default_parser DROP TABLE variables; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result index c730bafc8e3..ad68ca010cc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result @@ -11,7 +11,12 @@ mroonga_command("dump --dump_plugins no") table_create memos TABLE_NO_KEY column_create memos content COLUMN_SCALAR ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result index e0809eb0f4b..2cbb5a6b2e7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result @@ -11,7 +11,12 @@ mroonga_command("dump --dump_plugins no") table_create memos TABLE_NO_KEY column_create memos content COLUMN_SCALAR ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result index df529282a91..333cf3d5d1f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result @@ -17,7 +17,12 @@ mroonga_command("dump --dump_plugins no") table_create memos TABLE_NO_KEY column_create memos content COLUMN_SCALAR ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result index 7c02b18d6a2..a390421684a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result @@ -5,14 +5,6 @@ body text, FULLTEXT INDEX body_index (body) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); INSERT INTO diaries (body) VALUES ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result index b55a2ae52ee..34545ecc30a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result @@ -6,14 +6,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result index d332795199f..91a5b96d184 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, name TEXT, FULLTEXT INDEX (name) COMMENT 'tokenizer "off"' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE variables; -Table Create Table -variables CREATE TABLE `variables` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `name` (`name`) COMMENT 'tokenizer "off"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result index 0edc0a1b18e..c827abe2cf4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result @@ -4,14 +4,6 @@ id int PRIMARY KEY AUTO_INCREMENT, body text, FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) `TOKENIZER`='TokenBigramSplitSymbolAlphaDigit' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); INSERT INTO diaries (body) VALUES ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result index 6308b33d4cf..8934be78d47 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result @@ -12,14 +12,19 @@ FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord -column_create terms is_stop_word COLUMN_SCALAR Int8 -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText + column_create terms content COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result index 2f4a90d4086..e3df285093b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result @@ -12,14 +12,19 @@ FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") -table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord -column_create terms is_stop_word COLUMN_SCALAR Int8 -column_create terms term COLUMN_SCALAR ShortText - table_create memos TABLE_PAT_KEY Int32 column_create memos content COLUMN_SCALAR LongText column_create memos id COLUMN_SCALAR Int32 +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText + column_create terms content COLUMN_INDEX|WITH_POSITION memos content DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result new file mode 100644 index 00000000000..ebc7db1cf37 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result @@ -0,0 +1,20 @@ +SET NAMES UTF8; +DROP DATABASE IF EXISTS another; +CREATE DATABASE another; +USE another; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +DROP TABLE diaries; +USE test; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +DROP DATABASE another; +SELECT mroonga_command('object_exist mroonga_operations'); +mroonga_command('object_exist mroonga_operations') +true +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result new file mode 100644 index 00000000000..e2e712af4b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned +); +ALTER TABLE articles ADD FOREIGN KEY (comment) REFERENCES comments (comment); +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result new file mode 100644 index 00000000000..fc3cda00499 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +ALTER TABLE articles DROP FOREIGN KEY comment; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result index fc550d97f87..c17780c0441 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result @@ -1,39 +1,15 @@ -drop table if exists articles2; -drop table if exists articles; -drop table if exists comments2; -drop table if exists comments; -create table comments( -comment int unsigned, -content text not null, -primary key(comment) +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL ); -create table articles( -content text not null, +CREATE TABLE articles ( +content text NOT NULL, comment int unsigned, FOREIGN KEY (comment) REFERENCES comments (comment) ); -insert into comments (comment, content) values -(1, 'aaa bbb'),(2, 'ccc ddd'),(3, 'eee fff'); -insert into articles (content, comment) values -('111aaa', 1),('222bbb', 2),('222ccc', 2); -select comment, content from comments; -comment content -1 aaa bbb -2 ccc ddd -3 eee fff -select content, comment from articles; -content comment -111aaa 1 -222bbb 2 -222ccc 2 -show create table comments; -Table Create Table -comments CREATE TABLE `comments` ( - `comment` int(10) unsigned NOT NULL DEFAULT '0', - `content` text NOT NULL, - PRIMARY KEY (`comment`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -show create table articles; +SHOW CREATE TABLE articles; Table Create Table articles CREATE TABLE `articles` ( `content` text NOT NULL, @@ -41,107 +17,6 @@ articles CREATE TABLE `articles` ( KEY `comment` (`comment`), CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=Mroonga DEFAULT CHARSET=latin1 -select * from information_schema.referential_constraints; -CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME -def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments -rename table comments to comments2; -rename table articles to articles2; -create table comments( -comment int unsigned, -content text not null, -primary key(comment) -); -create table articles( -content text not null, -comment int unsigned, -FOREIGN KEY (comment) REFERENCES comments (comment) -); -insert into comments (comment, content) values -(1, 'ab'),(2, 'cd'),(3, 'ef'); -insert into articles (content, comment) values -('1a', 1),('2b', 2),('2c', 2); -select comment, content from comments; -comment content -1 ab -2 cd -3 ef -select content, comment from articles; -content comment -1a 1 -2b 2 -2c 2 -select comment, content from comments2; -comment content -1 aaa bbb -2 ccc ddd -3 eee fff -select content, comment from articles2; -content comment -111aaa 1 -222bbb 2 -222ccc 2 -show create table comments; -Table Create Table -comments CREATE TABLE `comments` ( - `comment` int(10) unsigned NOT NULL DEFAULT '0', - `content` text NOT NULL, - PRIMARY KEY (`comment`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -show create table articles; -Table Create Table -articles CREATE TABLE `articles` ( - `content` text NOT NULL, - `comment` int(10) unsigned DEFAULT NULL, - KEY `comment` (`comment`), - CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -show create table comments2; -Table Create Table -comments2 CREATE TABLE `comments2` ( - `comment` int(10) unsigned NOT NULL DEFAULT '0', - `content` text NOT NULL, - PRIMARY KEY (`comment`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -show create table articles2; -Table Create Table -articles2 CREATE TABLE `articles2` ( - `content` text NOT NULL, - `comment` int(10) unsigned DEFAULT NULL, - KEY `comment` (`comment`), - CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments2` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -select * from information_schema.referential_constraints; -CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME -def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments -def test comment def test PRIMARY NONE RESTRICT RESTRICT articles2 comments2 -alter table articles drop foreign key comment; -show create table articles; -Table Create Table -articles CREATE TABLE `articles` ( - `content` text NOT NULL, - `comment` int(10) unsigned DEFAULT NULL, - KEY `comment` (`comment`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -select content, comment from articles; -content comment -1a 1 -2b 2 -2c 2 -alter table articles add FOREIGN KEY (comment) REFERENCES comments (comment); -show create table articles; -Table Create Table -articles CREATE TABLE `articles` ( - `content` text NOT NULL, - `comment` int(10) unsigned DEFAULT NULL, - KEY `comment` (`comment`), - CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE=Mroonga DEFAULT CHARSET=latin1 -select content, comment from articles; -content comment -1a 1 -2b 2 -2c 2 -drop table articles2; -drop table articles; -drop table comments2; -drop table comments; +SELECT * FROM information_schema.referential_constraints; +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result new file mode 100644 index 00000000000..e16157b439f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 100; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (one or more child rows exist in ) +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result new file mode 100644 index 00000000000..edaba25fad8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 200; +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result new file mode 100644 index 00000000000..ddc54cb3f9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result @@ -0,0 +1,51 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result new file mode 100644 index 00000000000..c220bb8970b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result @@ -0,0 +1,37 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (foreign record doesn't exist: :<1>) +SELECT * FROM entries; +content comment_id +SELECT * FROM comments; +id content +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result new file mode 100644 index 00000000000..5ea0ae3e3ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +DROP TABLE IF EXISTS articles2; +DROP TABLE IF EXISTS comments2; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +RENAME TABLE comments TO comments2; +RENAME TABLE articles TO articles2; +SHOW CREATE TABLE articles2; +Table Create Table +articles2 CREATE TABLE `articles2` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments2` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles2 comments2 +DROP TABLE articles2; +DROP TABLE comments2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result new file mode 100644 index 00000000000..9db892d5d2d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result @@ -0,0 +1,55 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; +SELECT * FROM entries; +content comment_id +Hello! 200 +SELECT * FROM comments; +id content +100 Good entry! +200 Very good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100], +[200,"Very good entry!",200] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,200,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result new file mode 100644 index 00000000000..615c3a0903a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (foreign record doesn't exist: :<200>) +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result index a48eb25dece..5beda03ceb6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS memos; -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET NAMES UTF8; CREATE TABLE memos ( id INT PRIMARY KEY, @@ -15,4 +15,4 @@ id content 1 (groonga) Installed! 3 (groonga) Upgraded! DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result index 6452fe4398c..758f969feb8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result @@ -6,15 +6,6 @@ title VARCHAR(255), content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result new file mode 100644 index 00000000000..deb4bd85385 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*SS content @ '天気'" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*SS content @ '天気'" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠1 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result new file mode 100644 index 00000000000..43b21bc1cd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS items; +DROP TABLE IF EXISTS readings; +SET NAMES utf8; +CREATE TABLE readings ( +reading VARCHAR(255) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE items ( +name VARCHAR(255) PRIMARY KEY, +readings TEXT COMMENT 'flags "COLUMN_VECTOR", type "readings"', +FULLTEXT INDEX items_index(readings) COMMENT 'table "readings"' +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES("日本", "ニホン ニッãƒãƒ³"); +INSERT INTO items VALUES("ローマ字", "ローマジ"); +INSERT INTO items VALUES("漢字", "カンジ"); +SELECT *, MATCH(readings) +AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE) AS score +FROM items +WHERE MATCH(readings) +AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE); +name readings score +日本 ニホン ニッãƒãƒ³ 1 +DROP TABLE items; +DROP TABLE readings; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result index 5746ce89cb7..46dd3290565 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS memos; -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = ERROR; SET NAMES UTF8; CREATE TABLE memos ( @@ -14,4 +14,4 @@ SELECT * FROM memos WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result index 1811994b67e..d782357eef4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS memos; -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; SET NAMES UTF8; CREATE TABLE memos ( @@ -14,4 +14,4 @@ SELECT * FROM memos WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result index 6a4759963a3..fd5b8d1e0ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS memos; -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = "IGNORE"; SET NAMES UTF8; CREATE TABLE memos ( @@ -14,4 +14,4 @@ SELECT * FROM memos WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); id content DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result index 384d677c427..a485e1cad69 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result @@ -1,5 +1,5 @@ DROP TABLE IF EXISTS memos; -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; SET NAMES UTF8; CREATE TABLE memos ( @@ -14,4 +14,4 @@ SELECT * FROM memos WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); id content DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result index cc6c0131854..136585c38eb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result @@ -6,15 +6,6 @@ title VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci, content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, FULLTEXT INDEX (content) ) DEFAULT CHARSET utf8mb4; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); INSERT INTO diaries VALUES(2, "Mathmatics", "ð€ðð‚ðƒð„ | U+1D400-U+1D405"); INSERT INTO diaries VALUES(3, "ã²ã‚‰ãŒãª", "ã‚ã„ã†ãˆãŠ"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result index ebaa41fcfb7..25da7011aa4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result @@ -10,19 +10,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result index faed6cffe54..e38913a63c1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result @@ -6,15 +6,6 @@ title varchar(255), content text, fulltext index (title) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result index f05ee7dccd9..5c48cadf568 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result @@ -1,13 +1,5 @@ drop table if exists t1, t2, t3; create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` text DEFAULT NULL, - PRIMARY KEY (`c1`), - FULLTEXT KEY `ft` (`c2`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result index 14984ed623a..6475f9ec7e9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result index cc8881bf99a..4244af26901 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result index a3936cea11f..8d18efaa571 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result index 2706ff665d9..0e85b45ae59 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result index 450687fb3b7..37d7597b1f3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result @@ -6,16 +6,6 @@ body text, fulltext index title_index (title), fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (title, body) values ("survey", "will start groonga!"); insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); insert into diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result index bb3831ea6d9..db4afff0e91 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result @@ -5,13 +5,6 @@ title VARCHAR(255), content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES("Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES("天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES("富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_100_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_100_no_such_key.result rename to storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_55_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_55_no_such_key.result rename to storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_56_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_56_no_such_key.result rename to storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result new file mode 100644 index 00000000000..e07eae11ecd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES('It is Groonga'); +INSERT INTO diaries VALUES('It is Mroonga'); +SELECT mroonga_command('select', +'table', 'diaries', +'filter', 'title @ "Groonga"'); +mroonga_command('select', +'table', 'diaries', +'filter', 'title @ "Groonga"') +[[[1],[["_id","UInt32"],["title","LongText"]],[1,"It is Groonga"]]] +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result new file mode 100644 index 00000000000..e588408e9e2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result @@ -0,0 +1,22 @@ +DROP DATABASE IF EXISTS `db-1`; +CREATE DATABASE `db-1`; +USE `db-1`; +SET NAMES UTF8; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create diaries TABLE_NO_KEY +column_create diaries title COLUMN_SCALAR LongText + +table_create diaries#title TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create diaries#title index COLUMN_INDEX|WITH_POSITION diaries title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result index c1762458199..bb68bbff1f5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result @@ -1,3 +1,3 @@ SET NAMES UTF8; SELECT mroonga_escape(29) AS escaped_query; -ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 1st argument must be query as string +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 1st query argument must be string diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_all.result rename to storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_custom.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_custom.result rename to storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result new file mode 100644 index 00000000000..ec765b118ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result @@ -0,0 +1,26 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS queries; +CREATE TABLE users ( +id INT +); +CREATE TABLE queries ( +user_id INT, +query TEXT +); +INSERT INTO users VALUES (1); +INSERT INTO users VALUES (2); +INSERT INTO users VALUES (3); +INSERT INTO queries VALUES (1, '(a)'); +INSERT INTO queries VALUES (2, '(b)'); +INSERT INTO queries VALUES (3, '(c)'); +SELECT users.id, mroonga_escape(queries.query) AS escaped_query +FROM queries +LEFT JOIN users ON users.id = queries.user_id +ORDER BY users.id; +id escaped_query +1 \(a\) +2 \(b\) +3 \(c\) +DROP TABLE queries; +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result new file mode 100644 index 00000000000..8b92ec4137e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET NAMES utf8mb4; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8mb4; +INSERT INTO memos VALUES(1, "(Groonga) Installed!"); +INSERT INTO memos VALUES(2, "(Mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(Groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST(mroonga_escape("(groonga)") IN BOOLEAN MODE); +id content +1 (Groonga) Installed! +3 (Groonga) Upgraded! +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result new file mode 100644 index 00000000000..c6c39fccb10 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:' AS query) AS escaped_query; +escaped_query +\+\-\>\<\~\*\(\)\"\\\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_nested.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_nested.result rename to storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result new file mode 100644 index 00000000000..246f280005c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result @@ -0,0 +1,11 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS data; +CREATE TABLE data ( +value DECIMAL(5, 3) +); +INSERT INTO data VALUES (2.9); +SELECT mroonga_escape(value AS script) +FROM data; +mroonga_escape(value AS script) +2.9 +DROP TABLE data; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result new file mode 100644 index 00000000000..902bbd31730 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape(-29 AS script) AS escaped_query; +escaped_query +-29 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result new file mode 100644 index 00000000000..178ff312332 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result @@ -0,0 +1,11 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS data; +CREATE TABLE data ( +value REAL +); +INSERT INTO data VALUES (2.9); +SELECT mroonga_escape(value AS script) +FROM data; +mroonga_escape(value AS script) +2.9 +DROP TABLE data; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result new file mode 100644 index 00000000000..6f5e9b2a2c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('a\"\\\'z' AS script) AS escaped_query; +escaped_query +"a\"\\'z" diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result new file mode 100644 index 00000000000..96df65061d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result @@ -0,0 +1,11 @@ +CREATE TABLE keywords ( +keyword text +); +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +keyword) AS highlighted +FROM keywords; +highlighted +Mroonga is the Groonga based storage engine. +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result new file mode 100644 index 00000000000..ca7d796845d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'ロック', 'æ›´æ–°') AS highlighted; +highlighted +Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result new file mode 100644 index 00000000000..9f4a3dffb5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result @@ -0,0 +1,4 @@ +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +'Mroonga', 'Groonga') AS highlighted; +highlighted +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result new file mode 100644 index 00000000000..bf280dba0ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result @@ -0,0 +1,4 @@ +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +'mroonga') AS highlighted; +highlighted +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result new file mode 100644 index 00000000000..b2d0f509f8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'ロック æ›´æ–° -ボトルãƒãƒƒã‚¯' AS query) AS highlighted; +highlighted +Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result new file mode 100644 index 00000000000..bd11a908bed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'*D- +ロック +æ›´æ–° ボトルãƒãƒƒã‚¯' AS query) AS highlighted; +highlighted +Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result new file mode 100644 index 00000000000..fce13d9cd88 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result @@ -0,0 +1,32 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); +SELECT mroonga_highlight_html(content, 'Mroonga') AS highlighted +FROM memos; +highlighted +Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL. +Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL's official binary. So we can use it more easily than Tritonn. +Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga's fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga's read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result new file mode 100644 index 00000000000..fe5cc885922 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result @@ -0,0 +1,3 @@ +SELECT mroonga_normalize('aBcAbCã‘'); +mroonga_normalize('aBcAbCã‘') +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result new file mode 100644 index 00000000000..3d675fb0e27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result @@ -0,0 +1,3 @@ +SELECT mroonga_normalize('aBcAbCã‘', "NormalizerAuto"); +mroonga_normalize('aBcAbCã‘', "NormalizerAuto") +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result new file mode 100644 index 00000000000..7d4192f620b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result @@ -0,0 +1,7 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('aBcAbCã‘'); +SELECT mroonga_normalize(content) FROM memos; +mroonga_normalize(content) +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result new file mode 100644 index 00000000000..9160633c8fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result @@ -0,0 +1,18 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +INSERT INTO synonyms VALUES ('Mroonga', 'Mroonga'); +INSERT INTO synonyms VALUES ('Mroonga', 'Groonga MySQL'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +((Mroonga) OR (Groonga MySQL)) ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result new file mode 100644 index 00000000000..6a2b5d7a95a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result @@ -0,0 +1,15 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result new file mode 100644 index 00000000000..5f7b0f73c57 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result @@ -0,0 +1,16 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result new file mode 100644 index 00000000000..4690cd013a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result @@ -0,0 +1,17 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('D+', '[D+]'); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'*D+ Mroonga Rroonga PGroonga') AS query; +query +*D+ Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result new file mode 100644 index 00000000000..24665fbfcfd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result @@ -0,0 +1,11 @@ +CREATE TABLE keywords ( +keyword text +); +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', +keyword) as snippet +FROM keywords; +snippet +
Mroonga is the Groonga based storage engine.
+
Mroonga is the Groonga based storage engine.
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result new file mode 100644 index 00000000000..f1efa42ccbd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'ロック', 'æ›´æ–°') as snippet; +snippet +
ãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚
用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result new file mode 100644 index 00000000000..013ad5b1996 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result @@ -0,0 +1,4 @@ +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', +'Mroonga', 'Groonga') as snippet; +snippet +
Mroonga is the Groonga based storage engine.
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result new file mode 100644 index 00000000000..d3f790b3cff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result @@ -0,0 +1,10 @@ +SELECT mroonga_snippet_html('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.', +'lock') as snippet; +snippet +
ng. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one
f the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga's read-lock free characteristic. And you might have the performance bottle neck in the storage engine in upda
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result new file mode 100644 index 00000000000..d05c2323b68 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'ロック æ›´æ–° -ボトルãƒãƒƒã‚¯' AS query) as snippet; +snippet +
ãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚
用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result new file mode 100644 index 00000000000..02ce9098543 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', +'*D- +ロック +æ›´æ–° ボトルãƒãƒƒã‚¯' AS query) as snippet; +snippet +
ãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚
用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result new file mode 100644 index 00000000000..469defbcb71 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result @@ -0,0 +1,30 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); +SELECT mroonga_snippet_html(content, 'Mroonga') as snippet +FROM memos; +snippet +
Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily.
So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.
+
onn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can
+
Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result index e694166b930..5095232dfb2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result @@ -5,15 +5,6 @@ name TEXT, location GEOMETRY NOT NULL, SPATIAL KEY location_index (location) ); -SHOW CREATE TABLE shops; -Table Create Table -shops CREATE TABLE `shops` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - `location` geometry NOT NULL, - PRIMARY KEY (`id`), - SPATIAL KEY `location_index` (`location`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 INSERT INTO shops (name, location) VALUES ('nezu-no-taiyaki', ST_GeomFromText('POINT(139.762573 35.720253)')); @@ -167,4 +158,10 @@ id name location_text 14 tetsuji POINT(139.76857 35.680911944444446) 19 daruma POINT(139.7705988888889 35.68146111111111) 26 kazuya POINT(139.760895 35.67350805555556) +EXPLAIN +SELECT id, name, ST_AsText(location) AS location_text FROM shops +WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) +ORDER BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE shops range location_index location_index 34 NULL 36 Using where; Using filesort DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result similarity index 58% rename from storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result rename to storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result index 271cf922fd5..73573355c00 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null_57.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result @@ -2,13 +2,8 @@ DROP TABLE IF EXISTS shops; CREATE TABLE shops ( location GEOMETRY NOT NULL ); -SET SESSION sql_mode = ''; INSERT INTO shops VALUES (NULL), (NULL); -Warnings: -Warning 1048 Column 'location' cannot be null -SET SESSION sql_mode = default; +ERROR 23000: Column 'location' cannot be null SELECT ST_AsText(location) FROM shops; ST_AsText(location) -POINT(0 0) -POINT(0 0) DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result new file mode 100644 index 00000000000..2f432fc8e66 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result @@ -0,0 +1,169 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL, +SPATIAL KEY location_index (location) +); +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +ST_GeomFromText('POINT(139.711517 35.647701)')); +SELECT id, name, ST_AsText(location) AS location_text FROM shops; +id name location_text +1 nezu-no-taiyaki POINT(139.76257305555555 35.72025305555556) +2 taiyaki-kataoka POINT(139.7155911111111 35.712521111111116) +3 soba-taiyaki-ku POINT(139.65908805555557 35.68371194444445) +4 kuruma POINT(139.70620694444446 35.72151611111111) +5 hirose-ya POINT(139.68560805555555 35.71484388888889) +6 sazare POINT(139.68504305555555 35.71465305555556) +7 omede-taiyaki POINT(139.8171538888889 35.70051611111111) +8 onaga-ya POINT(139.81105 35.69825388888889) +9 shiro-ya POINT(139.63861111111112 35.70551694444445) +10 fuji-ya POINT(139.637115 35.703938055555554) +11 miyoshi POINT(139.53732305555556 35.644538888888896) +12 juju-ya POINT(139.69575500000002 35.62892194444445) +13 tatsumi-ya POINT(139.63865694444445 35.66550111111111) +14 tetsuji POINT(139.76857 35.680911944444446) +15 gazuma-ya POINT(139.64759805555553 35.70081694444444) +16 honma-mon POINT(139.65257305555556 35.72273611111111) +17 naniwa-ya POINT(139.79623388888888 35.73006111111111) +18 kuro-dai POINT(139.70483388888888 35.650345) +19 daruma POINT(139.7705988888889 35.68146111111111) +20 yanagi-ya POINT(139.78398111111113 35.685341111111114) +21 sharaku POINT(139.79484611111113 35.71696888888889) +22 takane POINT(139.56091305555555 35.69860111111112) +23 chiyoda POINT(139.65281694444442 35.64260111111111) +24 da-ka-po POINT(139.72735611111113 35.62734611111111) +25 matsushima-ya POINT(139.73738111111112 35.64055611111111) +26 kazuya POINT(139.760895 35.67350805555556) +27 furuya-kogane-an POINT(139.67607111111113 35.68060305555556) +28 hachi-no-ie POINT(139.66810611111111 35.608021111111114) +29 azuki-chan POINT(139.67320305555555 35.641510000000004) +30 kuriko-an POINT(139.79682888888888 35.71201305555556) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.71252388888888 35.61619888888889) +32 naze-ya POINT(139.66583305555557 35.60903888888889) +33 sanoki-ya POINT(139.7707211111111 35.66592) +34 shigeta POINT(139.78027305555557 35.67262611111111) +35 nishimi-ya POINT(139.77462805555555 35.671825) +36 hiiragi POINT(139.71151694444444 35.64770111111111) +SELECT id, name, ST_AsText(location) AS location_text FROM shops +WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) +ORDER BY id; +id name location_text +14 tetsuji POINT(139.76857 35.680911944444446) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +EXPLAIN +SELECT id, name, ST_AsText(location) AS location_text FROM shops +WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) +ORDER BY id; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE shops NULL range location_index location_index 34 NULL 36 100.00 Using where; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`shops`.`id` AS `id`,`test`.`shops`.`name` AS `name`,st_astext(`test`.`shops`.`location`) AS `location_text` from `test`.`shops` where mbrcontains((st_geometryfromtext('LineString(139.7727 35.6684, 139.7038 35.7121)')),`test`.`shops`.`location`) order by `test`.`shops`.`id` +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result index b27c0ee028c..b0bbaf09e4c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result @@ -1,28 +1,28 @@ -drop table if exists t1, t2, t3; -create table t1 (_id int, a int, primary key (_id) using hash); -insert into t1 values(null, 100); +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); +INSERT INTO t1 VALUES(null, 100); ERROR 23000: Column '_id' cannot be null -insert ignore into t1 values(1,100); +INSERT INTO t1 VALUES(1,100); Warnings: Warning 1265 Data truncated for column '_id' at row 1 -insert ignore into t1 values(1,100); +INSERT INTO t1 VALUES(1,100); Warnings: Warning 1265 Data truncated for column '_id' at row 1 -insert ignore into t1 values(1,100); +INSERT INTO t1 VALUES(1,100); Warnings: Warning 1265 Data truncated for column '_id' at row 1 -insert ignore into t1 values(1,100); +INSERT INTO t1 VALUES(1,100); Warnings: Warning 1265 Data truncated for column '_id' at row 1 -select * from t1; +SELECT * FROM t1; _id a 1 100 2 100 3 100 4 100 -select * from t1 where _id = 2; +SELECT * FROM t1 WHERE _id = 2; _id a 2 100 -select * from t1 where _id = 20; +SELECT * FROM t1 WHERE _id = 20; _id a -drop table t1; +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result new file mode 100644 index 00000000000..8fb46156fb7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); +INSERT INTO t1 VALUES(null, 100); +ERROR 23000: Column '_id' cannot be null +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +SELECT * FROM t1; +_id a +SELECT * FROM t1 WHERE _id = 2; +_id a +SELECT * FROM t1 WHERE _id = 20; +_id a +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result new file mode 100644 index 00000000000..055ca69f884 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +score3 INT, +INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `score3` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`score2`,`score3`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); +SELECT * +FROM items +WHERE score1 = 2 +ORDER BY score2 ASC, score3 ASC; +id score1 score2 score3 +3 2 10 100 +7 2 20 -100 +8 2 20 0 +9 2 20 100 +4 2 30 -100 +5 2 30 0 +6 2 30 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result new file mode 100644 index 00000000000..0d7faddcaa8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +score3 INT, +INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `score3` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`score2`,`score3`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); +SELECT * +FROM items +WHERE score1 = 2 +ORDER BY score2 DESC, score3 DESC; +id score1 score2 score3 +6 2 30 100 +5 2 30 0 +4 2 30 -100 +9 2 20 100 +8 2 20 0 +7 2 20 -100 +3 2 10 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result new file mode 100644 index 00000000000..b390ca7a8cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +name char(30) NOT NULL, +score int NOT NULL, +PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); +SELECT * FROM scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; +ERROR 01000: data truncated for primary key column: +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result index ff2f975f94f..a58a487a178 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result @@ -1,32 +1,27 @@ -drop table if exists listing; -set names utf8; -create table scores ( -name char(30) not null, -score int not null, -primary key (name, score) -) default charset utf8; -show create table scores; -Table Create Table -scores CREATE TABLE `scores` ( - `name` char(30) NOT NULL, - `score` int(11) NOT NULL, - PRIMARY KEY (`name`,`score`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 -insert into scores (name, score) values("Taro Yamada", 29); -insert into scores (name, score) values("Taro Yamada", -12); -insert into scores (name, score) values("Jiro Yamada", 27); -insert into scores (name, score) values("Taro Yamada", 10); -select * from scores; +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +name char(30) NOT NULL, +score int NOT NULL, +PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); +SELECT * FROM scores; name score Jiro Yamada 27 Taro Yamada -12 Taro Yamada 10 Taro Yamada 29 -update ignore scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; Warnings: Warning 1265 data truncated for primary key column: -select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); name score Taro Yamada -12 Taro Yamada 10 -drop table scores; +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than.result rename to storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.result rename to storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than.result rename to storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result similarity index 100% rename from storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.result rename to storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result new file mode 100644 index 00000000000..8e5f4329a51 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +8 2 0 2015-07-02 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result new file mode 100644 index 00000000000..1a3021e2815 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +8 2 0 2015-07-02 00:00:00 +5 2 0 2015-07-01 12:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result new file mode 100644 index 00000000000..6adaa9870dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +2 2 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result new file mode 100644 index 00000000000..dfc7ef6fe43 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +5 2 0 2015-07-01 12:00:00 +2 2 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result new file mode 100644 index 00000000000..502c0c10447 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +4 2 0 2015-07-02 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result new file mode 100644 index 00000000000..60ffa88b4b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +4 2 0 2015-07-02 00:00:00 +3 2 0 2015-07-01 12:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result new file mode 100644 index 00000000000..2cdb3de3fb8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +2 2 0 2015-07-01 00:00:00 +1 1 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result new file mode 100644 index 00000000000..3443bbc3ed1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +3 2 0 2015-07-01 12:00:00 +2 2 0 2015-07-01 00:00:00 +1 1 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result new file mode 100644 index 00000000000..b6091784805 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT NOT NULL, +score2 INT NOT NULL, +INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); +SELECT MAX(score2) FROM scores WHERE score1 = 2; +MAX(score2) +3 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result new file mode 100644 index 00000000000..0792751ad02 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT NOT NULL, +score2 INT NOT NULL, +INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); +SELECT MIN(score2) FROM scores WHERE score1 = 2; +MIN(score2) +-3 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result index 869ced05d25..21168547286 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result @@ -5,12 +5,12 @@ start DATE, end DATE, UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); SELECT * FROM ranges FORCE INDEX(range_key) -WHERE start = "1000-01-01" AND end = "9999-12-31"; +WHERE start = "1000-01-02" AND end = "9999-12-31"; id start end -2 1000-01-01 9999-12-31 +2 1000-01-02 9999-12-31 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result index 8e480d4844a..93e34d88c2a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result @@ -5,16 +5,16 @@ start DATE, end DATE, UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); SELECT start, end FROM ranges FORCE INDEX(range_key) ORDER BY start, end; start end -1000-01-01 2012-10-05 -1000-01-01 9999-12-31 +1000-01-02 2012-10-05 +1000-01-02 9999-12-31 2012-10-25 9999-12-31 -9999-12-31 1000-01-01 +9999-12-31 1000-01-02 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result index 92e7f51ff6e..c2a94a848a9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result @@ -6,14 +6,14 @@ end DATE, UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); -INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start, end; id start end -2 1000-01-01 2012-10-05 -4 1000-01-01 9999-12-31 +2 1000-01-02 2012-10-05 +4 1000-01-02 9999-12-31 1 2012-10-25 9999-12-31 -3 9999-12-31 1000-01-01 +3 9999-12-31 1000-01-02 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result index ddd694c3863..2d100156010 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result @@ -6,14 +6,14 @@ end DATE, UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); -INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start DESC, end DESC; id start end -3 9999-12-31 1000-01-01 +3 9999-12-31 1000-01-02 1 2012-10-25 9999-12-31 -4 1000-01-01 9999-12-31 -2 1000-01-01 2012-10-05 +4 1000-01-02 9999-12-31 +2 1000-01-02 2012-10-05 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result index 1aa710882cb..a8546c4bcbf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result @@ -5,16 +5,16 @@ start datetime, end datetime, UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (1, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); SELECT start, end FROM ranges FORCE INDEX(range_key) ORDER BY start, end; start end -1000-01-01 00:00:00 2012-10-05 16:18:29 -1000-01-01 00:00:00 9999-12-31 23:59:59 +1000-01-02 00:00:00 2012-10-05 16:18:29 +1000-01-02 00:00:00 9999-12-31 23:59:59 2012-10-25 16:18:29 9999-12-31 23:59:59 -9999-12-31 23:59:59 1000-01-01 00:00:00 +9999-12-31 23:59:59 1000-01-02 00:00:00 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result index d18f1858932..5cffb71d644 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result @@ -6,14 +6,14 @@ end datetime, UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); -INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start, end; id start end -2 1000-01-01 00:00:00 2012-10-05 16:18:29 -4 1000-01-01 00:00:00 9999-12-31 23:59:59 +2 1000-01-02 00:00:00 2012-10-05 16:18:29 +4 1000-01-02 00:00:00 9999-12-31 23:59:59 1 2012-10-25 16:18:29 9999-12-31 23:59:59 -3 9999-12-31 23:59:59 1000-01-01 00:00:00 +3 9999-12-31 23:59:59 1000-01-02 00:00:00 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result index c159aeab4ce..4429f787b76 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result @@ -6,14 +6,14 @@ end datetime, UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); -INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start DESC, end DESC; id start end -3 9999-12-31 23:59:59 1000-01-01 00:00:00 +3 9999-12-31 23:59:59 1000-01-02 00:00:00 1 2012-10-25 16:18:29 9999-12-31 23:59:59 -4 1000-01-01 00:00:00 9999-12-31 23:59:59 -2 1000-01-01 00:00:00 2012-10-05 16:18:29 +4 1000-01-02 00:00:00 9999-12-31 23:59:59 +2 1000-01-02 00:00:00 2012-10-05 16:18:29 DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result index d833fb44024..92e95d9276c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, -start timestamp, -end timestamp, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result index 1e4ee102c9e..35bc4123d65 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, -start timestamp, -end timestamp, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result index 23a5522320a..fbf88cf3d0a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, -start timestamp, -end timestamp, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result index 3f3277f5e64..b799cc278e1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, -start timestamp, -end timestamp, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result index d6ce9873606..b1eafd2d048 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( day DATE PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `day` date NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`day`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); INSERT INTO diaries (day, title) VALUES ("2012-01-31", "cloudy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result index 2cf83ae6aa5..0ae41c513dc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( day DATETIME(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `day` datetime(6) NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`day`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (day, title) VALUES ("2012-01-29 21:51:01.111111", "clear day"); INSERT INTO diaries (day, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result index f605346130b..f5e743dc9e7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( day DATETIME PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `day` datetime NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`day`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (day, title) VALUES ("2012-01-29 21:51:01", "clear day"); INSERT INTO diaries (day, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result index 4e8386251e7..6a529b50692 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE releases ( version DECIMAL(6, 3) PRIMARY KEY, message TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE releases; -Table Create Table -releases CREATE TABLE `releases` ( - `version` decimal(6,3) NOT NULL, - `message` text DEFAULT NULL, - PRIMARY KEY (`version`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); INSERT INTO releases (version, message) VALUES (999.999, "the last release!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result index c7d9f4db5c0..d36688bb13c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE releases ( version DECIMAL PRIMARY KEY, message TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE releases; -Table Create Table -releases CREATE TABLE `releases` ( - `version` decimal(10,0) NOT NULL, - `message` text DEFAULT NULL, - PRIMARY KEY (`version`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); INSERT INTO releases (version, message) VALUES (10, "10th release!"); INSERT INTO releases (version, message) VALUES (999, "the last release!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result index 705f311a5d8..5437c789791 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE running_records ( time TIME(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; -Table Create Table -running_records CREATE TABLE `running_records` ( - `time` time(6) NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`time`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO running_records (time, title) VALUES ("01:00:00.000001", "normal condition"); INSERT INTO running_records (time, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result index d8807f34257..e59dee4c688 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE running_records ( time TIME PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; -Table Create Table -running_records CREATE TABLE `running_records` ( - `time` time NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`time`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO running_records (time, title) VALUES ("01:00:00", "normal condition"); INSERT INTO running_records (time, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result index bdffb91739b..0fba3da7533 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( time TIMESTAMP(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - `title` text DEFAULT NULL, - PRIMARY KEY (`time`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01.111111", "clear day"); INSERT INTO diaries (time, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result index 6ad90fb4107..8116bda2d60 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( time TIMESTAMP PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `title` text DEFAULT NULL, - PRIMARY KEY (`time`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); INSERT INTO diaries (time, title) VALUES ("2012-01-31 08:32:10", "cloudy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result index 9bdf87dffcd..78c56f258f8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result @@ -3,13 +3,6 @@ CREATE TABLE aniversary_memos ( party_year YEAR PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; -Table Create Table -aniversary_memos CREATE TABLE `aniversary_memos` ( - `party_year` year(4) NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`party_year`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO aniversary_memos (party_year, title) VALUES ("11", "We need a big cake!"); INSERT INTO aniversary_memos (party_year, title) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result new file mode 100644 index 00000000000..f2a0b28b0b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int, +UNIQUE KEY (id) +); +INSERT INTO ids VALUES (1); +DELETE FROM ids; +INSERT INTO ids VALUES (1); +SELECT * FROM ids; +id +1 +INSERT INTO ids VALUES (1); +ERROR 23000: Duplicate entry '1' for key 'id' +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result index 91850d9d871..3600c92082d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result @@ -6,15 +6,6 @@ title VARCHAR(255), content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result index 00466f19bb5..f8d41bb784e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result @@ -65,18 +65,6 @@ select * from t1; c1 2010-03-26 11:22:33 drop table t1; -create table t1 (c1 int, _id int); -set sql_mode=""; -insert into t1 (c1,_id) values (1,1); -Warnings: -Warning 1265 Data truncated for column '_id' at row 1 -set sql_mode="strict_all_tables"; -insert into t1 (c1,_id) values (4,1); -ERROR 01000: Data truncated for column '_id' at row 1 -select * from t1; -c1 _id -1 1 -drop table t1; create table t1 (c1 int primary key, c2 int); insert into t1 values(1,100); select * from t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result index 595b3da00cd..94421a5c200 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( day DATE PRIMARY KEY, title TEXT ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `day` date NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`day`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (day, title) VALUES ("2012-02-14", "clear day") ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result index ff6925067e5..1ef6f1f2c37 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result @@ -5,15 +5,6 @@ day DATE, title TEXT, UNIQUE KEY day (day) ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `day` date DEFAULT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `day` (`day`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (day, title) VALUES ("2012-02-14", "clear day1") ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)"; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result new file mode 100644 index 00000000000..624ac00d3fc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int, _id int); +SET sql_mode=""; +INSERT INTO t1 (c1,_id) VALUES (1,1); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +SET sql_mode="STRICT_ALL_TABLES"; +INSERT INTO t1 (c1,_id) VALUES (4,1); +ERROR 01000: Data truncated for column '_id' at row 1 +SELECT * FROM t1; +c1 _id +1 1 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_TODO_SPLIT_ME.result deleted file mode 100644 index b66801094bd..00000000000 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_TODO_SPLIT_ME.result +++ /dev/null @@ -1,106 +0,0 @@ -drop table if exists t1, t2, t3; -flush status; -create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); -insert into t1 values(1,10,"aa ii uu ee oo"); -insert into t1 values(2,20,"ka ki ku ke ko"); -insert into t1 values(3,30,"sa si su se so"); -insert into t1 values(4,40,"ta ti tu te to"); -insert into t1 values(5,50,"aa ii uu ee oo"); -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 0 -select * from t1; -c1 c2 c3 -1 10 aa ii uu ee oo -2 20 ka ki ku ke ko -3 30 sa si su se so -4 40 ta ti tu te to -5 50 aa ii uu ee oo -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 0 -select count(*) from t1; -count(*) -5 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 0 -select * from t1 force index(primary) where c1 between 2 and 4; -c1 c2 c3 -2 20 ka ki ku ke ko -3 30 sa si su se so -4 40 ta ti tu te to -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 0 -select count(*) from t1 force index(primary) where c1 between 2 and 4; -count(*) -3 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 1 -select c1 from t1 force index(primary) where c1 < 3; -c1 -1 -2 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 1 -select count(c1) from t1 force index(primary) where c1 < 3; -count(c1) -2 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 1 -select 1 from t1 force index(primary) where c1 > 3; -1 -1 -1 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 1 -select count(1) from t1 force index(primary) where c1 > 3; -count(1) -2 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 2 -select * from t1 where match(c3) against("su"); -c1 c2 c3 -3 30 sa si su se so -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 2 -select count(*) from t1 where match(c3) against("su"); -count(*) -1 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 3 -select * from t1 where match(c3) against("+su" in boolean mode); -c1 c2 c3 -3 30 sa si su se so -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 3 -select count(*) from t1 where match(c3) against("+su" in boolean mode); -count(*) -1 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 4 -select * from t1 force index(idx1) where c2 between 20 and 40; -c1 c2 c3 -2 20 ka ki ku ke ko -3 30 sa si su se so -4 40 ta ti tu te to -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 4 -select count(*) from t1 force index(idx1) where c2 between 20 and 40; -count(*) -3 -show status like 'mroonga_count_skip'; -Variable_name Value -Mroonga_count_skip 5 -drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result index 412ae455898..c09ec340ccb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result @@ -6,11 +6,7 @@ FULLTEXT INDEX ft(title) ); INSERT INTO diaries VALUES("Hello mroonga!"); INSERT INTO diaries VALUES("It's funny."); -CONNECT thread2, localhost, root, ,; -connection thread2; INSERT INTO diaries VALUES("Happy birthday!"); -disconnect thread2; -connection default; SHOW STATUS LIKE 'mroonga_count_skip'; Variable_name Value Mroonga_count_skip 0 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result index fd5f856d64c..8d29e0425cf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result @@ -7,14 +7,6 @@ title VARCHAR(255), content TEXT, FULLTEXT INDEX(content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result new file mode 100644 index 00000000000..26ca6de7b28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT, +age INT, +INDEX (id, age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); +SELECT COUNT(*) FROM users WHERE id = 2 AND age = 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result new file mode 100644 index 00000000000..9af4a4fedcc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +SELECT COUNT(*) FROM users WHERE age BETWEEN 28 AND 30; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result new file mode 100644 index 00000000000..2bbcfe7549c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +SELECT COUNT(*) FROM users WHERE age = 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result new file mode 100644 index 00000000000..6ec4d774b28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); +SELECT COUNT(*) FROM memos +WHERE MATCH(content) AGAINST('+Groonga' IN BOOLEAN MODE); +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result new file mode 100644 index 00000000000..36a1958955a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); +SELECT COUNT(*) FROM memos +WHERE MATCH(content) AGAINST('Groonga'); +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result new file mode 100644 index 00000000000..d5c033083cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +SELECT COUNT(*) FROM users WHERE age > 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result new file mode 100644 index 00000000000..59b812d1484 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +SELECT COUNT(*) FROM users WHERE age >= 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result new file mode 100644 index 00000000000..b5e4fc1c3de --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +SELECT COUNT(*) FROM users WHERE age < 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result new file mode 100644 index 00000000000..f062fe0092b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +SELECT COUNT(*) FROM users WHERE age <= 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result new file mode 100644 index 00000000000..a1a123e7d5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +SELECT COUNT(*) FROM users WHERE age <> 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 2 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result new file mode 100644 index 00000000000..39a0f0bd785 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT, +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); +SELECT COUNT(*) FROM users WHERE id = 3 AND age = 29; +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result new file mode 100644 index 00000000000..68a0575ab97 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id BETWEEN 2 AND 4; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result new file mode 100644 index 00000000000..713a19dd184 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id = 3; +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result new file mode 100644 index 00000000000..3ae04a0246f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id > 3; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result new file mode 100644 index 00000000000..0f0643110f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id >= 3; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result new file mode 100644 index 00000000000..05afd7e8d58 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id < 3; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result new file mode 100644 index 00000000000..200f89d3eb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id <= 3; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result new file mode 100644 index 00000000000..64761c9565d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id <> 3; +COUNT(*) +4 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result index e2391c03e06..dcf0f3eec66 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result new file mode 100644 index 00000000000..124a7750f5b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(title), +FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(5, "title 1", "content a"); +INSERT INTO memos VALUES(12, "title 1", "content a"); +INSERT INTO memos VALUES(10, "title 1", "content a"); +INSERT INTO memos VALUES(4, "title 2", "content b"); +INSERT INTO memos VALUES(6, "title 2", "content b"); +INSERT INTO memos VALUES(1, "title 2", "content b"); +INSERT INTO memos VALUES(11, "title 1-a", "content a-1"); +INSERT INTO memos VALUES(3, "title 2-b", "content a-2"); +INSERT INTO memos VALUES(2, "title 2-c", "content a-3"); +INSERT INTO memos VALUES(8, "title 1-a", "content b-1"); +INSERT INTO memos VALUES(9, "title 2-b", "content b-2"); +INSERT INTO memos VALUES(7, "title 2-c", "content b-3"); +SELECT * FROM memos +WHERE MATCH(title) AGAINST("+1" IN BOOLEAN MODE) AND +MATCH(content) AGAINST("+a" IN BOOLEAN MODE) +ORDER BY id +LIMIT 1,3; +id title content +10 title 1 content a +11 title 1-a content a-1 +12 title 1 content a +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result index 10d30798c89..5a0ea86cc93 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result new file mode 100644 index 00000000000..d58c3cf223a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES CP932; +CREATE TABLE memos ( +ޝ•ÊŽq INT UNSIGNED, +“à—e TEXT, +FULLTEXT INDEX(“à—e), +KEY(ޝ•ÊŽq) +) DEFAULT CHARSET CP932; +INSERT INTO memos VALUES(2, "–¾“ú‚ÍŽR“o‚èB"); +INSERT INTO memos VALUES(3, "¡“ú‚̓Tƒ{ƒeƒ“‚ð‚à‚ç‚Á‚½B"); +INSERT INTO memos VALUES(1, "¡“ú‚Í“V‹C‚ª‚æ‚­‚Ă悩‚Á‚½B"); +SELECT * FROM memos +WHERE MATCH(“à—e) AGAINST("¡“ú" IN BOOLEAN MODE) +ORDER BY ޝ•ÊŽq +LIMIT 1; +ޝ•ÊŽq “à—e +1 ¡“ú‚Í“V‹C‚ª‚æ‚­‚Ă悩‚Á‚½B +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result index 4ea3856d363..f1cc14b4963 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result index 067e8bc7f61..0374f50030e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result index 41129e1945f..4bc3f9d5c73 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:34", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result index 3a99051643d..56629777889 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result index b6db34d113d..b03fe20f397 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result index 042e42ff36b..c25f2a56e90 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result index 1c06397c7ea..ef93bf8b879 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `date` datetime DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `date` (`date`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result new file mode 100644 index 00000000000..f20089f0074 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES utf8; +CREATE TABLE memos ( +id int PRIMARY KEY, +tag ENUM('Groonga', 'Mroonga'), +content TEXT, +FULLTEXT INDEX(content), +KEY(tag), +KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND +tag = 'Mroonga' + ORDER BY id LIMIT 1; +id tag content +4 Mroonga Mroonga is based on Groonga. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result new file mode 100644 index 00000000000..88ec9dd81db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES utf8; +CREATE TABLE memos ( +id int PRIMARY KEY, +tag ENUM('Groonga', 'Mroonga'), +content TEXT, +FULLTEXT INDEX(content), +KEY(tag), +KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND +tag = 2 +ORDER BY id LIMIT 1; +id tag content +4 Mroonga Mroonga is based on Groonga. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result index be68e8771b2..5c18e22d1af 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result @@ -11,19 +11,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result index 7e3c4293c50..634fe89cdd4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result index 54bfcbc2b5c..22305c7045a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result index c4644584b0d..439f453d184 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result index a4af585cd57..51ec2fde5e6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result index a11e9fc6e40..3c4f3973f84 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result index 86f783b81f4..03364eb1017 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result @@ -11,18 +11,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result index acbb6af0be3..a284f4dd280 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result index 6b12587a14d..270d263966d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result index 30f4a08d1c9..eb19384eb63 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result @@ -13,20 +13,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `_id` int(11) DEFAULT NULL, - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(NULL, 3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result index abc2dbf06ce..80bd895a6e4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result index 52134fde180..b3ed4bf6b4d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result index 5b3ca0194e0..793423f5bc5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result index 98b92f3c021..f50417d1f29 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result index 5a37d62785b..26da350050f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); INSERT INTO memos VALUES(3, "1:23:34", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result index 702f125c2b5..342947cc77e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result index df3ab968803..adc4ec6316e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result index da774b47b10..2881cc7724a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result index 0895545a96d..d1a9fc2787a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result @@ -8,15 +8,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(10) unsigned NOT NULL, - `writing_time` time DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `writing_time` (`writing_time`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result index 51a9c1d4f6e..bff0d993ef8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result @@ -13,20 +13,6 @@ KEY(title), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `title` (`title`), - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result index 0ebb303a96f..cc3173ecff2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result @@ -12,19 +12,6 @@ FULLTEXT INDEX(content), KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - KEY `month` (`month`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result b/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result index 54515edbd0e..24d427ed2ab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result @@ -6,15 +6,6 @@ title TEXT, body TEXT, FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, body) VALUES ("survey", "will start Groonga!"); INSERT INTO diaries (title, body) VALUES ("Groonga (1)", "starting Groonga..."); INSERT INTO diaries (title, body) VALUES ("Groonga (2)", "started Groonga."); @@ -23,7 +14,7 @@ id title body 2 Groonga (1) starting Groonga... FLUSH TABLES; SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE); -ERROR HY000: syscall error 'repair_test.mrn.000010A.c' (No such file or directory) +ERROR HY000: system call error: No such file or directory: failed to open path: REPAIR TABLE diaries; Table Op Msg_type Msg_text repair_test.diaries repair status OK diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result index f7187258ddc..c70ce337447 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result @@ -5,14 +5,6 @@ id int primary key, content text, fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result index 090ea9b84d6..fd2cb655eaa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result @@ -5,14 +5,6 @@ id int primary key, content varchar(256), fulltext index (content) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `content` varchar(256) DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result index 400156cec7b..a111880a904 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result @@ -8,8 +8,8 @@ KEY (age) INSERT INTO users VALUES ("Alice", 20); INSERT INTO users VALUES ("Bob", 20); INSERT INTO users VALUES ("Charry", 29); -SELECT *, COUNT(*) FROM users GROUP BY age; -name age COUNT(*) -Alice 20 2 -Charry 29 1 +SELECT age, COUNT(*) FROM users GROUP BY age; +age COUNT(*) +20 2 +29 1 DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result index 04f63d0e779..93d29c2d439 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result @@ -7,11 +7,8 @@ age int INSERT INTO users VALUES ("Alice", 20); INSERT INTO users VALUES ("Bob", 20); INSERT INTO users VALUES ("Charry", 29); -EXPLAIN SELECT *, COUNT(*) FROM users GROUP BY age; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE users ALL NULL NULL NULL NULL 3 Using temporary; Using filesort -SELECT *, COUNT(*) FROM users GROUP BY age; -name age COUNT(*) -Alice 20 2 -Charry 29 1 +SELECT age, COUNT(*) FROM users GROUP BY age; +age COUNT(*) +20 2 +29 1 DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result index cd702ab7a02..87c9f4ef2b9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result @@ -9,15 +9,6 @@ user_id INT UNSIGNED NOT NULL, title TEXT, FULLTEXT INDEX (title) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(10) unsigned NOT NULL, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO users (name) VALUES ("alice"); INSERT INTO users (name) VALUES ("bob"); INSERT INTO users (name) VALUES ("carlos"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result index ff24e1b6102..0a18d817312 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result @@ -3,13 +3,6 @@ CREATE TEMPORARY TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TEMPORARY TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title) VALUES ("clear day"); INSERT INTO diaries (title) VALUES ("rainy day"); INSERT INTO diaries (title) VALUES ("cloudy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result index c59fc05ae2c..3525e2354d2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result @@ -10,19 +10,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result new file mode 100644 index 00000000000..72a913b402e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS memos; +SET SESSION binlog_format = 'ROW'; +CREATE TABLE memos ( +title varchar(20) PRIMARY KEY, +content varchar(140) NOT NULL +) COLLATE=utf8mb4_general_ci +DEFAULT CHARSET=utf8mb4; +INSERT INTO memos (title, content) VALUES ('Mroonga', 'Mroonga is great!'); +SELECT * FROM memos; +title content +Mroonga Mroonga is great! +UPDATE memos SET content = 'Mroonga is very great!' WHERE title = 'Mroonga'; +SELECT * FROM memos; +title content +Mroonga Mroonga is very great! +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result index 11e6ee21949..e823e128c43 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result @@ -1,28 +1,29 @@ -drop table if exists t1, t2, t3; -create table t1 (c1 int, _id int); -insert into t1 values(1,null); -insert into t1 values(2,null); -insert into t1 values(3,null); -select * from t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int, _id int); +INSERT INTO t1 VALUES(1,null); +INSERT INTO t1 VALUES(2,null); +INSERT INTO t1 VALUES(3,null); +SELECT * FROM t1; c1 _id 1 1 2 2 3 3 -set sql_mode=""; -update t1 set _id = 10 where c1 = 1; +SET sql_mode=""; +UPDATE t1 SET _id = 10 WHERE c1 = 1; Warnings: Warning 1265 Data truncated for column '_id' at row 1 -select * from t1; +SELECT * FROM t1; c1 _id 1 1 2 2 3 3 -set sql_mode="strict_all_tables"; -update t1 set _id = 11 where c1 = 1; +SET sql_mode="STRICT_ALL_TABLES"; +UPDATE t1 SET _id = 11 WHERE c1 = 1; ERROR 01000: Data truncated for column '_id' at row 1 -select * from t1; +SELECT * FROM t1; c1 _id 1 1 2 2 3 3 -drop table t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result new file mode 100644 index 00000000000..1f457eb5e96 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_default_tokenizer_backup = @@mroonga_default_tokenizer; +SET GLOBAL mroonga_default_tokenizer = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +Variable_name Value +mroonga_default_tokenizer TokenBigramSplitAlpha +SET GLOBAL mroonga_default_tokenizer = @mroonga_default_tokenizer_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result new file mode 100644 index 00000000000..9ad80e9a85a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_default_tokenizer = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +Variable_name Value +mroonga_default_tokenizer TokenBigram diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result index deac880d265..4238cb6320e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (body) values ("will start groonga!"); select * from diaries; id body diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result index 13db5ec65f7..429398f6b84 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (body) values ("will start groonga!"); select * from diaries; id body diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result index 7ba0c120a2c..9cd6f5c9b1d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 insert into diaries (body) values ("will start groonga!"); set mroonga_dry_write=true; update diaries set body = "starting groonga..." where id = 1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result new file mode 100644 index 00000000000..5a19ab6fb44 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT +) DEFAULT CHARSET=utf8; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +INSERT INTO diaries VALUES("Unlogged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +mroonga_command('load --table mroonga_operations --values "[{}]"') +1 +SELECT mroonga_command('select mroonga_operations --output_columns _id'); +mroonga_command('select mroonga_operations --output_columns _id') +[[[1],[["_id","UInt32"]],[2]]] +SET GLOBAL mroonga_enable_operations_recording = false; +FLUSH TABLES; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +INSERT INTO diaries VALUES("Logged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +mroonga_command('load --table mroonga_operations --values "[{}]"') +1 +SELECT mroonga_command('select mroonga_operations --output_columns _id'); +mroonga_command('select mroonga_operations --output_columns _id') +[[[1],[["_id","UInt32"]],[1]]] +DROP TABLE diaries; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +SET GLOBAL mroonga_enable_operations_recording = default; +FLUSH TABLES; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result index 8abd41cece3..19abff382bf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result @@ -4,30 +4,21 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, -FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `tags` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 -INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); -INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +INSERT INTO diaries (title, tags) VALUES ("Hello Groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello Mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+install" IN BOOLEAN MODE); id title tags -1 Hello groonga! groonga install -2 Hello mroonga! mroonga install -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +1 Hello Groonga! groonga install +2 Hello Mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); id title tags SET GLOBAL mroonga_match_escalation_threshold = 0; -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); id title tags SET mroonga_match_escalation_threshold = 0; -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); id title tags -1 Hello groonga! groonga install +1 Hello Groonga! groonga install DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result index 37c2eeeb379..30e9262b5fc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result @@ -3,17 +3,8 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, -FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `tags` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result index 9968abaf18c..0181fe02d84 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result @@ -13,12 +13,8 @@ INSERT INTO ids VALUES (8); INSERT INTO ids VALUES (9); INSERT INTO ids VALUES (10); SET GLOBAL mroonga_max_n_records_for_estimate = 1; -CONNECT new_connection, localhost, root, ,; -connection new_connection; EXPLAIN SELECT * FROM ids WHERE id > 5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE ids range PRIMARY PRIMARY 4 NULL 1 Using where; Using index -connection default; -disconnect new_connection; SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT; DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result similarity index 65% rename from storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result rename to storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result index 0181fe02d84..ff574f7bcce 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result @@ -14,7 +14,9 @@ INSERT INTO ids VALUES (9); INSERT INTO ids VALUES (10); SET GLOBAL mroonga_max_n_records_for_estimate = 1; EXPLAIN SELECT * FROM ids WHERE id > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ids range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 5) SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT; DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result new file mode 100644 index 00000000000..5ecf89694e4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +INDEX (id) +) DEFAULT CHARSET=UTF8; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +DELETE FROM ids WHERE id < 2; +SET mroonga_max_n_records_for_estimate = 1; +EXPLAIN SELECT * FROM ids WHERE id > 0; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range id id 5 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 0) +SET mroonga_max_n_records_for_estimate = DEFAULT; +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result new file mode 100644 index 00000000000..b28eac5a274 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +INSERT INTO ids VALUES (4); +INSERT INTO ids VALUES (5); +INSERT INTO ids VALUES (6); +INSERT INTO ids VALUES (7); +INSERT INTO ids VALUES (8); +INSERT INTO ids VALUES (9); +INSERT INTO ids VALUES (10); +SET mroonga_max_n_records_for_estimate = 1; +EXPLAIN SELECT * FROM ids WHERE id > 5; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 5) +SET mroonga_max_n_records_for_estimate = DEFAULT; +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result new file mode 100644 index 00000000000..e2d8a8de493 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +INDEX (id) +) DEFAULT CHARSET=UTF8; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +DELETE FROM ids WHERE id < 2; +SET mroonga_max_n_records_for_estimate = 1; +EXPLAIN SELECT * FROM ids WHERE id > 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE ids range id id 5 NULL 1 Using where; Using index +SET mroonga_max_n_records_for_estimate = DEFAULT; +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result new file mode 100644 index 00000000000..3d7f36d1846 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = ""; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is still disabled +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result new file mode 100644 index 00000000000..aed9d91a9d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = NULL; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is still disabled +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result new file mode 100644 index 00000000000..22ac271e552 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = ""; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is disabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result new file mode 100644 index 00000000000..3921fb16259 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = NULL; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is disabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result new file mode 100644 index 00000000000..7b1be1365b7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file groonga-query.log +log file is changed: -> +query log is enabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result new file mode 100644 index 00000000000..adf3d1bfbe8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file groonga-query.log +log file is changed: -> +query log file isn't changed because the requested path isn't different: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test index 38d4f034daa..4e486b83cc0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,11 +23,11 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - body TEXT + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -ALTER TABLE diaries ADD title TEXT AFTER id; +ALTER TABLE diaries ADD title VARCHAR(40) AFTER id; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test index 0e82b3dd4b0..5912ed3fcf0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,11 +23,11 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - body TEXT + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -ALTER TABLE diaries ADD title TEXT FIRST; +ALTER TABLE diaries ADD title VARCHAR(40) FIRST; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test index 1071faf0b81..18fa2f3ef1e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test index 70fb61cc044..f84c931c010 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/not_embedded.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test index 8a64fe00af0..d49e84cd5fa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test index f34cbcdcbf7..cc208a20872 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test @@ -13,10 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test new file mode 100644 index 00000000000..18836127238 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int PRIMARY KEY +) DEFAULT CHARSET=cp932; +ALTER TABLE users + ADD COLUMN –¼‘O text, + ADD FULLTEXT INDEX (–¼‘O); + +INSERT INTO users VALUES (1, "‚â‚Ü‚¾"); +INSERT INTO users VALUES (2, "‚½‚È‚©"); +INSERT INTO users VALUES (3, "‚·‚¸‚«"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test new file mode 100644 index 00000000000..88ef12498a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE users + ADD COLUMN åå‰ text, + ADD FULLTEXT INDEX (åå‰); + +INSERT INTO users VALUES (1, "ã‚„ã¾ã "); +INSERT INTO users VALUES (2, "ãŸãªã‹"); +INSERT INTO users VALUES (3, "ã™ãšã"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test index 568deea9e29..1f4fa4663b1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT + title VARCHAR(40) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; @@ -31,7 +31,7 @@ INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; ALTER TABLE diaries - ADD COLUMN body TEXT FIRST, + ADD COLUMN body VARCHAR(140) FIRST, ADD COLUMN published BOOLEAN AFTER id, ADD COLUMN created_at DATETIME; UPDATE diaries SET body = "will start groonga!"; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test index 8c4d76a5868..fac1f045db1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,14 +23,14 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT + title VARCHAR(40) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; -ALTER TABLE diaries ADD COLUMN body TEXT; +ALTER TABLE diaries ADD COLUMN body VARCHAR(140); UPDATE diaries SET body = "will start groonga!"; SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test index 037e81c7906..c198358146b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test index 83b8aef1c5a..1440c0b78aa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test index 4476decec78..53d4b21ff53 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test index 424ae89b4a6..7bb65327f79 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test index 94db5d40b60..7e584131b3d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test index 5bc12edadc4..7ae72d672f6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test index 98d26966bd0..119099c4350 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test index 575d65e44a2..c01f7a95754 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test index 295bb91e0a9..e680e6e2008 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,12 +23,12 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -ALTER TABLE diaries CHANGE body description TEXT AFTER id; +ALTER TABLE diaries CHANGE body description VARCHAR(140) AFTER id; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test index 01682688a74..20624ad9537 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,12 +23,12 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -ALTER TABLE diaries CHANGE body description TEXT FIRST; +ALTER TABLE diaries CHANGE body description VARCHAR(140) FIRST; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test index b30486d080a..20f7853fb7c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,15 +23,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; ALTER TABLE diaries - CHANGE body description TEXT FIRST, - CHANGE title subject TEXT AFTER internal_id, - CHANGE id internal_id INT; + CHANGE body description VARCHAR(140) FIRST, + CHANGE title subject VARCHAR(40) AFTER internal_id, + CHANGE id internal_id INT AUTO_INCREMENT; SHOW CREATE TABLE diaries; INSERT IGNORE INTO diaries (subject, description) diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test index 88a69111f65..2394be86333 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,12 +23,12 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -ALTER TABLE diaries CHANGE body description TEXT; +ALTER TABLE diaries CHANGE body description VARCHAR(140); SHOW CREATE TABLE diaries; INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test similarity index 84% rename from storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test rename to storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test index 71e0fda3825..e8e0bd416f9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -24,19 +24,18 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, temperature DECIMAL(6, 3) ) ENGINE InnoDB DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; -INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (temperature) VALUES (21.281); SELECT * FROM diaries; ALTER TABLE diaries ENGINE = mroonga; SELECT * FROM diaries; -INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); -INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +INSERT INTO diaries (temperature) VALUES (14.213); +INSERT INTO diaries (temperature) VALUES (17.821); SELECT * FROM diaries; SHOW CREATE TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test similarity index 90% rename from storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test rename to storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test index a477d091946..f8c4dfa3400 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,9 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) ENGINE MyISAM DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); @@ -37,7 +39,9 @@ SELECT * FROM diaries MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); ALTER TABLE diaries ENGINE = mroonga; -SHOW CREATE TABLE diaries; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; SELECT * FROM diaries WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test index 92380fdb8ec..c1bf17ba439 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test index 1f6980cc04b..d1f8308268a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test index 5cba17d2072..17b86b47389 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test index d7f7f446459..028fb33f1e3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test index 626a1bc80a8..00015dcfaca 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test index ea424df2e57..5760887e782 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test index 186e1f5095c..69dbe23cc24 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test index 4348efeb066..dce2ea51397 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test index 49d9f0b8da2..00f6d30a572 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test index 58e53cb06f2..020579106e1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test index fc3acad9000..32da1b3a547 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,8 +23,8 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test index 6b790e5d621..ec5735f0672 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,8 +23,8 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test index 956f397b965..eb80d3036d3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test index 95f683f1df5..da06f680d68 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test index 62bbe4a4dc2..08d84f7b552 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test index d87078e7e9c..3309f60a3d9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test index cb6ade7a418..2f3b61efcf3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test index 62bbe4a4dc2..08d84f7b552 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test index 13afdcfe0e6..1d073dc641f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test index bf2cc8bd6e2..870b1bb6098 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test index 3d9523ab537..34ee3fcd275 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test index 193680296dc..b349411849f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test index bf7e7501741..6316eac4fe1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -31,9 +31,8 @@ INSERT INTO memos (content) values ("Started Groonga."); INSERT INTO memos (content) values ("Starting Mroonga..."); ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); -SHOW CREATE TABLE memos; -SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); +SELECT * FROM memos WHERE MATCH(content) AGAINST("+groonga" IN BOOLEAN MODE); DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test index c719318d847..f4facdcb72f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test index 11799a51a65..165b71a86c9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test index 8bdfd10024e..ce1e52efa31 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,15 +23,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); SELECT * FROM diaries; -ALTER TABLE diaries MODIFY body TEXT AFTER id; +ALTER TABLE diaries MODIFY body VARCHAR(140) AFTER id; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test index a4dd52d9fac..22c6b59e022 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,15 +23,15 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); SELECT * FROM diaries; -ALTER TABLE diaries MODIFY body TEXT FIRST; +ALTER TABLE diaries MODIFY body VARCHAR(140) FIRST; SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test index 45f4748e98d..eed22d06690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,8 +23,8 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, - body TEXT + title VARCHAR(40), + body VARCHAR(140) ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test index c44937b3f84..77d0bc741e2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( body TEXT, FULLTEXT INDEX (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); @@ -44,8 +43,6 @@ SELECT * FROM diaries; SELECT * FROM diaries WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); -SHOW CREATE TABLE diaries; - DROP TABLE diaries; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test index 91898b5bb44..6c15161ed22 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,9 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; @@ -42,7 +44,9 @@ SELECT * FROM memos WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); -SHOW CREATE TABLE memos; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'memos'; DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test index e696d12f128..09e0ea8a118 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -25,7 +25,7 @@ DROP TABLE IF EXISTS shops; CREATE TABLE shops ( id INT PRIMARY KEY AUTO_INCREMENT, - name TEXT, + name VARCHAR(40), location GEOMETRY NOT NULL ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test index db018023af0..f452e402d81 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test index 169260cc808..2d0840ce990 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test index ee4db71722c..2d854ec35b4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test index c67aff06674..eff9259a7ba 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_log_bin.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test new file mode 100644 index 00000000000..77271b4f169 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test @@ -0,0 +1,45 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET NAMES UTF8; + +CREATE DATABASE check_test; +USE check_test; + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + +INSERT INTO diaries VALUES ('Hello'); + +--remove_file $MYSQLD_DATADIR/check_test.mrn.000010C + +FLUSH TABLES; + +CHECK TABLE diaries; + +REPAIR TABLE diaries; +DROP TABLE diaries; + +DROP DATABASE check_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test new file mode 100644 index 00000000000..1460732b29a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test @@ -0,0 +1,38 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT +); + +INSERT INTO diaries VALUES ('Hello'); + +CHECK TABLE diaries; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test index d0df707162b..101c16e9675 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test index f9e9a817a08..2c28edb3327 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test index 4beec67b468..1d9998eeed3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test index 045c9ef2a4e..f69e5594ebd 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test index 199e2904d94..5d48a1a6201 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test index 4c63dedfc60..42c5e1d2284 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test index 0fcc806883d..6761869d4ff 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test index cc713a80e5a..8645a2d7e5f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, + title VARCHAR(40), created_at DATE, KEY (created_at) ) DEFAULT CHARSET UTF8; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test index d5587876c3c..21dcf156e43 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, - title TEXT, + title VARCHAR(40), created_at DATE ) DEFAULT CHARSET UTF8; SHOW CREATE TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test index 762b78ec0fc..6bd99b86915 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test @@ -1,4 +1,5 @@ # Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test index 8cbf9309538..0c215080313 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test index df656eca797..b93af8ffa25 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT IGNORE INTO diaries (title, created_at) VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test index 12c2a312afe..c1cf1a341de 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT IGNORE INTO diaries (title, created_at) VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test index 337e5baa955..43439de0e89 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT IGNORE INTO diaries (title, created_at) VALUES ('2012', '2012'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test index 3abf611a839..af04133ef2c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test index 586367147cc..a3e355cc1ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test @@ -13,12 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -30,10 +28,9 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) - VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + VALUES ('1000-01-02 00:00:00', '1000-01-02 00:00:00'); SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test index 6599a554efd..3f4bb7b1e23 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test similarity index 77% rename from storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test rename to storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test index 94c9cab1373..47266e017d7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test @@ -13,12 +13,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/have_64bit.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -30,12 +29,10 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -SET STATEMENT sql_mode = '' FOR -INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); --error ER_TRUNCATED_WRONG_VALUE -INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); SELECT * FROM diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test similarity index 89% rename from storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test rename to storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test index bdc21cccf52..23ddc373ab2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc ---source ../../include/mroonga/have_version_55.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_version_5_5.inc --source ../../include/mroonga/have_mysql.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test new file mode 100644 index 00000000000..55457c167fa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test index efa54b1e094..94eb237f1a2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_fractional_seconds.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( created_at DATETIME(6), KEY (created_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01.111111"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test index f0f51fba53e..5dc033f1c53 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_fractional_seconds.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME(6) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01.111111"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test index e75539d4ae2..d66ed5617b8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_freebsd.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test similarity index 88% rename from storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test rename to storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test index 808313da930..3382a1c1e68 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date_strict.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test @@ -1,4 +1,4 @@ -# Copyright(C) 2015 Kouhei Sutou +# Copyright(C) 2015-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -24,12 +25,9 @@ CREATE TABLE timestamps ( id INT PRIMARY KEY AUTO_INCREMENT, create_dt DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE timestamps; -SET sql_mode='STRICT_TRANS_TABLES'; --error ER_WARN_DATA_OUT_OF_RANGE INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); -SET sql_mode=default; SELECT * FROM timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test new file mode 100644 index 00000000000..f95b0947fc2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test new file mode 100644 index 00000000000..2b6a05915d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test @@ -0,0 +1,39 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); + +SELECT * FROM timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test new file mode 100644 index 00000000000..4419231a93e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test index 8c30509037f..fcea5431330 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ('NULL', NULL); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test index b49897800a0..bf415b177f8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( created_at DATETIME, KEY (created_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test index b1168f63330..c6c9edec5de 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE diaries ( title TEXT, created_at DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29 21:51:01"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test index 66ba81d79e5..c5107e6c885 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2015-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source include/not_embedded.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -24,16 +26,16 @@ CREATE TABLE timestamps ( id INT PRIMARY KEY AUTO_INCREMENT, create_dt DATETIME ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE timestamps; -SET sql_mode=''; -INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); -INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); -SET sql_mode = DEFAULT; +SET sql_mode='STRICT_TRANS_TABLES'; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +SET sql_mode=default; SELECT * FROM timestamps; -SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test new file mode 100644 index 00000000000..12b5862412e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test index 9213379336f..03cb6b64d2f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( temperature DECIMAL(6, 3), KEY (temperature) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test index 91e4b789aea..ca59d052e78 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE diaries ( title TEXT, temperature DECIMAL(6, 3) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test index 46d9ea37470..14303454af2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( temperature DECIMAL, KEY (temperature) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test index acda07ab954..ef8609a78ad 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE diaries ( title TEXT, temperature DECIMAL ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test index 2b7fd7de818..6a7a5bcc37b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test index f4b3175764c..92eabc11d61 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test new file mode 100644 index 00000000000..8561688db3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test new file mode 100644 index 00000000000..a54ee0e26a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test new file mode 100644 index 00000000000..0bd96387469 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test new file mode 100644 index 00000000000..841c2f44452 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test new file mode 100644 index 00000000000..725c32384df --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test new file mode 100644 index 00000000000..08969fa5716 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test new file mode 100644 index 00000000000..80437aa0e29 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test new file mode 100644 index 00000000000..c36913cecca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test new file mode 100644 index 00000000000..0946b1f30ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test new file mode 100644 index 00000000000..90cb5247693 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test new file mode 100644 index 00000000000..340c5e70fcd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--error 16509 +ALTER TABLE logs ADD INDEX (message); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test new file mode 100644 index 00000000000..480cc1f7b94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test @@ -0,0 +1,32 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +--error 16509 +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL, + FULLTEXT INDEX (message) +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test new file mode 100644 index 00000000000..7c953d30d14 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--error ER_ILLEGAL_HA_CREATE_OPTION +ALTER TABLE logs ADD INDEX (message); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test new file mode 100644 index 00000000000..68d97f990dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test index ca4f154d402..39031cabf15 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test index c1c16d3affc..6b4c637a359 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test index 9c83c94b417..4d4a0f5a673 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test index 5143f06a21a..b96fa9b03b3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test index 9be02c2a1a2..d3caeba70bf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test index b7e85909399..59471f7e97b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test index 432aab88629..e0ab1ad4c1b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/support_libgroonga_lz4.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test index 0f21e37c201..7d5665b04f5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/support_libgroonga_zlib.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test new file mode 100644 index 00000000000..99ac2cdbb6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test @@ -0,0 +1,37 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/support_libgroonga_zstd.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS entries; +--enable_warnings + +CREATE TABLE entries ( + id INT UNSIGNED PRIMARY KEY, + content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZSTD"' +) DEFAULT CHARSET=utf8; + +INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!"); + +SELECT * FROM entries; + +DROP TABLE entries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test index d057e0bcfbd..4d0a80ad5d5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/unsupport_libgroonga_lz4.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test index 1066270e48d..bbaaa51be40 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/unsupport_libgroonga_zlib.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test new file mode 100644 index 00000000000..6b5eb5cd86f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test @@ -0,0 +1,37 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/unsupport_libgroonga_zstd.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS entries; +--enable_warnings + +CREATE TABLE entries ( + id INT UNSIGNED PRIMARY KEY, + content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZSTD"' +) DEFAULT CHARSET=utf8; + +INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!"); + +SELECT * FROM entries; + +DROP TABLE entries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test index b168716ed94..e18f17b7c95 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test index 2098e878ecb..3675db38c48 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test index 995fafefeeb..9b6c8d3016f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc @@ -29,8 +29,9 @@ CREATE TABLE tags ( CREATE TABLE bugs ( id INT UNSIGNED PRIMARY KEY, - tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' + tags VARCHAR(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"' ) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test index d8d181228bb..038d29c9e66 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test new file mode 100644 index 00000000000..9bba55b0b92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test @@ -0,0 +1,37 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs VALUES ('{"message": "start"}'); +INSERT INTO logs VALUES ('{"message": "restart"}'); +INSERT INTO logs VALUES ('{"message": "shutdown"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test new file mode 100644 index 00000000000..f7eae384dcf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + –¼‘O text, + FULLTEXT INDEX (–¼‘O) +) DEFAULT CHARSET=cp932; + +INSERT INTO users VALUES ("‚â‚Ü‚¾"); +INSERT INTO users VALUES ("‚½‚È‚©"); +INSERT INTO users VALUES ("‚·‚¸‚«"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test new file mode 100644 index 00000000000..6d6c44ceba1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + åå‰ text, + FULLTEXT INDEX (åå‰) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES ("ã‚„ã¾ã "); +INSERT INTO users VALUES ("ãŸãªã‹"); +INSERT INTO users VALUES ("ã™ãšã"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test index ede3a07f542..a4e229dd17a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test index c43f5c70e13..5d7b8c4dff8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test index ccddec38fa0..3391fb7b740 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test index c041a3f9ea9..219bb085c84 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test index d8a6a0ac36c..79d56f4e8e6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test index 0a2f9d30749..a031cab8767 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test index b64d97fd24e..287d0407bdf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test index f2252055c10..704cc4d41e3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test index ff2eeef6a7b..2200efc71c4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test index 50824bb2cba..33f07c47470 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test index 54d127c734d..c8e6dddf4bd 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_fractional_seconds.inc @@ -28,7 +28,6 @@ CREATE TABLE running_records ( max TIME(6), KEY (average) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; INSERT INTO running_records (title, average, max) VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test index cfa760bcae5..e950411cba6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE running_records ( max TIME, KEY (average) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; INSERT INTO running_records (title, average, max) VALUES ("normal condition", "01:00:00", "01:05:00"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test index c2407cb1b0b..19dadc2c285 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/skip_mariadb_55.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc --source ../../include/mroonga/have_fractional_seconds.inc --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ CREATE TABLE diaries ( updated_at TIMESTAMP(6), KEY (updated_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at, updated_at) VALUES ("clear day", diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test index f398fb9b9e2..cc063faa674 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test @@ -1,4 +1,4 @@ -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -23,11 +23,10 @@ DROP TABLE IF EXISTS diaries; CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, - created_at TIMESTAMP, - updated_at TIMESTAMP, + created_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', + updated_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', KEY (updated_at) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, created_at, updated_at) VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test index 9cf9cb631ec..de0cbedf0ab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test index 2da118e27a5..b7cb8694301 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test index dea56970414..912f86fb71c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test index a2eb99b1dce..f20348bee6c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test index e219fc0757b..44fb656a93b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test index e9dcd7e1e06..c98569d1974 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test index d90c71df988..9414eee1f02 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test index e7cb3f69610..82004e1971d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE aniversary_memos ( party_year YEAR, KEY (party_year) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; INSERT INTO aniversary_memos (title, party_year) VALUES ("We need a big cake!", "11"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test index 8b798a71837..e7530cec034 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE aniversary_memos ( title TEXT, party_year YEAR ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; INSERT INTO aniversary_memos (title, party_year) VALUES ("We need a big cake!", "11"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test b/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test new file mode 100644 index 00000000000..f57d40fd57b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test @@ -0,0 +1,35 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int PRIMARY KEY +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +SELECT COUNT(*) FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test index 28262bb4b7d..1913469353f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test index f02e4ddcb25..1f7bbf12bde 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -64,6 +64,8 @@ create table t1 (c1 time); desc t1; drop table t1; create table t1 (c1 timestamp); +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP desc t1; drop table t1; create table t1 (c1 datetime); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test index c01d80a209b..908a2fcbdbb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test similarity index 97% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test index cb86cddcbe7..fc66ae12fa0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/not_embedded.inc @@ -29,7 +29,6 @@ CREATE TABLE bugs ( id INT UNSIGNED PRIMARY KEY, tags TEXT FLAGS='COLUMN_VECTOR' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE bugs; SELECT mroonga_command("dump --dump_plugins no"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test index d7514512b5c..b39da499d5e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test index 10d00bfcbb0..0350a299b08 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test similarity index 95% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test index 4b820f7b88e..d208e62e839 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test index 18cfbb33da5..77965a70c99 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test rename to storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test index 1c3b89be67f..46becfdc2cc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_field_type_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test index 18a68fb1f94..aecfab1f6c3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test index 054d311bd44..c5fa91c5c9c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test index 9a22c1b09ea..568c9ac78cf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test new file mode 100644 index 00000000000..df509ed0dcd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + content_size INT NOT NULL, + KEY (content_size) COMMENT 'flags "INDEX_MEDIUM"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test new file mode 100644 index 00000000000..fc37e28eb76 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + is_read BOOL NOT NULL, + KEY (is_read) COMMENT 'flags "INDEX_SMALL"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test index 470283e94d8..cc54ab34ad7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test index 77a7683bc35..0c87494e3c7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test index e3680ad3471..7005643546f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test index 7add6db7831..4700c280d80 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test index 42a91ecfc15..5251bf9842a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test new file mode 100644 index 00000000000..2815b285096 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); + +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test new file mode 100644 index 00000000000..5270372e332 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test @@ -0,0 +1,37 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test index c35c7dc15ce..2d7ff664335 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test index fe9037843bf..15045b5466c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test index 5739e118ae3..16b76e0ec09 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test index 7048ab6e764..c712c2ed018 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -26,7 +27,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX body_index (body) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test index e163201e859..e247e3d17f0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test index 69a48eb7851..a2484a90a6e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -25,7 +26,6 @@ CREATE TABLE variables ( name TEXT, FULLTEXT INDEX (name) COMMENT 'parser "off"' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE variables; INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); INSERT INTO variables (name) VALUES ("mroonga_default_parser"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test index a58a408cf59..b91819e9940 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test index 0d560582184..4fe85314d1c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test index 956044c7618..ba5f9a969ef 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test index 688783b9743..1066ffebbff 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX body_index (body) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test index c7acf23cb31..e7902c7b214 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test index e9c1fdf473c..1fc724f5117 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE variables ( name TEXT, FULLTEXT INDEX (name) COMMENT 'tokenizer "off"' ) DEFAULT CHARSET=utf8; -SHOW CREATE TABLE variables; INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test index 222cc59e402..7ffedeaea5b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( body text, FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' ) DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test index c161c50626d..1eaf8fa615f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test index 22b3061ced2..626172020aa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test index 0c0fb1394cc..2120efe0f96 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test index 74d40a1adc3..317730f205f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test index 62cc9ed172f..2639f32517c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_groonga_plugin_register.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test index 89e6c347c8c..6c2c628224f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test index aa38839f9ca..36f98483789 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test index 44f6bba6adc..00f9336c160 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test index 7c562842a95..be309e71b8f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test index 513c56f074d..3598a17f72e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test index 0199dd14a5d..1bd21b65881 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test index 3d8430703a2..383ada185e5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test new file mode 100644 index 00000000000..764db3d6fe9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test @@ -0,0 +1,57 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP DATABASE IF EXISTS another; +--enable_warnings + +CREATE DATABASE another; +USE another; + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + +DROP TABLE diaries; + + +USE test; + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + + +DROP DATABASE another; + +SELECT mroonga_command('object_exist mroonga_operations'); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test index 39aff4e4b23..b27fda75e95 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test index 887b204c7ae..44d6438bbaf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test new file mode 100644 index 00000000000..57947bb39b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test @@ -0,0 +1,47 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned +); + +ALTER TABLE articles ADD FOREIGN KEY (comment) REFERENCES comments (comment); + +SHOW CREATE TABLE articles; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles; +DROP TABLE comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test new file mode 100644 index 00000000000..9be7cc7d2ea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +ALTER TABLE articles DROP FOREIGN KEY comment; + +SHOW CREATE TABLE articles; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles; +DROP TABLE comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test index 7f02c81dbcd..e8c8540be03 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test @@ -12,102 +12,35 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/skip_mysql_55.inc ---source ../../include/mroonga/skip_mariadb_55.inc +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings -drop table if exists articles2; -drop table if exists articles; -drop table if exists comments2; -drop table if exists comments; +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; --enable_warnings -create table comments( - comment int unsigned, - content text not null, - primary key(comment) +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL ); -create table articles( - content text not null, +CREATE TABLE articles ( + content text NOT NULL, comment int unsigned, FOREIGN KEY (comment) REFERENCES comments (comment) ); -insert into comments (comment, content) values -(1, 'aaa bbb'),(2, 'ccc ddd'),(3, 'eee fff'); +SHOW CREATE TABLE articles; -insert into articles (content, comment) values -('111aaa', 1),('222bbb', 2),('222ccc', 2); +SELECT * FROM information_schema.referential_constraints; -select comment, content from comments; - -select content, comment from articles; - -show create table comments; - -show create table articles; - -select * from information_schema.referential_constraints; - -rename table comments to comments2; -rename table articles to articles2; - -create table comments( - comment int unsigned, - content text not null, - primary key(comment) -); - -create table articles( - content text not null, - comment int unsigned, - FOREIGN KEY (comment) REFERENCES comments (comment) -); - -insert into comments (comment, content) values -(1, 'ab'),(2, 'cd'),(3, 'ef'); - -insert into articles (content, comment) values -('1a', 1),('2b', 2),('2c', 2); - -select comment, content from comments; - -select content, comment from articles; - -select comment, content from comments2; - -select content, comment from articles2; - -show create table comments; - -show create table articles; - -show create table comments2; - -show create table articles2; - -select * from information_schema.referential_constraints; - -alter table articles drop foreign key comment; - -show create table articles; - -select content, comment from articles; - -alter table articles add FOREIGN KEY (comment) REFERENCES comments (comment); - -show create table articles; - -select content, comment from articles; - -drop table articles2; -drop table articles; -drop table comments2; -drop table comments; +DROP TABLE articles; +DROP TABLE comments; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test new file mode 100644 index 00000000000..29453f6916c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +--error ER_ROW_IS_REFERENCED_2 +DELETE FROM comments WHERE id = 100; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test new file mode 100644 index 00000000000..e2635efc56c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 200; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test new file mode 100644 index 00000000000..0b859c8342f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test new file mode 100644 index 00000000000..0ed29655d38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test new file mode 100644 index 00000000000..e93958bab83 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test @@ -0,0 +1,51 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +DROP TABLE IF EXISTS articles2; +DROP TABLE IF EXISTS comments2; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +RENAME TABLE comments TO comments2; +RENAME TABLE articles TO articles2; + +SHOW CREATE TABLE articles2; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles2; +DROP TABLE comments2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test new file mode 100644 index 00000000000..9b5ee9b9e63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test new file mode 100644 index 00000000000..3e0f074828e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +--error ER_NO_REFERENCED_ROW_2 +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test index 6a97baa362e..4bd9ff2db9c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test index 6fedec6810c..89507f0901d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS memos; --enable_warnings -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET NAMES UTF8; CREATE TABLE memos ( @@ -38,6 +38,6 @@ SELECT * FROM memos DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test index 3e3c517bee6..a39cfebd285 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test index f927b45fbc6..b8d1c0b9cdb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test index 1ead74d0354..c59bc9d7b1f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test index ba8f1c1eda1..bcbc4963a56 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test index 655bf1e8fa0..de10774d83d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test index 9c4e92ce55d..d99628494de 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test index 5f1efdb796d..bbebb5b5fe5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test index b720dcf6f71..f4d2112b35a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test index 82d0718d1e8..e6f2a7ce6b6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test index c2efa7a8575..d2258a399d1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test index 29107188c35..03a2ff8744a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test index c5b5f2f795b..97cc2623ebc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test new file mode 100644 index 00000000000..00bd029dee3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*SS content @ '天気'" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*SS content @ '天気'" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test new file mode 100644 index 00000000000..e6034ac2af5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test @@ -0,0 +1,50 @@ +# Copyright(C) 2016 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +DROP TABLE IF EXISTS readings; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE readings ( + reading VARCHAR(255) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE items ( + name VARCHAR(255) PRIMARY KEY, + readings TEXT COMMENT 'flags "COLUMN_VECTOR", type "readings"', + FULLTEXT INDEX items_index(readings) COMMENT 'table "readings"' +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES("日本", "ニホン ニッãƒãƒ³"); +INSERT INTO items VALUES("ローマ字", "ローマジ"); +INSERT INTO items VALUES("漢字", "カンジ"); + +SELECT *, MATCH(readings) + AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE) AS score + FROM items + WHERE MATCH(readings) + AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE); + +DROP TABLE items; +DROP TABLE readings; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test index e8ad55ab4c6..bee227664cb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test index 5cc8f4154c4..b84eb91129c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test index b85580dba01..2edac1599f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test index 642b438ebf6..583ede590e8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test index 5ea8c21797f..8c4cdb79e20 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test index b9beffa2ef7..a972cc6f474 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS memos; --enable_warnings -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = ERROR; SET NAMES UTF8; @@ -40,6 +40,6 @@ SELECT * FROM memos DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test index c4195f2a541..4703fa7df10 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS memos; --enable_warnings -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; SET NAMES UTF8; @@ -40,6 +40,6 @@ SELECT * FROM memos DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test index 9a45d479d30..86803c72451 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS memos; --enable_warnings -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = "IGNORE"; SET NAMES UTF8; @@ -39,6 +39,6 @@ SELECT * FROM memos DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test index cf2cd503b28..0080632324f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS memos; --enable_warnings -SET GLOBAL mroonga_default_parser = TokenDelimit; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; SET NAMES UTF8; @@ -39,6 +39,6 @@ SELECT * FROM memos DROP TABLE memos; -SET GLOBAL mroonga_default_parser = TokenBigram; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test index 4032ca9e669..d080d70d4d8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test index b6ac95da232..db8fa2b4ccb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_cp932.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test index c990b288552..39c89dbd7a3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_eucjpms.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test index 2e457aa768c..0de940534f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test index 8fc97821563..503b96106c3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, FULLTEXT INDEX (content) ) DEFAULT CHARSET utf8mb4; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); INSERT INTO diaries VALUES(2, "Mathmatics", "ð€ðð‚ðƒð„ | U+1D400-U+1D405"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test index 619363f0fed..d97e75fef51 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test index 41d1ab91660..38fbc8bb302 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -31,7 +31,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test index e346fb1d3bc..e1fea8b07e7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test index 0ac152703c9..5aa812fcb04 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ create table diaries ( content text, fulltext index (title) ) default charset utf8; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test index 4f932d5ac2a..2bad02c0991 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test index ef610b983df..5c1ec53c573 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -21,7 +21,6 @@ drop table if exists t1, t2, t3; --enable_warnings create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); -show create table t1; insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test index ab9522f6fa2..718d78732c6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test index 2881d3cf160..7a4bd9b8cb7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test index 353e19804e5..174374711b9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test index 949cc61a442..8ccef3d68e3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test index 97319b71176..72b617812e9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ create table diaries ( fulltext index title_index (title), fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (title, body) values ("survey", "will start groonga!"); insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test index 419224d4fc0..3487f704d90 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES("Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES("天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test index 3f7377d9c6e..416b61b7cc9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test index 5c94603c07f..995f92aa413 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test index 06afa3ce9cd..dc5901ef777 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test index c90fdf6f88a..73424524fc4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test index a230111ba16..0d2963af7fe 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test index 601ffcb73bb..0d13720a54e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test index 7c0156ffd33..aaef394ebda 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test index c422a6a6750..aa1a1a2c160 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test index cdb4b9f27ae..fd9ea74d86a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test index 54206e43843..c690f92e2ac 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test index 1e84064b122..2919ad86288 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test index a5040dd80a6..485e2d84cfb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test index 17957ab8284..bad8e8bc9c3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test similarity index 95% rename from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test rename to storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test index 7dbc8fca2b7..c1d2c6c4cef 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_56.inc +--source ../../include/mroonga/have_version_10_0.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test similarity index 95% rename from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test rename to storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test index da9de22217c..7c00c29bc47 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_55.inc +--source ../../include/mroonga/have_version_5_5.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test similarity index 95% rename from storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test rename to storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test index cf4c9b60230..a102b4acc72 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_100.inc +--source ../../include/mroonga/have_version_5_6.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test new file mode 100644 index 00000000000..091abbc911a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES('It is Groonga'); +INSERT INTO diaries VALUES('It is Mroonga'); + +SELECT mroonga_command('select', + 'table', 'diaries', + 'filter', 'title @ "Groonga"'); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test index 892b24c5a7a..501c2ac86ab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test new file mode 100644 index 00000000000..a74acf89ed8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE IF EXISTS `db-1`; +CREATE DATABASE `db-1`; +USE `db-1`; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE diaries; + +--disable_query_log +USE test; +DROP DATABASE `db-1`; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test index 2712aab2218..7eb3bba1f3f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test index 862e98c5a8c..ca18a93e15c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test index 39f99a7c2d4..13adc1956d1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test rename to storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test index 1dca7076512..993d0b1a413 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test rename to storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test index e70bb3f367d..5b99a0ebeb6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test new file mode 100644 index 00000000000..63cb2b320d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS queries; +--enable_warnings + +CREATE TABLE users ( + id INT +); + +CREATE TABLE queries ( + user_id INT, + query TEXT +); + +INSERT INTO users VALUES (1); +INSERT INTO users VALUES (2); +INSERT INTO users VALUES (3); + +INSERT INTO queries VALUES (1, '(a)'); +INSERT INTO queries VALUES (2, '(b)'); +INSERT INTO queries VALUES (3, '(c)'); + +SELECT users.id, mroonga_escape(queries.query) AS escaped_query + FROM queries + LEFT JOIN users ON users.id = queries.user_id + ORDER BY users.id; + +DROP TABLE queries; +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test new file mode 100644 index 00000000000..3f93ab18282 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test @@ -0,0 +1,46 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; + +SET NAMES utf8mb4; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8mb4; + +INSERT INTO memos VALUES(1, "(Groonga) Installed!"); +INSERT INTO memos VALUES(2, "(Mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(Groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST(mroonga_escape("(groonga)") IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test new file mode 100644 index 00000000000..cdd431cfad0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:' AS query) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test rename to storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test index 503e2000b10..f98c4303ef6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test new file mode 100644 index 00000000000..10041ef8360 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS data; +--enable_warnings + +CREATE TABLE data ( + value DECIMAL(5, 3) +); + +INSERT INTO data VALUES (2.9); + +SELECT mroonga_escape(value AS script) + FROM data; + +DROP TABLE data; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test new file mode 100644 index 00000000000..141def4f879 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape(-29 AS script) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test new file mode 100644 index 00000000000..663fa69aba9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS data; +--enable_warnings + +CREATE TABLE data ( + value REAL +); + +INSERT INTO data VALUES (2.9); + +SELECT mroonga_escape(value AS script) + FROM data; + +DROP TABLE data; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test new file mode 100644 index 00000000000..864cef60703 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('a\"\\\'z' AS script) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test new file mode 100644 index 00000000000..09bdde1c382 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test @@ -0,0 +1,45 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS keywords; +--enable_query_log +--enable_warnings + +CREATE TABLE keywords ( + keyword text +); + +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + keyword) AS highlighted + FROM keywords; + +--disable_query_log +DROP TABLE keywords; +--enable_query_log + + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test new file mode 100644 index 00000000000..10f44e44618 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test @@ -0,0 +1,31 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + 'ロック', 'æ›´æ–°') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test new file mode 100644 index 00000000000..185842e77e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test @@ -0,0 +1,25 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + 'Mroonga', 'Groonga') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test new file mode 100644 index 00000000000..19c1ae826e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test @@ -0,0 +1,25 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + 'mroonga') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test new file mode 100644 index 00000000000..089a1d4eba9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test @@ -0,0 +1,31 @@ +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + 'ロック æ›´æ–° -ボトルãƒãƒƒã‚¯' AS query) AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test new file mode 100644 index 00000000000..3ba38c0b8d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + '*D- +ロック +æ›´æ–° ボトルãƒãƒƒã‚¯' AS query) AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test new file mode 100644 index 00000000000..db5b06ecd85 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test @@ -0,0 +1,55 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); + +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); + +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); + +SELECT mroonga_highlight_html(content, 'Mroonga') AS highlighted + FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test index 5d80d5230ef..da116a4a508 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test index 98e8d9dab2f..1ba332c4d86 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test index 41f9d3684bf..1fdd0a60511 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test new file mode 100644 index 00000000000..d5159b88ce1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test @@ -0,0 +1,24 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_normalize('aBcAbCã‘'); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test new file mode 100644 index 00000000000..9631313d79b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test @@ -0,0 +1,24 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_normalize('aBcAbCã‘', "NormalizerAuto"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test new file mode 100644 index 00000000000..88ee40fc6ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test @@ -0,0 +1,40 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('aBcAbCã‘'); + +SELECT mroonga_normalize(content) FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test new file mode 100644 index 00000000000..ee80cd8b914 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test @@ -0,0 +1,46 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +INSERT INTO synonyms VALUES ('Mroonga', 'Mroonga'); +INSERT INTO synonyms VALUES ('Mroonga', 'Groonga MySQL'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test new file mode 100644 index 00000000000..1a2c9d84404 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test new file mode 100644 index 00000000000..50e4fc558bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test @@ -0,0 +1,44 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test new file mode 100644 index 00000000000..2a8aad83d29 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test @@ -0,0 +1,45 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('D+', '[D+]'); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + '*D+ Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test index 0cb551dbc69..028bdb750ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test index 338417021c8..2d85633ab94 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source include/have_cp932.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test index fa8dbb20e93..525c14a3004 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source include/have_eucjpms.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test new file mode 100644 index 00000000000..5faed518891 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test @@ -0,0 +1,45 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS keywords; +--enable_query_log +--enable_warnings + +CREATE TABLE keywords ( + keyword text +); + +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); + +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', + keyword) as snippet + FROM keywords; + +--disable_query_log +DROP TABLE keywords; +--enable_query_log + + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test new file mode 100644 index 00000000000..c01d298853f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test @@ -0,0 +1,31 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + 'ロック', 'æ›´æ–°') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test new file mode 100644 index 00000000000..60d206d2b40 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test @@ -0,0 +1,25 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', + 'Mroonga', 'Groonga') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test new file mode 100644 index 00000000000..b4dfd0c5f5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test @@ -0,0 +1,29 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_snippet_html('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.', + 'lock') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test new file mode 100644 index 00000000000..998a080c7f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test @@ -0,0 +1,31 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + 'ロック æ›´æ–° -ボトルãƒãƒƒã‚¯' AS query) as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test new file mode 100644 index 00000000000..b01dcbcd54c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaã«ã¯2ã¤ã®å‹•作モードãŒã‚りã¾ã™ã€‚ + +1ã¤ãŒã€Œã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ãƒ¢ãƒ¼ãƒ‰ã€ã§ã€ãƒ‡ãƒ¼ã‚¿ã‚¹ãƒˆã‚¢ã‚‚検索機能もã™ã¹ã¦Groongaを使ã†ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“れãŒãƒ‡ãƒ•ォルトã®ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚上述ã®å‚照ロックフリーãªGroongaã®æ€§èƒ½ç‰¹æ€§ã‚’ãƒ•ãƒ«ã«æ´»ã‹ã—ãŸé«˜é€Ÿãªãƒ‡ãƒ¼ã‚¿æ›´æ–°ãƒ»å…¨æ–‡æ¤œç´¢ãƒ»ä½ç½®æƒ…報検索ãŒç‰¹é•·ã§ã™ã€‚一方ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ã®æ©Ÿèƒ½ã¯æä¾›ã•れã¾ã›ã‚“。 + +ã‚‚ã†1ã¤ãŒã€Œãƒ©ãƒƒãƒ‘ーモードã€ã§ã€MyISAMã‚„InnoDBã¨ã„ã£ãŸä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ã« 全文検索機能ã ã‘ を追加ã™ã‚‹ãƒ¢ãƒ¼ãƒ‰ã§ã™ã€‚ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãªã©ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒã‚µãƒãƒ¼ãƒˆã—ã¦ã„る機能ã«åŠ ãˆã¦Groongaã®é«˜é€Ÿãªå…¨æ–‡æ¤œç´¢æ©Ÿèƒ½ã‚’利用ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚一方ã€Groongaã®å‚照ロックフリーãªç‰¹æ€§ã¯æ´»ã‹ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。ã¾ãŸã€æ›´æ–°å‡¦ç†ã¯ä»–ã®ã‚¹ãƒˆãƒ¬ãƒ¼ã‚¸ã‚¨ãƒ³ã‚¸ãƒ³ãŒãƒœãƒˆãƒ«ãƒãƒƒã‚¯ã«ãªã‚‹ã“ã¨ãŒå¤šã„ã§ã—ょã†ã€‚', + '*D- +ロック +æ›´æ–° ボトルãƒãƒƒã‚¯' AS query) as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test new file mode 100644 index 00000000000..59163fe4597 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test @@ -0,0 +1,55 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); + +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); + +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); + +SELECT mroonga_snippet_html(content, 'Mroonga') as snippet + FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test index a4e24ce030e..2547000aa95 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test index 4df02c14e7b..e8805b492d6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test index 3d41de6a93e..1678a3ed29d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test index f0ce4e81ddb..6f779f610f3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc ---source ../../include/mroonga/skip_mysql_57.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test index 4aed7b24729..94d8024071f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test @@ -1,4 +1,4 @@ -# Copyright(C) 2011-2012 Kouhei Sutou +# Copyright(C) 2011-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -28,7 +29,6 @@ CREATE TABLE shops ( location GEOMETRY NOT NULL, SPATIAL KEY location_index (location) ); -SHOW CREATE TABLE shops; INSERT INTO shops (name, location) VALUES ('nezu-no-taiyaki', @@ -144,6 +144,11 @@ SELECT id, name, ST_AsText(location) AS location_text FROM shops WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) ORDER BY id; +EXPLAIN +SELECT id, name, ST_AsText(location) AS location_text FROM shops + WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) + ORDER BY id; + DROP TABLE shops; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test similarity index 86% rename from storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test rename to storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test index 00efe1e4ac7..2fd4fad68e7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null_57.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test @@ -1,5 +1,5 @@ # Copyright(C) 2014 Kenji Maruyama -# Copyright(C) 2015 Kouhei Sutou +# Copyright(C) 2015-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,10 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_geometry.inc ---source ../../include/mroonga/have_version_57.inc +--source ../../include/mroonga/have_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -27,9 +27,8 @@ CREATE TABLE shops ( location GEOMETRY NOT NULL ); -SET SESSION sql_mode = ''; +--error ER_BAD_NULL_ERROR INSERT INTO shops VALUES (NULL), (NULL); -SET SESSION sql_mode = default; SELECT ST_AsText(location) FROM shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test new file mode 100644 index 00000000000..605e03833da --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test @@ -0,0 +1,152 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL, + SPATIAL KEY location_index (location) +); + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + ST_GeomFromText('POINT(139.711517 35.647701)')); + +SELECT id, name, ST_AsText(location) AS location_text FROM shops; +SELECT id, name, ST_AsText(location) AS location_text FROM shops + WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) + ORDER BY id; + +EXPLAIN +SELECT id, name, ST_AsText(location) AS location_text FROM shops + WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) + ORDER BY id; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test index 0354e9b7e4b..ccc51b79e68 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test @@ -14,11 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test index a1429859a33..478ae97ba9f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test index 0f63eed4b52..a1c43cc417e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test index dcf029593fd..f342c049fd5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test index a28a912e23d..bfb3f456360 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test index d622aade72d..7925f4ffc16 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test @@ -1,4 +1,5 @@ # Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,24 +13,28 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings -drop table if exists t1, t2, t3; +DROP TABLE IF EXISTS t1; --enable_warnings -create table t1 (_id int, a int, primary key (_id) using hash); +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); + --error ER_BAD_NULL_ERROR -insert into t1 values(null, 100); -insert ignore into t1 values(1,100); -insert ignore into t1 values(1,100); -insert ignore into t1 values(1,100); -insert ignore into t1 values(1,100); -select * from t1; -select * from t1 where _id = 2; -select * from t1 where _id = 20; -drop table t1; +INSERT INTO t1 VALUES(null, 100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); + +SELECT * FROM t1; +SELECT * FROM t1 WHERE _id = 2; +SELECT * FROM t1 WHERE _id = 20; + +DROP TABLE t1; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test index 8f1e6b889bb..bf665e83bc5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test index acb298ef812..e9f20387651 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test new file mode 100644 index 00000000000..b2629c80675 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 VALUES(null, 100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); + +SELECT * FROM t1; +SELECT * FROM t1 WHERE _id = 2; +SELECT * FROM t1 WHERE _id = 20; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test index ebf331d2f15..5cb0eed102f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test index 5afdd36b5b8..c5d97a29785 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test index 314dbd85d95..be7b7eefd0f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test index 82372d63527..23e75a58073 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test index a221c40dcc1..eef9de2d095 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test index b765bab6769..8d2d6c92ade 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test new file mode 100644 index 00000000000..521061cdf61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test @@ -0,0 +1,49 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + score3 INT, + INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); + +SELECT * + FROM items + WHERE score1 = 2 + ORDER BY score2 ASC, score3 ASC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test new file mode 100644 index 00000000000..d48c0e56b17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test @@ -0,0 +1,49 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + score3 INT, + INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); + +SELECT * + FROM items + WHERE score1 = 2 + ORDER BY score2 DESC, score3 DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test index 40b39fe8538..92a83088086 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test index 52cee4c7b33..8978ee2af49 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test new file mode 100644 index 00000000000..6abe39795fd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + name char(30) NOT NULL, + score int NOT NULL, + PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; + +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); + +SELECT * FROM scores; + +--error 1265 +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; + +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test index d71d1917df5..64292cf18d1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test @@ -1,4 +1,4 @@ -# Copyright(C) 2011 Kouhei Sutou +# Copyright(C) 2011-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,28 +12,35 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings -drop table if exists listing; +DROP TABLE IF EXISTS scores; --enable_warnings -set names utf8; -create table scores ( - name char(30) not null, - score int not null, - primary key (name, score) -) default charset utf8; -show create table scores; -insert into scores (name, score) values("Taro Yamada", 29); -insert into scores (name, score) values("Taro Yamada", -12); -insert into scores (name, score) values("Jiro Yamada", 27); -insert into scores (name, score) values("Taro Yamada", 10); -select * from scores; -update ignore scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; -select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); -drop table scores; +SET NAMES utf8; +CREATE TABLE scores ( + name char(30) NOT NULL, + score int NOT NULL, + PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; + +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); + +SELECT * FROM scores; + +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; + +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test rename to storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test index 431f123497b..0cfbea67080 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test rename to storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test index bc739fdfb52..e5543a66b45 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test rename to storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test index a3c3b766340..e326aca2678 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test similarity index 98% rename from storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test rename to storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test index 3cbac1c1ff9..d2e09033f03 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test new file mode 100644 index 00000000000..49d0d7798d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test new file mode 100644 index 00000000000..d8e90a15df9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test new file mode 100644 index 00000000000..317517f4ca9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test new file mode 100644 index 00000000000..310cc476419 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test new file mode 100644 index 00000000000..7449e21ef3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test new file mode 100644 index 00000000000..3ea5db1493a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test new file mode 100644 index 00000000000..50e9ca0d76f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test new file mode 100644 index 00000000000..125143d71ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test @@ -0,0 +1,45 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test index 430b3bb94a2..c674388e181 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test index 18db29cc85f..4bffa8c396a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test index 07ab3d38028..01139dc631d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test index 567d32e0ffd..902750ba265 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test index 0658bbcedf3..4172666fafd 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test new file mode 100644 index 00000000000..2077b914428 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT NOT NULL, + score2 INT NOT NULL, + INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; + +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); + +SELECT MAX(score2) FROM scores WHERE score1 = 2; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test new file mode 100644 index 00000000000..8541aaddae0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT NOT NULL, + score2 INT NOT NULL, + INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; + +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); + +SELECT MIN(score2) FROM scores WHERE score1 = 2; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test index a79567bde7f..936a57bc2d8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test index 7c9af9aa998..4778da9afa0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test index 0c949ab25b1..bbb03e0229c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test index c842ff428c3..1323b4ce4a8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -33,13 +31,13 @@ CREATE TABLE ranges ( UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); SELECT * FROM ranges FORCE INDEX(range_key) - WHERE start = "1000-01-01" AND end = "9999-12-31"; + WHERE start = "1000-01-02" AND end = "9999-12-31"; DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test index 708ba0b44dc..666b9566efa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test @@ -14,11 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -32,10 +31,10 @@ CREATE TABLE ranges ( UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); SELECT start, end FROM ranges FORCE INDEX(range_key) diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test index ce28c45aac6..071113a6ca1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test index 9e68d627890..630ae74b25e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test index 92bd9915a22..89108b7270d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -34,9 +32,9 @@ CREATE TABLE ranges ( ); INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); -INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start, end; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test index a25cd4d87c3..3cb5bcae3bf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -34,9 +32,9 @@ CREATE TABLE ranges ( ); INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); -INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); -INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); -INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start DESC, end DESC; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test index 6a04c4a9df5..182f185a0d6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test index 0807e78c0aa..d33d2c1f84e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -33,10 +31,10 @@ CREATE TABLE ranges ( UNIQUE KEY range_key(start, end) ); -INSERT INTO ranges VALUES (1, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (1, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); SELECT start, end FROM ranges FORCE INDEX(range_key) diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test index 776e05a2ffe..8d4f348c4c3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test @@ -1,4 +1,4 @@ -# Copyright(C) 2015 Kouhei Sutou +# Copyright(C) 2015-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_strict_sql_mode.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test index 3fcc92f7acf..b4b5f500c56 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -34,9 +32,9 @@ CREATE TABLE ranges ( ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); -INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start, end; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test index 4d25f29cfdc..a2c4564253a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test @@ -14,12 +14,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_freebsd.inc ---source ../../include/mroonga/skip_osx.inc ---source ../../include/mroonga/skip_solaris10.inc ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -34,9 +32,9 @@ CREATE TABLE ranges ( ); INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); -INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); -INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); -INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); SELECT * FROM ranges FORCE INDEX(range_key) ORDER BY start DESC, end DESC; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test index eb6df3af8ad..bd360544ee1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test index faf590d84b6..38265a6ed99 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test index 52e4113dc09..fa4780d541b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test index a8e36f2ff26..af3394b1f61 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test index c13ed51cf7f..bc8a7e723a0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test index 497010df032..63f708afbb2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test index 2ee8ae466ac..7e7357108a5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test @@ -1,5 +1,5 @@ # Copyright(C) 2012 Kentoku SHIBA -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -23,8 +23,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, - start timestamp, - end timestamp, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test index efb7ab70ae2..3f337d05523 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -24,8 +24,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, - start timestamp, - end timestamp, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test index 1b1e62951e4..6dbc4938874 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test @@ -1,5 +1,5 @@ # Copyright(C) 2012 Kentoku SHIBA -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -24,8 +24,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, - start timestamp, - end timestamp, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test index 74bd0eb133a..7a1bd6bc74f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test @@ -1,5 +1,5 @@ # Copyright(C) 2012 Kentoku SHIBA -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -23,8 +23,8 @@ DROP TABLE IF EXISTS ranges; CREATE TABLE ranges ( id int PRIMARY KEY, - start timestamp, - end timestamp, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', UNIQUE KEY range_key(start, end) ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test index e116e7a251e..67ae21224d1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test index 7a17092d599..ac77089ac73 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test index 2505b47b1bc..21a3b936afe 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test @@ -13,11 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc ---source ../../include/mroonga/skip_osx.inc --disable_warnings DROP TABLE IF EXISTS ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test index b475b857fd4..fa91ca3177d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test @@ -13,11 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc ---source ../../include/mroonga/skip_osx.inc --disable_warnings DROP TABLE IF EXISTS ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test index 4317cc1e974..1db76c68e46 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test index b7e910f0829..503322a5470 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test @@ -13,9 +13,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/skip_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test index 5a4525fe7a5..226a51b4333 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test @@ -13,11 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc ---source ../../include/mroonga/skip_osx.inc --disable_warnings DROP TABLE IF EXISTS ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test index 8865c3610ff..0f1830ff6d6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test @@ -13,11 +13,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc --source ../../include/mroonga/have_mroonga.inc ---source ../../include/mroonga/skip_osx.inc --disable_warnings DROP TABLE IF EXISTS ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test index e7ac3a8a941..b80986c3938 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test index d1c23dfbc73..0d303496afb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test index 19fc2c36dfb..e250885d058 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test index 37cd919eb77..a954ffd4ee3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test index 9cdee6b1efb..19cedaffcd4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test index 1e1029d0d86..9228b1ffb91 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test index 9b94d315836..dc9db9652f6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE diaries ( day DATE PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test index 44a9fcaca69..7ddd4861708 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_fractional_seconds.inc --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ CREATE TABLE diaries ( day DATETIME(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (day, title) VALUES ("2012-01-29 21:51:01.111111", "clear day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test index 82b6632672c..aba0d8755f0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE diaries ( day DATETIME PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (day, title) VALUES ("2012-01-29 21:51:01", "clear day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test index c9134275c45..4e2bd44d2d1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE releases ( version DECIMAL(6, 3) PRIMARY KEY, message TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE releases; INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test index f9cdd093ff4..a5073a6334a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE releases ( version DECIMAL PRIMARY KEY, message TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE releases; INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); INSERT INTO releases (version, message) VALUES (10, "10th release!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test index 7b8f48e185a..bf61a4fbd0f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_fractional_seconds.inc @@ -25,7 +25,6 @@ CREATE TABLE running_records ( time TIME(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; INSERT INTO running_records (time, title) VALUES ("01:00:00.000001", "normal condition"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test index d71dd6485d2..6e5c369ffa0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE running_records ( time TIME PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE running_records; INSERT INTO running_records (time, title) VALUES ("01:00:00", "normal condition"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test index f59ee627301..1eb103b76c7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test @@ -12,9 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/skip_mariadb_55.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc --source ../../include/mroonga/have_fractional_seconds.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( time TIMESTAMP(6) PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01.111111", "clear day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test index 7d8c1778331..341dfd21c09 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE diaries ( time TIMESTAMP PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test index 9c8e4e46c28..a610944d835 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test index 6236b2d961d..a390eba41f7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE aniversary_memos ( party_year YEAR PRIMARY KEY, title TEXT ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE aniversary_memos; INSERT INTO aniversary_memos (party_year, title) VALUES ("11", "We need a big cake!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test index 9358c7c0e47..97e8efc73cb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test index 9fe76989745..a3e040b554b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test index 24967c9d14b..454326ea212 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test index 7f4bc666fe1..1a9a06f8b40 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test index 58604aa347d..d19cfcb2262 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test index df89318fbe4..aa0761aa871 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test index 97dc161f191..068f53fea69 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test index 2e4451b9fb7..b9033323962 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test index 76729da279e..5b1e16538ad 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test index 692953f9332..10446b115b5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test index d5c73ac3d81..66d29dfb8f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test index b8d2dac9cac..7dcbb6e9023 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test index 8f262237cde..8537caed403 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test index 994eff8b69a..d7d48ea72be 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test index 9e58d3cd8e4..216c5f4ef99 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test index 14c97749c37..90f241ad285 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test index 318ccbfb820..58e58f4dbdd 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test index ef89fbdd128..2b81524aef2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test index e35baa13037..7ad385098ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test index aca93729e3b..0baa5d4b311 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test index f9563018bea..15e539b5524 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test index b95dca5fe07..a3e1d35647b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test index a817dfc285c..c63a8a867a8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test index f9f42e48ac5..81d6df92ffa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test index 97762972912..c64bd185b21 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test index bba35ebbdeb..82ea8949d86 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test index 04344db0034..68557022856 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test index 27ef9af3a80..c513983d886 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test index 518eabe1cb0..51ed0a3bb8b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test index 08b9c5b5648..9d9d02c4b02 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test index 84f2adce7c8..04584d2f71f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test index 995dd9d77a6..7b8a6fecbab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test index 106a5bdd9f2..c2307642392 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test index 4a0b2ff3492..c4004e4207a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test new file mode 100644 index 00000000000..f4d468b71b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test @@ -0,0 +1,39 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int, + UNIQUE KEY (id) +); + +INSERT INTO ids VALUES (1); +DELETE FROM ids; +INSERT INTO ids VALUES (1); + +SELECT * FROM ids; + +-- error ER_DUP_ENTRY +INSERT INTO ids VALUES (1); + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test index 27c094acec9..3b3743b8b37 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test index 4acdfc0f1bf..70c6ec8576f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test index 7642ee733f3..27fb6eea834 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test index 8bcdb56ccfd..fe222c377ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test index fbf776d9e39..b1a37b5acc9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test index 557ce195ae3..3d47500544f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test index 43988b71a9a..fb462fd7685 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test index f6d2d8fb5db..2dcf6716e2e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test index 3135ad9fa34..f1aac9c1c33 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test index 7b54e8d3ac5..445bcfabe39 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test index 6e3ce140eba..95c21513d57 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc @@ -77,22 +77,6 @@ insert into t1 values("2010/03/26 11:22:33"); select * from t1; drop table t1; - -# for virtual columns -create table t1 (c1 int, _id int); -set sql_mode=""; -# warning WARN_DATA_TRUNCATED -insert into t1 (c1,_id) values (1,1); -set sql_mode="strict_all_tables"; -# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported -# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. -# We share this test with all MySQL servers. So we use number here. ---error 1265 -insert into t1 (c1,_id) values (4,1); -select * from t1; -drop table t1; - - # duplicated key error create table t1 (c1 int primary key, c2 int); insert into t1 values(1,100); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test index d58d4326742..e52d11c5582 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,9 +12,12 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +skip "This test is too fragile."; --source include/not_embedded.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test index a53e672cbe4..e6c0cae164f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test index c25e4606359..1b07775d681 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,7 +24,6 @@ CREATE TABLE diaries ( day DATE PRIMARY KEY, title TEXT ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (day, title) VALUES ("2012-02-14", "clear day") diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test index 5542b0ece3b..f5b6db7bab6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( title TEXT, UNIQUE KEY day (day) ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (day, title) VALUES ("2012-02-14", "clear day1") diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test new file mode 100644 index 00000000000..3f3fd208aef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (c1 int, _id int); +--disable_warnings +SET sql_mode=""; +--enable_warnings +# warning WARN_DATA_TRUNCATED +INSERT INTO t1 (c1,_id) VALUES (1,1); +--disable_warnings +SET sql_mode="STRICT_ALL_TABLES"; +--enable_warnings +# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported +# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. +# We share this test with all MySQL servers. So we use number here. +--error 1265 +INSERT INTO t1 (c1,_id) VALUES (4,1); +SELECT * FROM t1; +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test index 48d50135b08..1f9c5fd3849 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test index eeda3dac4a9..6c7627e7967 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test deleted file mode 100644 index 2355e5d4af4..00000000000 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_TODO_SPLIT_ME.test +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright(C) 2010 Kentoku SHIBA -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - ---source ../../include/mroonga/have_mroonga.inc - ---disable_warnings -drop table if exists t1, t2, t3; ---enable_warnings - -flush status; -create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); -insert into t1 values(1,10,"aa ii uu ee oo"); -insert into t1 values(2,20,"ka ki ku ke ko"); -insert into t1 values(3,30,"sa si su se so"); -insert into t1 values(4,40,"ta ti tu te to"); -insert into t1 values(5,50,"aa ii uu ee oo"); -show status like 'mroonga_count_skip'; -select * from t1; -show status like 'mroonga_count_skip'; -select count(*) from t1; -show status like 'mroonga_count_skip'; -select * from t1 force index(primary) where c1 between 2 and 4; -show status like 'mroonga_count_skip'; -select count(*) from t1 force index(primary) where c1 between 2 and 4; -show status like 'mroonga_count_skip'; -select c1 from t1 force index(primary) where c1 < 3; -show status like 'mroonga_count_skip'; -select count(c1) from t1 force index(primary) where c1 < 3; -show status like 'mroonga_count_skip'; -select 1 from t1 force index(primary) where c1 > 3; -show status like 'mroonga_count_skip'; -select count(1) from t1 force index(primary) where c1 > 3; -show status like 'mroonga_count_skip'; -select * from t1 where match(c3) against("su"); -show status like 'mroonga_count_skip'; -select count(*) from t1 where match(c3) against("su"); -show status like 'mroonga_count_skip'; -select * from t1 where match(c3) against("+su" in boolean mode); -show status like 'mroonga_count_skip'; -select count(*) from t1 where match(c3) against("+su" in boolean mode); -show status like 'mroonga_count_skip'; -select * from t1 force index(idx1) where c2 between 20 and 40; -show status like 'mroonga_count_skip'; -select count(*) from t1 force index(idx1) where c2 between 20 and 40; -show status like 'mroonga_count_skip'; -drop table t1; - ---source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test index 6d07ab7b606..69713752f4f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,11 +30,17 @@ CREATE TABLE diaries ( INSERT INTO diaries VALUES("Hello mroonga!"); INSERT INTO diaries VALUES("It's funny."); +disable_query_log; CONNECT (thread2, localhost, root, ,); CONNECTION thread2; +enable_query_log; + INSERT INTO diaries VALUES("Happy birthday!"); + +disable_query_log; DISCONNECT thread2; CONNECTION default; +enable_query_log; SHOW STATUS LIKE 'mroonga_count_skip'; SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test index 26930d47502..07bbc773973 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test index fedf31810c7..2014a8fa476 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ CREATE TABLE diaries ( content TEXT, FULLTEXT INDEX(content) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test new file mode 100644 index 00000000000..3c63ecc9c12 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test @@ -0,0 +1,44 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT, + age INT, + INDEX (id, age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); + +SELECT COUNT(*) FROM users WHERE id = 2 AND age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test new file mode 100644 index 00000000000..cccb0d3f48f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); + +SELECT COUNT(*) FROM users WHERE age BETWEEN 28 AND 30; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test new file mode 100644 index 00000000000..f8ebad5d7bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); + +SELECT COUNT(*) FROM users WHERE age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test new file mode 100644 index 00000000000..9e3c6fd8a32 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); + +SELECT COUNT(*) FROM memos + WHERE MATCH(content) AGAINST('+Groonga' IN BOOLEAN MODE); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test new file mode 100644 index 00000000000..634428c5c95 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); + +SELECT COUNT(*) FROM memos + WHERE MATCH(content) AGAINST('Groonga'); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test new file mode 100644 index 00000000000..0feababfbf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); + +SELECT COUNT(*) FROM users WHERE age > 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test new file mode 100644 index 00000000000..5e69f1684ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); + +SELECT COUNT(*) FROM users WHERE age >= 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test new file mode 100644 index 00000000000..8aa1ba17621 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); + +SELECT COUNT(*) FROM users WHERE age < 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test new file mode 100644 index 00000000000..a6e0f3a51ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); + +SELECT COUNT(*) FROM users WHERE age <= 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test new file mode 100644 index 00000000000..f07d1b9beae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); + +SELECT COUNT(*) FROM users WHERE age <> 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test index 378f4424da1..cc3de7c3ce6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test new file mode 100644 index 00000000000..1f49597bb27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT, + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); + +SELECT COUNT(*) FROM users WHERE id = 3 AND age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test new file mode 100644 index 00000000000..1c9e7354c35 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id BETWEEN 2 AND 4; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test new file mode 100644 index 00000000000..23fb2152f94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id = 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test new file mode 100644 index 00000000000..9020dd11efa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id > 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test new file mode 100644 index 00000000000..f4c1e0687c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id >= 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test new file mode 100644 index 00000000000..bcf5afa52de --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id < 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test new file mode 100644 index 00000000000..ddfad77ceff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id <= 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test new file mode 100644 index 00000000000..c49385ed849 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id <> 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test index 20b89f72463..e65e44d1f60 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test new file mode 100644 index 00000000000..14f548db124 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test @@ -0,0 +1,57 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(title), + FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(5, "title 1", "content a"); +INSERT INTO memos VALUES(12, "title 1", "content a"); +INSERT INTO memos VALUES(10, "title 1", "content a"); +INSERT INTO memos VALUES(4, "title 2", "content b"); +INSERT INTO memos VALUES(6, "title 2", "content b"); +INSERT INTO memos VALUES(1, "title 2", "content b"); +INSERT INTO memos VALUES(11, "title 1-a", "content a-1"); +INSERT INTO memos VALUES(3, "title 2-b", "content a-2"); +INSERT INTO memos VALUES(2, "title 2-c", "content a-3"); +INSERT INTO memos VALUES(8, "title 1-a", "content b-1"); +INSERT INTO memos VALUES(9, "title 2-b", "content b-2"); +INSERT INTO memos VALUES(7, "title 2-c", "content b-3"); + +SELECT * FROM memos + WHERE MATCH(title) AGAINST("+1" IN BOOLEAN MODE) AND + MATCH(content) AGAINST("+a" IN BOOLEAN MODE) + ORDER BY id + LIMIT 1,3; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test index b1246ddfbdc..eb9e7ef55bc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test new file mode 100644 index 00000000000..c14ee787f1a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test @@ -0,0 +1,46 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES CP932; +CREATE TABLE memos ( + ޝ•ÊŽq INT UNSIGNED, + “à—e TEXT, + FULLTEXT INDEX(“à—e), + KEY(ޝ•ÊŽq) +) DEFAULT CHARSET CP932; + +INSERT INTO memos VALUES(2, "–¾“ú‚ÍŽR“o‚èB"); +INSERT INTO memos VALUES(3, "¡“ú‚̓Tƒ{ƒeƒ“‚ð‚à‚ç‚Á‚½B"); +INSERT INTO memos VALUES(1, "¡“ú‚Í“V‹C‚ª‚æ‚­‚Ă悩‚Á‚½B"); + +SELECT * FROM memos + WHERE MATCH(“à—e) AGAINST("¡“ú" IN BOOLEAN MODE) + ORDER BY ޝ•ÊŽq + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test index 41d5facf644..04cd30ab337 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test index f6440777ab5..cdc7b433532 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test index 5b57d2980c6..c7a5244042c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test index 4f878af84cc..0f87b70186c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test index e8735fda41c..922e72e2bbb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test index 4a748bc130b..78f8f19a14d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test index 80fe51e1e80..2b12fa6ccc1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(date) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test index b36a13f3727..1908ce34d8a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test new file mode 100644 index 00000000000..834a39fe75c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test @@ -0,0 +1,49 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES utf8; +CREATE TABLE memos ( + id int PRIMARY KEY, + tag ENUM('Groonga', 'Mroonga'), + content TEXT, + FULLTEXT INDEX(content), + KEY(tag), + KEY(id) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND + tag = 'Mroonga' + ORDER BY id LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test new file mode 100644 index 00000000000..703d79dc8e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test @@ -0,0 +1,49 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES utf8; +CREATE TABLE memos ( + id int PRIMARY KEY, + tag ENUM('Groonga', 'Mroonga'), + content TEXT, + FULLTEXT INDEX(content), + KEY(tag), + KEY(id) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND + tag = 2 + ORDER BY id LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test index bcc678360e2..9c44110bfd5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -33,7 +33,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test index e0a2df2e587..32345f66139 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test index c8f698cdbcc..508f85f3a73 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test index ee510ab7527..a2024e8dda5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test index 76f2de8146b..4924cb374e9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test index caca6b56b89..b81247ed2f9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test index 1c26bef936f..d32d9f1128c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test index 4df32d8a590..9289bee3068 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test index 07907f1dfb7..23adb84f91c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -33,7 +33,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test index 0e0b3f8e1ea..1031427f9ce 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test index 213605adca1..78b42e5d8d7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test index 58505edf7a7..f09a2a0e3b4 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test index 92178a45158..9a758560913 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -35,7 +35,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test index 4ec5a8b1596..e49a79a7db2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test index eaedbbdc7dc..b563028c81d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test index 72d2890a123..c11603c94f8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test index eeb2e36ae29..71f93c6ee1b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test index 666887d3347..883f676e45e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test index feeae64b8d1..a8af0bbb781 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test index 4744add7881..a0795f8eba6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test index cb407d35450..4087207c2a8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test index b9327e4251d..e423a4b937b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ CREATE TABLE memos ( FULLTEXT INDEX(content), KEY(writing_time) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE memos; INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test index 7c460d1086a..60565dd7bab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -35,7 +35,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test index ffebd0a4bad..dcde9373317 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -34,7 +34,6 @@ CREATE TABLE diaries ( KEY(month), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test index c4e86ac1039..4e7c117d654 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test index 57b512ed88d..d6e7b345c05 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test index 729d8b03770..bac10448269 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test index 6bd955cc956..9ffae4a6528 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test index 3e40e885859..09015f9c2c3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test index 44fb928774f..35adc29839f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test index f7d0865f303..831ef4c3e6a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test index 25270f14def..4e59a2ca3ab 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test @@ -12,9 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/skip_mariadb_100_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source include/have_partition.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test index d601b4d4fe9..eaf3304dac5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test @@ -12,9 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/skip_mariadb_100_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source include/have_partition.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test index 65989b60e8a..22fade591b6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test @@ -12,9 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.inc --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_mroonga_helper.inc @@ -27,7 +28,6 @@ CREATE TABLE diaries ( body TEXT, FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start Groonga!"); INSERT INTO diaries (title, body) VALUES ("Groonga (1)", "starting Groonga..."); @@ -35,11 +35,11 @@ INSERT INTO diaries (title, body) VALUES ("Groonga (2)", "started Groonga."); SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE); ---remove_file $MYSQLD_DATADIR/repair_test.mrn.000010A.c +--remove_file $MYSQLD_DATADIR/repair_test.mrn.000010E.c FLUSH TABLES; -# Error ER_CANT_OPEN_FILE syscall error 'repair_test.mrn.000010A.c' (No such file or directory) +# Error ER_CANT_OPEN_FILE system call error: No such file or directory: failed to open path: --error ER_CANT_OPEN_FILE SELECT * FROM diaries WHERE MATCH(body) AGAINST("+starting" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test index 81dcbe318b3..e9ba60c2c28 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test @@ -12,10 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test index 0f8e90c0c03..3ff23185741 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Based on #910. diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test index bb134cd04e4..4aba5eda256 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ create table diaries ( content text, fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test index 231e8b09762..da3faa03053 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ create table diaries ( content varchar(256), fulltext index (content) ) default charset utf8; -show create table diaries; insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test index 2e06bf7e5f8..22cbf13889b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test index fb8a6750fb9..db5b90ab0b1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test index c3973cb9164..b607c314a84 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test index c624f8e0c36..52630fec0f0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test index 59c358cc1b8..75d00e7a737 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test index 4424cf283da..ad71ac7119b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test @@ -1,4 +1,4 @@ -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -31,7 +31,7 @@ INSERT INTO users VALUES ("Alice", 20); INSERT INTO users VALUES ("Bob", 20); INSERT INTO users VALUES ("Charry", 29); -SELECT *, COUNT(*) FROM users GROUP BY age; +SELECT age, COUNT(*) FROM users GROUP BY age; DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test index 46c0e5aa70e..710bea0dd5a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test @@ -1,4 +1,4 @@ -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -30,9 +30,7 @@ INSERT INTO users VALUES ("Alice", 20); INSERT INTO users VALUES ("Bob", 20); INSERT INTO users VALUES ("Charry", 29); -EXPLAIN SELECT *, COUNT(*) FROM users GROUP BY age; - -SELECT *, COUNT(*) FROM users GROUP BY age; +SELECT age, COUNT(*) FROM users GROUP BY age; DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test index a0afe1198ef..0bce1387b3f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test index 231e7c27037..32bb5758a10 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test index 3f00049092c..95007d8032f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test index c2df2522b9c..a7460343c26 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -31,7 +31,6 @@ CREATE TABLE diaries ( title TEXT, FULLTEXT INDEX (title) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO users (name) VALUES ("alice"); INSERT INTO users (name) VALUES ("bob"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test index e71a2322bb2..ef26b467dbc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/skip_osx.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ CREATE TEMPORARY TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title) VALUES ("clear day"); INSERT INTO diaries (title) VALUES ("rainy day"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test index 7e5bc2d010c..840ff375489 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -31,7 +31,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test new file mode 100644 index 00000000000..c90a8cbf1cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test @@ -0,0 +1,38 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET SESSION binlog_format = 'ROW'; + +CREATE TABLE memos ( + title varchar(20) PRIMARY KEY, + content varchar(140) NOT NULL +) COLLATE=utf8mb4_general_ci + DEFAULT CHARSET=utf8mb4; + +INSERT INTO memos (title, content) VALUES ('Mroonga', 'Mroonga is great!'); +SELECT * FROM memos; +UPDATE memos SET content = 'Mroonga is very great!' WHERE title = 'Mroonga'; +SELECT * FROM memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test index 33ccec42989..dbcfd665464 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test index 5b5a47ad447..526d6f18c20 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test index f1c91bfd8d3..0f9ecdbf337 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test index 7f40ba09b2e..eb4af2c117e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test index 65f0ce3b253..872f1673569 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test index a50bfd6929e..e0cb953d51d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test @@ -12,32 +12,38 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings -drop table if exists t1, t2, t3; +DROP TABLE IF EXISTS t1; --enable_warnings # for virtual columns -create table t1 (c1 int, _id int); -insert into t1 values(1,null); -insert into t1 values(2,null); -insert into t1 values(3,null); -select * from t1; -set sql_mode=""; +CREATE TABLE t1 (c1 int, _id int); +INSERT INTO t1 VALUES(1,null); +INSERT INTO t1 VALUES(2,null); +INSERT INTO t1 VALUES(3,null); +SELECT * FROM t1; +--disable_warnings +SET sql_mode=""; +--enable_warnings # warning WARN_DATA_TRUNCATED -update t1 set _id = 10 where c1 = 1; -select * from t1; -set sql_mode="strict_all_tables"; +UPDATE t1 SET _id = 10 WHERE c1 = 1; +SELECT * FROM t1; +--disable_warnings +SET sql_mode="STRICT_ALL_TABLES"; +--enable_warnings # We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported # MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. # We share this test with all MySQL servers. So we use number here. --error 1265 -update t1 set _id = 11 where c1 = 1; -select * from t1; -drop table t1; +UPDATE t1 SET _id = 11 WHERE c1 = 1; +SELECT * FROM t1; +DROP TABLE t1; + +SET sql_mode=DEFAULT; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test index 2cba585bc2a..83dc25e4989 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released. --source ../../include/mroonga/have_mysql.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test index bdd4f915bbf..21879480c7d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released. --source ../../include/mroonga/have_mysql.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test index c7f54925382..77c4c1db2b1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released. --source ../../include/mroonga/have_mysql.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test index b3265d9645b..b312b31ad39 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released. --source ../../include/mroonga/have_mysql.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test index 61613ef2906..6509eeee2bf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: Remove the check after MariaDB 5.5.42 and MariaDB 10.0.17 are released. --source ../../include/mroonga/have_mysql.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test index ad934696171..b7a4b80b6f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test index e71dcfe0dda..83138aee0ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test index 4cfbe489b90..41aac1a146f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test new file mode 100644 index 00000000000..4c518b28e9f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_default_tokenizer_backup = @@mroonga_default_tokenizer; +SET GLOBAL mroonga_default_tokenizer = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +SET GLOBAL mroonga_default_tokenizer = @mroonga_default_tokenizer_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test new file mode 100644 index 00000000000..ebd08460b3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_default_tokenizer = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test index de97096e5a4..767ce3f9286 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (body) values ("will start groonga!"); select * from diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test index b52385793d2..4ad242dd59d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (body) values ("will start groonga!"); select * from diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test index 47c24421586..66f82a5c052 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -25,7 +25,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8; -show create table diaries; insert into diaries (body) values ("will start groonga!"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test new file mode 100644 index 00000000000..ad2b8167d81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test @@ -0,0 +1,50 @@ +# Copyright(C) 2017 Naoya Murakami +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command('truncate mroonga_operations'); +INSERT INTO diaries VALUES("Unlogged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +SELECT mroonga_command('select mroonga_operations --output_columns _id'); + +SET GLOBAL mroonga_enable_operations_recording = false; +FLUSH TABLES; + +SELECT mroonga_command('truncate mroonga_operations'); +INSERT INTO diaries VALUES("Logged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +SELECT mroonga_command('select mroonga_operations --output_columns _id'); + +DROP TABLE diaries; +SELECT mroonga_command('truncate mroonga_operations'); + +SET GLOBAL mroonga_enable_operations_recording = default; +FLUSH TABLES; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test index 3e2c5bfe7bf..a3720f2ef5b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,17 +12,17 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_100_or_later.inc +--source ../../include/mroonga/have_version_10_0_or_later.inc --source ../../include/mroonga/have_mroonga.inc SET GLOBAL mroonga_lock_timeout = -1; SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; -disable_query_log; -SET GLOBAL mroonga_lock_timeout = 10000000; -enable_query_log; +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test index 7358389bb5d..54c834d7e4c 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,17 +12,17 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ---source ../../include/mroonga/have_version_100_or_later.inc +--source ../../include/mroonga/have_version_10_0_or_later.inc --source ../../include/mroonga/have_mroonga.inc SET GLOBAL mroonga_lock_timeout = -2; SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; -disable_query_log; -SET GLOBAL mroonga_lock_timeout = 10000000; -enable_query_log; +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test index c25d1747b1d..60e468bf0a6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,8 +20,8 @@ SET GLOBAL mroonga_lock_timeout = 0; SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; -disable_query_log; -SET GLOBAL mroonga_lock_timeout = 10000000; -enable_query_log; +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test index 523baa1b3e9..4b490b8a74d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test @@ -1,4 +1,4 @@ -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,8 +20,8 @@ SET GLOBAL mroonga_lock_timeout = 1000; SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; -disable_query_log; -SET GLOBAL mroonga_lock_timeout = 10000000; -enable_query_log; +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test index c96b021be76..07a4afbe76e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test index d05cbd2349a..13c544b95a5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test index ead099e0cc1..e2cda37b79b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test index 1f73f4f447f..2cf196f49ca 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test index 8585c1c2f11..fda1f8768f6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test @@ -1,4 +1,4 @@ -# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -20,7 +20,7 @@ DROP TABLE IF EXISTS diaries; --enable_warnings -# MySQL <= 5.5 reports wrong a warning. :< +# MySQL <= 5.5 reports a wrong warning. :< # It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. --disable_warnings SET GLOBAL mroonga_match_escalation_threshold = -1; @@ -30,24 +30,31 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, - FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); -INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello Groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello Mroonga!", "mroonga install"); +disable_query_log; +CONNECT (new_connection, localhost, root, ,); +CONNECTION new_connection; +enable_query_log; -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+install" IN BOOLEAN MODE); -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); SET GLOBAL mroonga_match_escalation_threshold = 0; -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); SET mroonga_match_escalation_threshold = 0; -SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); +disable_query_log; +CONNECTION default; +DISCONNECT new_connection; +enable_query_log; DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test index 8743c3faadb..0a7d192f76f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -24,9 +24,8 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, - FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test index 043d8d3340b..9ce8cf8bae7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test @@ -1,4 +1,4 @@ -# Copyright(C) 2015 Kouhei Sutou +# Copyright(C) 2015-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -38,13 +39,17 @@ INSERT INTO ids VALUES (10); SET GLOBAL mroonga_max_n_records_for_estimate = 1; +disable_query_log; CONNECT (new_connection, localhost, root, ,); CONNECTION new_connection; +enable_query_log; EXPLAIN SELECT * FROM ids WHERE id > 5; +disable_query_log; CONNECTION default; DISCONNECT new_connection; +enable_query_log; SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test new file mode 100644 index 00000000000..757a7f9590d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test @@ -0,0 +1,60 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +INSERT INTO ids VALUES (4); +INSERT INTO ids VALUES (5); +INSERT INTO ids VALUES (6); +INSERT INTO ids VALUES (7); +INSERT INTO ids VALUES (8); +INSERT INTO ids VALUES (9); +INSERT INTO ids VALUES (10); + + +SET GLOBAL mroonga_max_n_records_for_estimate = 1; + +disable_query_log; +CONNECT (new_connection, localhost, root, ,); +CONNECTION new_connection; +enable_query_log; + +EXPLAIN SELECT * FROM ids WHERE id > 5; + +disable_query_log; +CONNECTION default; +DISCONNECT new_connection; +enable_query_log; + +SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT; + + +DROP TABLE ids; + + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test new file mode 100644 index 00000000000..df9f498632e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + INDEX (id) +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +DELETE FROM ids WHERE id < 2; + +SET mroonga_max_n_records_for_estimate = 1; + +EXPLAIN SELECT * FROM ids WHERE id > 0; + +SET mroonga_max_n_records_for_estimate = DEFAULT; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test new file mode 100644 index 00000000000..19b4b2836b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test @@ -0,0 +1,47 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +INSERT INTO ids VALUES (4); +INSERT INTO ids VALUES (5); +INSERT INTO ids VALUES (6); +INSERT INTO ids VALUES (7); +INSERT INTO ids VALUES (8); +INSERT INTO ids VALUES (9); +INSERT INTO ids VALUES (10); + +SET mroonga_max_n_records_for_estimate = 1; + +EXPLAIN SELECT * FROM ids WHERE id > 5; + +SET mroonga_max_n_records_for_estimate = DEFAULT; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test new file mode 100644 index 00000000000..0b9357e06c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + INDEX (id) +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +DELETE FROM ids WHERE id < 2; + +SET mroonga_max_n_records_for_estimate = 1; + +EXPLAIN SELECT * FROM ids WHERE id > 0; + +SET mroonga_max_n_records_for_estimate = DEFAULT; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test index 894e14f4802..5e31c8b0d63 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test @@ -1,4 +1,4 @@ -# Copyright(C) 2015 Kouhei Sutou +# Copyright(C) 2015-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test new file mode 100644 index 00000000000..fdd21cc0f4d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = ""; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test new file mode 100644 index 00000000000..b84fc3978ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = NULL; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test new file mode 100644 index 00000000000..0cb1a8d243a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = ""; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test new file mode 100644 index 00000000000..d1704a43d3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = NULL; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test new file mode 100644 index 00000000000..e298aaa43b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# Copyright(C) 2017 Kentaro Hayashi +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test new file mode 100644 index 00000000000..4c500f1e674 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test @@ -0,0 +1,34 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# Copyright(C) 2017 Kentaro Hayashi +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test index d2ae3fd8718..f1fe11864d9 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/not_embedded.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test index 6c21f8d50d7..2bd4496a2de 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result index c47a5ccc354..2be9834c617 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result @@ -3,13 +3,6 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; id title @@ -26,12 +19,4 @@ id title body 1 survey will start groonga! 2 groonga (1) starting groonga... 3 groonga (2) started groonga. -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result new file mode 100644 index 00000000000..9628df686b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +ALTER TABLE users +ADD COLUMN –¼‘O text, +ADD FULLTEXT INDEX (–¼‘O); +INSERT INTO users (–¼‘O) VALUES ("‚â‚Ü‚¾"); +INSERT INTO users (–¼‘O) VALUES ("‚½‚È‚©"); +INSERT INTO users (–¼‘O) VALUES ("‚·‚¸‚«"); +SELECT * FROM users; +id –¼‘O +1 ‚â‚Ü‚¾ +2 ‚½‚È‚© +3 ‚·‚¸‚« +SELECT * FROM users +WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +id –¼‘O +2 ‚½‚È‚© +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result new file mode 100644 index 00000000000..abd2271f051 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +ALTER TABLE users +ADD COLUMN åå‰ text, +ADD FULLTEXT INDEX (åå‰); +INSERT INTO users (åå‰) VALUES ("ã‚„ã¾ã "); +INSERT INTO users (åå‰) VALUES ("ãŸãªã‹"); +INSERT INTO users (åå‰) VALUES ("ã™ãšã"); +SELECT * FROM users; +id åå‰ +1 ã‚„ã¾ã  +2 ãŸãªã‹ +3 ã™ãšã +SELECT * FROM users +WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +id åå‰ +2 ãŸãªã‹ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result index 3e270abe16d..7197d3a9dc0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result @@ -6,16 +6,11 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) ENGINE MyISAM DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT table_name, engine, table_comment +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine table_comment +diaries MyISAM INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); SELECT * FROM diaries @@ -24,16 +19,11 @@ MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); id title body 1 survey will start groonga! ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +SELECT table_name, engine, table_comment +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine table_comment +diaries Mroonga ENGINE "InnoDB" SELECT * FROM diaries WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result index 9d225f46f25..05bd0e4e1e0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result @@ -6,28 +6,15 @@ title VARCHAR(64), content TEXT, FULLTEXT INDEX(content) ) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` varchar(64) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); ALTER TABLE memos COMMENT='engine "MyISAM"'; -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` varchar(64) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='engine "MyISAM"' +SELECT table_name, table_comment +FROM information_schema.tables +WHERE table_name = 'memos'; +table_name table_comment +memos engine "MyISAM" SELECT * FROM memos; id title content 1 Hello I start to write memos! diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result index c9fef8e4d8f..25cb53ded0b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result @@ -4,26 +4,11 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, body TEXT ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; id title body 1 survey will start groonga! ALTER TABLE diaries DROP COLUMN body; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' SELECT * FROM diaries; id title 1 survey diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result index 5bf1bbf2124..37f03b40616 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result @@ -4,14 +4,6 @@ id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, FULLTEXT INDEX title_index (title) ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; id title @@ -39,14 +31,4 @@ WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); id title body 2 groonga (1) starting groonga... -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result index 8d161b424d1..bfbe96d14d7 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result @@ -6,16 +6,6 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; id title body @@ -32,14 +22,4 @@ SELECT * FROM memos WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); id title body -SHOW CREATE TABLE memos; -Table Create Table -memos CREATE TABLE `memos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result index abb7769224c..fa42d4a1fd3 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result @@ -119,13 +119,4 @@ id name location_text 14 tetsuji POINT(139.76857 35.680912) 19 daruma POINT(139.770599 35.681461) 26 kazuya POINT(139.760895 35.673508) -SHOW CREATE TABLE shops; -Table Create Table -shops CREATE TABLE `shops` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - `location` geometry NOT NULL, - PRIMARY KEY (`id`), - SPATIAL KEY `location_index` (`location`) -) ENGINE=Mroonga AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 COMMENT='ENGINE "InnoDB"' DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result new file mode 100644 index 00000000000..61122f7842f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id int NOT NULL PRIMARY KEY, +content text, +FULLTEXT INDEX (content) +) COMMENT='engine "InnoDB"'; +INSERT INTO memos VALUES (1, 'Hello MySQL'); +INSERT INTO memos VALUES (2, 'Hello Mroonga'); +CHECK TABLE memos FOR UPGRADE; +Table Op Msg_type Msg_text +test.memos check status OK +FLUSH TABLES; +SELECT * FROM memos +WHERE MATCH(content) AGAINST('+mroonga' IN BOOLEAN MODE); +id content +2 Hello Mroonga +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result new file mode 100644 index 00000000000..5b379d08e3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result new file mode 100644 index 00000000000..24c9275b5e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result new file mode 100644 index 00000000000..65a55204a32 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result new file mode 100644 index 00000000000..febfd34345b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result new file mode 100644 index 00000000000..c0d9452f15e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result new file mode 100644 index 00000000000..ae9c244d880 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "shutdown"} "shutdown" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result new file mode 100644 index 00000000000..6daeb5e2f31 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result new file mode 100644 index 00000000000..82a46e3fcfc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) +VALUES (1, '{"level": "info", "message": "start server"}'); +ALTER TABLE logs ADD FULLTEXT INDEX (message); +INSERT INTO logs(id, record) +VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) +VALUES (3, '{"level": "warn", "message": "abort server"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST('+start' IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "start server"} "start server" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result new file mode 100644 index 00000000000..09cd18915f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +level VARCHAR(255) GENERATED ALWAYS AS +(json_unquote(json_extract(`record`, '$.level'))) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) +VALUES (1, '{"level": "info", "message": "start server"}'); +ALTER TABLE logs ADD INDEX (level); +INSERT INTO logs(id, record) +VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) +VALUES (3, '{"level": "warn", "message": "abort server"}'); +SELECT * FROM logs WHERE level = 'info'; +id record level +1 {"level": "info", "message": "start server"} info +2 {"level": "info", "message": "start server"} info +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result new file mode 100644 index 00000000000..8c1ceaf13dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs; +id record message +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result new file mode 100644 index 00000000000..7d3226175ea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result new file mode 100644 index 00000000000..5a0e63ed7c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result new file mode 100644 index 00000000000..2411f7a725c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "shutdown"} "shutdown" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result new file mode 100644 index 00000000000..38185f5ec97 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT, +–¼‘O text, +FULLTEXT INDEX (–¼‘O) +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +INSERT INTO users (–¼‘O) VALUES ("‚â‚Ü‚¾"); +INSERT INTO users (–¼‘O) VALUES ("‚½‚È‚©"); +INSERT INTO users (–¼‘O) VALUES ("‚·‚¸‚«"); +SELECT * FROM users; +id –¼‘O +1 ‚â‚Ü‚¾ +2 ‚½‚È‚© +3 ‚·‚¸‚« +SELECT * FROM users +WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +id –¼‘O +2 ‚½‚È‚© +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result new file mode 100644 index 00000000000..2d31307392f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT, +åå‰ text, +FULLTEXT INDEX (åå‰) +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +INSERT INTO users (åå‰) VALUES ("ã‚„ã¾ã "); +INSERT INTO users (åå‰) VALUES ("ãŸãªã‹"); +INSERT INTO users (åå‰) VALUES ("ã™ãšã"); +SELECT * FROM users; +id åå‰ +1 ã‚„ã¾ã  +2 ãŸãªã‹ +3 ã™ãšã +SELECT * FROM users +WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +id åå‰ +2 ãŸãªã‹ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result new file mode 100644 index 00000000000..7822d118733 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +SELECT COUNT(*) FROM ids; +COUNT(*) +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result new file mode 100644 index 00000000000..141117f608a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result @@ -0,0 +1,30 @@ +CREATE TABLE diaries_innodb ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; +CREATE TABLE diaries_mroonga ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_innodb NULL index NULL flag 2 NULL 3 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`diaries_innodb` +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_mroonga NULL index NULL flag 2 NULL 3 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`diaries_mroonga` +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result index a6d2f7862af..1ebd0ba870e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result @@ -18,9 +18,9 @@ INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); EXPLAIN SELECT COUNT(*) FROM diaries_innodb; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE diaries_innodb index NULL flag 2 NULL 3 Using index +1 SIMPLE diaries_innodb index NULL flag 2 NULL # Using index EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE diaries_mroonga index NULL flag 2 NULL 3 Using index +1 SIMPLE diaries_mroonga index NULL flag 2 NULL # Using index DROP TABLE diaries_innodb; DROP TABLE diaries_mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result index 49e5e0a1466..b3814331038 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result @@ -63,7 +63,7 @@ drop table t1; create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; desc t1; Field Type Null Key Default Extra -c1 timestamp NO PRI current_timestamp() on update current_timestamp() +c1 timestamp NO PRI CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP drop table t1; create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; desc t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result index ce1b5470231..3610ab6f556 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result @@ -3,10 +3,12 @@ CREATE TABLE bugs ( id INT UNSIGNED PRIMARY KEY ) DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"'; -SHOW CREATE TABLE bugs; -Table Create Table -bugs CREATE TABLE `bugs` ( - `id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"' +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create bugs TABLE_HASH_KEY ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result index fb03bfe8d8d..6ff4c105384 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'flags "WITH_POSITION|WITH_WEIGHT"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result index 4a7107146ce..9048b677a2f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'flags "NONE"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX memos +column_create memos#content index COLUMN_INDEX memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result index 6e00526c736..1c701d0eb8f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result @@ -12,5 +12,5 @@ memos CREATE TABLE `memos` ( ) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result index 08bdd72ee03..e378ba3b7ba 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'index_flags "NONE"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX memos +column_create memos#content index COLUMN_INDEX memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result index a5ac716d38e..1367a3adbb9 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result @@ -5,5 +5,5 @@ FULLTEXT INDEX (content) COMMENT 'index_flags "WITH_POSITION|WITH_WEIGHT"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; SELECT mroonga_command("dump --dump_plugins no --dump_schema no"); mroonga_command("dump --dump_plugins no --dump_schema no") -column_create memos-content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos +column_create memos#content index COLUMN_INDEX|WITH_WEIGHT|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result new file mode 100644 index 00000000000..5230963af79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` text COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) COMMENT 'normalizer "NormalizerAuto"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ENGINE "InnoDB"' +INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ"); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); +id content +1 1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔㌠+DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result index d382e937cea..4d9d20dc8ab 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result @@ -5,15 +5,11 @@ body text, fulltext index body_index (body) comment 'parser "TokenBigramSplitSymbolAlphaDigit"' ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead insert into diaries (body) values ("will start Groonga!"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); select * from diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result index e1e32dccc37..7f4885fb0da 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result @@ -11,7 +11,12 @@ SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") table_create memos TABLE_HASH_KEY ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result index 11ee04e2998..2d7c67489e6 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result @@ -11,7 +11,12 @@ SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") table_create memos TABLE_HASH_KEY ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result index f6d6be1b643..4626d1443f8 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result @@ -19,7 +19,12 @@ SELECT mroonga_command("dump --dump_plugins no"); mroonga_command("dump --dump_plugins no") table_create memos TABLE_HASH_KEY ShortText -table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +table_create memos#content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord -column_create memos-content index COLUMN_INDEX|WITH_POSITION memos +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result index 45cdffb8cd3..34e3f88dbad 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result @@ -5,14 +5,6 @@ body text, fulltext index body_index (body) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result index 318be3f364a..219d8e08deb 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result @@ -4,14 +4,6 @@ id int PRIMARY KEY AUTO_INCREMENT, body text, FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) `TOKENIZER`='TokenBigramSplitSymbolAlphaDigit' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); INSERT INTO diaries (body) VALUES ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result new file mode 100644 index 00000000000..f7d5b439b69 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result @@ -0,0 +1,13 @@ +CREATE TABLE logs ( +id INT PRIMARY KEY AUTO_INCREMENT, +message TEXT, +FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +USE test; +DROP TABLE logs; +CREATE TABLE logs ( +id INT PRIMARY KEY AUTO_INCREMENT, +message TEXT, +FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result index de8e47dcd82..8614eaa73f8 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result @@ -6,15 +6,6 @@ title VARCHAR(255), content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result index 0659c7c59df..1ecf18cb131 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result @@ -7,16 +7,6 @@ content TEXT, FULLTEXT INDEX (title), FULLTEXT INDEX (content) ) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries VALUES(1, "富士山", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気 1月1日", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, "天気 4月4日", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result index 13b2bcb4ff1..d3bdfca0def 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result @@ -6,15 +6,6 @@ title varchar(255), content text, FULLTEXT INDEX (title) ) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries VALUES (1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES (2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES (3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result index 7391ee4ba8d..c25b47c6bde 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result @@ -6,7 +6,11 @@ insert into t1 values (2, "ka ki ku ke ko"); insert into t1 values (3, "aa ii ii ii oo"); insert into t1 values (4, "sa si su se so"); insert into t1 values (5, "ta ti ii ii to"); -insert into t2 (c1,c2) select c1,c2 from t1; +insert into t2 values (1, "aa ii uu ee oo"); +insert into t2 values (2, "ka ki ku ke ko"); +insert into t2 values (3, "aa ii ii ii oo"); +insert into t2 values (4, "sa si su se so"); +insert into t2 values (5, "ta ti ii ii to"); select * from t1; c1 c2 1 aa ii uu ee oo diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result index 11d40fc0589..f4719cbdd95 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result @@ -1,13 +1,5 @@ drop table if exists t1, t2, t3; create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` text DEFAULT NULL, - PRIMARY KEY (`c1`), - FULLTEXT KEY `ft` (`c2`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result index 03cf96b55f8..9d1e838b893 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result @@ -5,14 +5,6 @@ id int primary key, title varchar(255), fulltext index (title) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' set autocommit=0; insert into diaries values(0, "2011-07-14"); insert into diaries values(1, "2011-07-15"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result index 81ce556e745..39ab80edf3b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result @@ -10,15 +10,18 @@ FULLTEXT KEY (not_matched) INSERT INTO texts VALUES (1, 'Hello1', 'World1'); INSERT INTO texts VALUES (2, 'Hello2', 'World2'); INSERT INTO texts VALUES (3, 'Hello3', 'World3'); -SELECT id, +SELECT * +FROM (SELECT id, matched, not_matched, MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) FROM texts -WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE); +WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)) +AS searched_texts +ORDER BY id; id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) 1 Hello1 World1 1 0 -3 Hello3 World3 1 0 2 Hello2 World2 1 0 +3 Hello3 World3 1 0 DROP TABLE texts; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result index 3c014b1b2b3..fbdf241b81e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result index 3b65bc1a2ba..074d1991505 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result index cc0fb391628..756a702171a 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result index 863b95a3059..db869eaa697 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result @@ -8,17 +8,6 @@ fulltext index (title, content), fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title` (`title`,`content`), - FULLTEXT KEY `title_2` (`title`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result index 9ccffb28be1..7121e5109d3 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result @@ -6,16 +6,6 @@ body text, fulltext index title_index (title), fulltext index body_index (body) ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries (title, body) values ("survey", "will start groonga!"); insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); insert into diaries (title, body) values ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result index ab3c321959e..90376bdf156 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result @@ -1,13 +1,5 @@ drop table if exists t1, t2, t3; create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` text DEFAULT NULL, - PRIMARY KEY (`c1`), - FULLTEXT KEY `ft` (`c2`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "myisam"' insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result index ceff90c477c..f79798cec6d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result @@ -1,23 +1,13 @@ DROP TABLE IF EXISTS diaries; SET NAMES UTF8; CREATE TABLE ft( -a INT, +a INT DEFAULT 0, b TEXT, c TEXT, PRIMARY KEY(a), FULLTEXT KEY ftx1(b), FULLTEXT KEY ftx2(c) )ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; -SHOW CREATE TABLE ft; -Table Create Table -ft CREATE TABLE `ft` ( - `a` int(11) NOT NULL, - `b` text DEFAULT NULL, - `c` text DEFAULT NULL, - PRIMARY KEY (`a`), - FULLTEXT KEY `ftx1` (`b`), - FULLTEXT KEY `ftx2` (`c`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' INSERT INTO ft VALUES(1,'aaaaa','abcde'); INSERT INTO ft VALUES(2,'bbbbb','bcdef'); INSERT INTO ft VALUES(3,'ccccc','cdefg'); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result index 1d8284e2370..3ee15c63bfd 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result @@ -6,16 +6,6 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' START TRANSACTION; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); @@ -27,15 +17,12 @@ id title body 1 survey will start groonga! 2 groonga (1) starting groonga... 3 groonga (2) started groonga. -CONNECT search_connection, localhost, root; USE test; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; id title body -connection default; COMMIT; -connection search_connection; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; @@ -43,8 +30,6 @@ id title body 1 survey will start groonga! 2 groonga (1) starting groonga... 3 groonga (2) started groonga. -disconnect search_connection; -connection default; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result index 7f32fed3810..550554eac8c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result @@ -5,15 +5,6 @@ name text, location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; -Table Create Table -shops CREATE TABLE `shops` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - `location` geometry NOT NULL, - PRIMARY KEY (`id`), - SPATIAL KEY `location_index` (`location`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' insert into shops (name, location) values ('nezu-no-taiyaki', ST_GeomFromText('POINT(139.762573 35.720253)')); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result index 92c70d223e9..615d185f79f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result @@ -5,15 +5,6 @@ name text, location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; -Table Create Table -shops CREATE TABLE `shops` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - `location` geometry NOT NULL, - PRIMARY KEY (`id`), - SPATIAL KEY `location_index` (`location`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' insert into shops (name, location) values ('sazare', ST_GeomFromText('POINT(139.685043 35.714653)')); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result index 3594339c685..adfb53e10a2 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result @@ -5,15 +5,6 @@ name text, location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; -Table Create Table -shops CREATE TABLE `shops` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` text DEFAULT NULL, - `location` geometry NOT NULL, - PRIMARY KEY (`id`), - SPATIAL KEY `location_index` (`location`) -) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' insert into shops (name, location) values ('sazare', ST_GeomFromText('POINT(139.685043 35.714653)')); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result index c249b4995a0..552cf58682b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result @@ -5,14 +5,6 @@ id int primary key, content text, fulltext index (content) ) default charset utf8 comment = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' LOCK TABLE diaries WRITE; insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result index ab3e86baec3..f0ceb937a01 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result @@ -8,7 +8,7 @@ PRIMARY KEY (date, title) SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `title` varchar(100) NOT NULL, `content` text NOT NULL, PRIMARY KEY (`date`,`title`) diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result index 0a9709a1d31..97428b768a6 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result @@ -10,7 +10,7 @@ SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `title` varchar(100) NOT NULL, `content` text NOT NULL, PRIMARY KEY (`id`), diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result new file mode 100644 index 00000000000..bf1e67b9378 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS integers; +SET optimizer_switch='mrr_cost_based=off'; +CREATE TABLE integers ( +id INT PRIMARY KEY AUTO_INCREMENT, +value INT, +KEY (value) +) COMMENT='engine "InnoDB"'; +INSERT INTO integers (value) VALUES (0), (1), (2), (3); +EXPLAIN SELECT * FROM integers +WHERE value IN (0, 2); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE integers NULL range value value 5 NULL 2 100.00 Using where; Using MRR +Warnings: +Note 1003 /* select#1 */ select `test`.`integers`.`id` AS `id`,`test`.`integers`.`value` AS `value` from `test`.`integers` where (`test`.`integers`.`value` in (0,2)) +SELECT * FROM integers +WHERE value IN (0, 2); +id value +1 0 +3 2 +DROP TABLE integers; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result index 1eeaec1efd8..8258a03bf42 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result @@ -6,15 +6,6 @@ title TEXT, body TEXT, FULLTEXT INDEX body_index (body) ) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result index 3813b320562..cca7aee95de 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result @@ -6,15 +6,6 @@ title TEXT, body TEXT, FULLTEXT INDEX body_index (body) ) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); @@ -23,7 +14,7 @@ id title body 2 groonga (1) starting groonga... FLUSH TABLES; SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); -ERROR HY000: syscall error 'repair_test.mrn.0000106' (No such file or directory) +ERROR HY000: system call error: No such file or directory: failed to open path: REPAIR TABLE diaries; Table Op Msg_type Msg_text repair_test.diaries repair status OK diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result index 4e2ebf121e2..d66b463d7ed 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result @@ -3,13 +3,6 @@ CREATE TEMPORARY TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TEMPORARY TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title) VALUES ("clear day"); INSERT INTO diaries (title) VALUES ("rainy day"); INSERT INTO diaries (title) VALUES ("cloudy day"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result index 61fbe239a35..54afac7a1a7 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result @@ -11,23 +11,18 @@ simple_table CREATE TABLE `simple_table` ( PRIMARY KEY (`id`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO simple_table (id) VALUES (1),(2); -CONNECT second_connection, localhost, root; USE test; START TRANSACTION; INSERT INTO simple_table (id) VALUES (3); -connection default; SELECT * FROM simple_table; id 1 2 -connection second_connection; COMMIT; -connection default; SELECT * FROM simple_table; id 1 2 3 DROP TABLE simple_table; -disconnect second_connection; SET GLOBAL query_cache_size = @tmp_query_cache_size; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result index 8ea9ffb0e67..9082032ff6e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result @@ -6,16 +6,6 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result index a06a57371be..0a424e77806 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result @@ -6,16 +6,6 @@ body TEXT, FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `title_index` (`title`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result index 0285bb7f62e..296f87ade66 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result @@ -10,19 +10,6 @@ content TEXT, FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `year` int(10) unsigned DEFAULT NULL, - `month` int(10) unsigned DEFAULT NULL, - `day` int(10) unsigned DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `content` text DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `day` (`day`), - FULLTEXT KEY `content` (`content`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result index 674a6666081..ccc28a0f4c7 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries (body) values ("will start groonga!"); insert into diaries (body) values ("starting groonga..."); insert into diaries (body) values ("started groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result index 46777cd877d..a9bdd38fa22 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries (body) values ("will start groonga!"); select * from diaries; id body diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result index e9be95ab90e..b2fe4607f8f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result @@ -4,14 +4,6 @@ id int primary key auto_increment, body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `body` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `body_index` (`body`) -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' insert into diaries (body) values ("will start groonga!"); set mroonga_dry_write=true; update diaries set body = "starting groonga..." where id = 1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result index c988a101095..9405879f4f5 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result @@ -3,28 +3,16 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, -FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `tags` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); id title tags 1 Hello groonga! groonga install SET GLOBAL mroonga_match_escalation_threshold = -1; -CONNECT search_connection, localhost, root; USE test; SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); id title tags -disconnect search_connection; -connection default; SET GLOBAL mroonga_match_escalation_threshold = DEFAULT; DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result index bedfb372e93..fa2da48cc71 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result @@ -3,17 +3,8 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, -FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; -Table Create Table -diaries CREATE TABLE `diaries` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text DEFAULT NULL, - `tags` text DEFAULT NULL, - PRIMARY KEY (`id`), - FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' -) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test index bb4d5389909..a6d25d3f438 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -26,7 +26,6 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; @@ -39,8 +38,6 @@ INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); SELECT * FROM diaries; -SHOW CREATE TABLE diaries; - DROP TABLE diaries; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test new file mode 100644 index 00000000000..49f65449a4d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +ALTER TABLE users + ADD COLUMN –¼‘O text, + ADD FULLTEXT INDEX (–¼‘O); + +INSERT INTO users (–¼‘O) VALUES ("‚â‚Ü‚¾"); +INSERT INTO users (–¼‘O) VALUES ("‚½‚È‚©"); +INSERT INTO users (–¼‘O) VALUES ("‚·‚¸‚«"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test new file mode 100644 index 00000000000..bd5c7389bed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +ALTER TABLE users + ADD COLUMN åå‰ text, + ADD FULLTEXT INDEX (åå‰); + +INSERT INTO users (åå‰) VALUES ("ã‚„ã¾ã "); +INSERT INTO users (åå‰) VALUES ("ãŸãªã‹"); +INSERT INTO users (åå‰) VALUES ("ã™ãšã"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test index a1d5c28baf1..dc98dc9c531 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test index e1b657b7ee8..d466b4466f1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -29,7 +29,9 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) ENGINE MyISAM DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; +SELECT table_name, engine, table_comment + FROM information_schema.tables + WHERE table_name = 'diaries'; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); @@ -38,7 +40,9 @@ SELECT * FROM diaries MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; +SELECT table_name, engine, table_comment + FROM information_schema.tables + WHERE table_name = 'diaries'; SELECT * FROM diaries WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test index 645d3dad7b3..ff2b6b47ef1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,14 +28,15 @@ CREATE TABLE memos ( content TEXT, FULLTEXT INDEX(content) ) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; -SHOW CREATE TABLE memos; INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); ALTER TABLE memos COMMENT='engine "MyISAM"'; -SHOW CREATE TABLE memos; +SELECT table_name, table_comment + FROM information_schema.tables + WHERE table_name = 'memos'; SELECT * FROM memos; SELECT * FROM memos WHERE MATCH(content) AGAINST("start" IN BOOLEAN MODE); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test index 68bf5c9bbe9..13344843ebe 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test index 0cd02e1812a..7bfd5fe5070 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test index 217df7a1edb..f05945e1b76 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test index ea3ef4f1484..f272698c1a8 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test index 107f4a9a755..e1de36d25d1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test index 3c63d4a1496..2c994bdcc76 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test index cc4b79ebf39..01fce22c3f0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -27,13 +27,11 @@ CREATE TABLE diaries ( title TEXT, body TEXT ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; ALTER TABLE diaries DROP COLUMN body; -SHOW CREATE TABLE diaries; SELECT * FROM diaries; INSERT INTO diaries (title) values ("groonga (1)"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test index e92a2e5c7f7..bc451c354b1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test index f5f7e307d5d..66ee293bff1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test index 587102c3db4..f364ba3d706 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test index 2f28eef1574..7b72b113c79 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test index aaff5f90b74..25cdc13ac35 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test index 62e56899aad..671b9617231 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( title TEXT, FULLTEXT INDEX title_index (title) ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title) VALUES ("survey"); SELECT * FROM diaries; @@ -50,8 +49,6 @@ SELECT * FROM diaries WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); -SHOW CREATE TABLE diaries; - DROP TABLE diaries; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test index c84e86594ca..288e5cdc0de 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc @@ -29,7 +29,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); SELECT * FROM diaries; @@ -43,8 +42,6 @@ SELECT * FROM memos WHERE MATCH(title) AGAINST("groonga") AND MATCH(body) AGAINST("starting"); -SHOW CREATE TABLE memos; - DROP TABLE memos; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test index 34c8bc02a1d..bcc043485a0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test @@ -12,12 +12,12 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -144,8 +144,6 @@ ALTER TABLE shops ADD SPATIAL KEY location_index (location); SELECT id, name, ST_AsText(location) AS location_text FROM shops WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location); -SHOW CREATE TABLE shops; - DROP TABLE shops; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test index b4ebd69a5e9..57af6f121cc 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test index 224bdfa07c6..1c120f36457 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_log_bin.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test new file mode 100644 index 00000000000..c6d4a924691 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id int NOT NULL PRIMARY KEY, + content text, + FULLTEXT INDEX (content) +) COMMENT='engine "InnoDB"'; + +INSERT INTO memos VALUES (1, 'Hello MySQL'); +INSERT INTO memos VALUES (2, 'Hello Mroonga'); + +CHECK TABLE memos FOR UPGRADE; + +FLUSH TABLES; + +SELECT * FROM memos + WHERE MATCH(content) AGAINST('+mroonga' IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test index 2adbae8afd8..de195a5b981 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test new file mode 100644 index 00000000000..e10ecfe9b56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test new file mode 100644 index 00000000000..784f419e24c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test new file mode 100644 index 00000000000..de2e40680df --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test new file mode 100644 index 00000000000..a8fcf191e08 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test new file mode 100644 index 00000000000..db4f0ed4460 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test new file mode 100644 index 00000000000..a59e5b6c4f1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test new file mode 100644 index 00000000000..502fb1502ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test new file mode 100644 index 00000000000..5103a91e909 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2017 Naoya Murakami +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) + VALUES (1, '{"level": "info", "message": "start server"}'); + +ALTER TABLE logs ADD FULLTEXT INDEX (message); + +INSERT INTO logs(id, record) + VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) + VALUES (3, '{"level": "warn", "message": "abort server"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST('+start' IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test new file mode 100644 index 00000000000..3b3b67c9747 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + level VARCHAR(255) GENERATED ALWAYS AS + (json_unquote(json_extract(`record`, '$.level'))) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) + VALUES (1, '{"level": "info", "message": "start server"}'); + +ALTER TABLE logs ADD INDEX (level); + +INSERT INTO logs(id, record) + VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) + VALUES (3, '{"level": "warn", "message": "abort server"}'); + +SELECT * FROM logs WHERE level = 'info'; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test new file mode 100644 index 00000000000..73848a3f2cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test new file mode 100644 index 00000000000..cd5a9cb404b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test new file mode 100644 index 00000000000..a5180a973d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test new file mode 100644 index 00000000000..c266ffe6ec5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test new file mode 100644 index 00000000000..cea67376fa6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT, + –¼‘O text, + FULLTEXT INDEX (–¼‘O) +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; + +INSERT INTO users (–¼‘O) VALUES ("‚â‚Ü‚¾"); +INSERT INTO users (–¼‘O) VALUES ("‚½‚È‚©"); +INSERT INTO users (–¼‘O) VALUES ("‚·‚¸‚«"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test new file mode 100644 index 00000000000..f1e0f39411f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT, + åå‰ text, + FULLTEXT INDEX (åå‰) +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; + +INSERT INTO users (åå‰) VALUES ("ã‚„ã¾ã "); +INSERT INTO users (åå‰) VALUES ("ãŸãªã‹"); +INSERT INTO users (åå‰) VALUES ("ã™ãšã"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test index 2e9674c860e..ba5786d05ab 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test new file mode 100644 index 00000000000..b557a96518a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test @@ -0,0 +1,36 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +SELECT COUNT(*) FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test new file mode 100644 index 00000000000..b329d9a5ff6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test @@ -0,0 +1,55 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE diaries_innodb ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; + +CREATE TABLE diaries_mroonga ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); + +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); + +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; + +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test index 6fd0ff1971c..0a3a5c81865 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test @@ -1,4 +1,4 @@ -# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2011-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -12,9 +12,10 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_query_log @@ -45,7 +46,9 @@ INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); +-- replace_column 9 # EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +-- replace_column 9 # EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; DROP TABLE diaries_innodb; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test index 4eab593cfe7..1c0d445013c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -65,6 +65,8 @@ create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; desc t1; drop table t1; create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP desc t1; drop table t1; create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test index f2d4cf80e3a..eaad5ed47cf 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,7 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"'; -SHOW CREATE TABLE bugs; +SELECT mroonga_command("dump --dump_plugins no"); DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test index aa6b1f01f10..6daa5acfd0f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test index d116aa6cd34..22d28e941fd 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test index 3c6bb52d143..c3b689580f6 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/have_innodb.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test index b433e54e885..06cb7658c21 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test index 47cededee55..84dc9d8526a 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test index 0d26c751c22..8846821cfc1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test new file mode 100644 index 00000000000..5454b176313 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test @@ -0,0 +1,40 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test index 141d15c3c45..287d594b7f5 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/have_innodb.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test index 151d15a9870..54d63fbe49c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test @@ -12,8 +12,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +--source include/not_embedded.inc --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +28,6 @@ create table diaries ( fulltext index body_index (body) comment 'parser "TokenBigramSplitSymbolAlphaDigit"' ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test index d5487a3b828..c79744993e9 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test index 0d863c9f99f..80bb5cf8701 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test index 0532c19dbde..99343ec60cf 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/have_innodb.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test index 0a55dd6ae69..e3e6d671ac6 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ create table diaries ( fulltext index body_index (body) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; insert into diaries (body) values ("will start Groonga!"); insert into diaries (body) values ("starting Groonga..."); insert into diaries (body) values ("started Groonga."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test index a2087ca8a9f..3eadb51a73a 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mariadb.inc --source include/have_innodb.inc @@ -27,7 +27,6 @@ CREATE TABLE diaries ( body text, FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (body) VALUES ("will start Groonga!"); INSERT INTO diaries (body) VALUES ("starting Groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test index dae9bf033ca..b06a6067144 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test index b25fc596813..ca33da8c309 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test new file mode 100644 index 00000000000..c0f492d1920 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test @@ -0,0 +1,46 @@ +# Copyright(C) 2015 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source include/not_embedded.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +CREATE TABLE logs ( + id INT PRIMARY KEY AUTO_INCREMENT, + message TEXT, + FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +disable_query_log; +CONNECT(drop_connection, localhost, root); +enable_query_log; + +USE test; +DROP TABLE logs; + +disable_query_log; +CONNECTION default; +enable_query_log; + +CREATE TABLE logs ( + id INT PRIMARY KEY AUTO_INCREMENT, + message TEXT, + FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test index d835a20746c..0234f831fb1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( content TEXT, FULLTEXT INDEX (content) ) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test index 9882883e597..73de4d5e70e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX (title), FULLTEXT INDEX (content) ) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, "富士山", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, "天気 1月1日", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test index 1e57b56d6b0..14fba8d2275 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test index 3fdad5365fe..9cfd841b753 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test index 53251eb2af7..b28caa87e2f 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test index f46f732203b..1dfdc49695b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test index 8f8130b7b45..66f7aaf880e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test index 6fa65d395ee..54278e97681 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test index 9d7f887c98d..459fd913552 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test index 7feca394fa5..3245501d6b7 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test index ade88c9c60d..0e69941134e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test index ecc1e0d0bad..3191ff6c44c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test index 384b951f562..90216c0a438 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test index f259fc85388..4a5512791a1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test index 4cec44d01a2..27af7f5d880 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test index 169069fb67d..912b3c9eec1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_cp932.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test index cda39ce2ad6..56309998b42 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_eucjpms.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test index 93e78d6b46d..589b4d79dcf 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test index 27af190ed7a..6b07647625d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( content text, FULLTEXT INDEX (title) ) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES (1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES (2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test index 083384b04d1..d4364af2da7 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -29,7 +29,11 @@ insert into t1 values (2, "ka ki ku ke ko"); insert into t1 values (3, "aa ii ii ii oo"); insert into t1 values (4, "sa si su se so"); insert into t1 values (5, "ta ti ii ii to"); -insert into t2 (c1,c2) select c1,c2 from t1; +insert into t2 values (1, "aa ii uu ee oo"); +insert into t2 values (2, "ka ki ku ke ko"); +insert into t2 values (3, "aa ii ii ii oo"); +insert into t2 values (4, "sa si su se so"); +insert into t2 values (5, "ta ti ii ii to"); select * from t1; select * from t2; select * from t1 where c1=3; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test index f4b76888b76..ea76dd055db 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,7 +23,6 @@ drop table if exists t1, t2, t3; --enable_warnings create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; -show create table t1; insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test index 07750416342..38e17700269 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ create table diaries ( title varchar(255), fulltext index (title) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; set autocommit=0; insert into diaries values(0, "2011-07-14"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test index 52700ad01fe..61ef72370f0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test index b362acd4565..1cc2f6c297a 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -35,13 +35,16 @@ INSERT INTO texts VALUES (1, 'Hello1', 'World1'); INSERT INTO texts VALUES (2, 'Hello2', 'World2'); INSERT INTO texts VALUES (3, 'Hello3', 'World3'); -SELECT id, - matched, - not_matched, - MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), - MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) - FROM texts - WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE); +SELECT * + FROM (SELECT id, + matched, + not_matched, + MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), + MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) + FROM texts + WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)) + AS searched_texts + ORDER BY id; DROP TABLE texts; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test index fa8fb79634d..673ed5619d9 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test index d6defc1fca2..2d2ffe7b014 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test index ebf5c37ad94..81047e78302 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test index 8ae0dd8892b..037784e4251 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test index a6c12aa1714..72662d78093 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -30,7 +30,6 @@ create table diaries ( fulltext index (title), fulltext index (content) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); insert into diaries values(3, "富士山", "今日もãれã„。"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test index 58c0ea3faf7..8ecb8eeec65 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ create table diaries ( fulltext index title_index (title), fulltext index body_index (body) ) comment = 'engine "innodb"' default charset utf8; -show create table diaries; insert into diaries (title, body) values ("survey", "will start groonga!"); insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test index 305f51d4a02..818624392a4 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -22,7 +22,6 @@ drop table if exists t1, t2, t3; --enable_warnings create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; -show create table t1; insert into t1 values (1, "hoge hoge"); insert into t1 values (2, "fuga fuga"); insert into t1 values (3, "moge moge"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test index 7fcffefd234..d65fdefd647 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test index cba565b0253..55813bd3fdc 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -23,14 +23,13 @@ DROP TABLE IF EXISTS diaries; SET NAMES UTF8; CREATE TABLE ft( - a INT, + a INT DEFAULT 0, b TEXT, c TEXT, PRIMARY KEY(a), FULLTEXT KEY ftx1(b), FULLTEXT KEY ftx2(c) )ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; -SHOW CREATE TABLE ft; INSERT INTO ft VALUES(1,'aaaaa','abcde'); INSERT INTO ft VALUES(2,'bbbbb','bcdef'); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test index 825cf361546..bcab5307e18 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; -SHOW CREATE TABLE diaries; START TRANSACTION; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); @@ -39,22 +38,32 @@ SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; +disable_query_log; CONNECT(search_connection, localhost, root); +enable_query_log; USE test; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; +disable_query_log; CONNECTION default; +enable_query_log; COMMIT; +disable_query_log; CONNECTION search_connection; +enable_query_log; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; +disable_query_log; DISCONNECT search_connection; +enable_query_log; +disable_query_log; CONNECTION default; +enable_query_log; SELECT * FROM diaries WHERE MATCH(body) AGAINST("groonga") ORDER BY id; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test index 2cfd00b2172..f08337af9d1 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test index b5f7dd80c31..d1be7ae64da 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test index 88fa88427cf..8c669052d2e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -29,7 +29,6 @@ create table shops ( location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; insert into shops (name, location) values ('nezu-no-taiyaki', ST_GeomFromText('POINT(139.762573 35.720253)')); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test index 655a8416725..3a4d399beec 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -29,7 +29,6 @@ create table shops ( location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; insert into shops (name, location) values ('sazare', diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test index 6a734958158..db7aa344e0a 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test @@ -12,11 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/have_geometry.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings @@ -29,7 +29,6 @@ create table shops ( location geometry NOT NULL, spatial key location_index (location) ) comment = 'engine "innodb"'; -show create table shops; insert into shops (name, location) values ('sazare', diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test index b7a4dd4c36b..1c73f30b60c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test index 87947f1ea6c..021d3f8e95d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test index a5edb8bae4a..b21dcc5b893 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -27,7 +27,6 @@ create table diaries ( content text, fulltext index (content) ) default charset utf8 comment = 'engine "innodb"'; -show create table diaries; LOCK TABLE diaries WRITE; insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test index d16527644e3..3006bac6d21 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -26,6 +26,8 @@ CREATE TABLE diaries ( content TEXT NOT NULL, PRIMARY KEY (date, title) ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP SHOW CREATE TABLE diaries; INSERT INTO diaries (date, title, content) diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test index d97823f77a2..ae993b76b09 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mroonga.inc @@ -27,6 +27,8 @@ CREATE TABLE diaries ( content TEXT NOT NULL, UNIQUE INDEX (date, title) ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP SHOW CREATE TABLE diaries; INSERT INTO diaries (date, title, content) diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test index dbe11f03bec..ce9cf85e7dc 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test @@ -1,5 +1,5 @@ # Copyright(C) 2013 Kenji Maruyama -# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,10 +13,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source ../../include/mroonga/have_mysql.inc ---source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test new file mode 100644 index 00000000000..fb6529ef782 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kenji Maruyama +# Copyright(C) 2013-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS integers; +--enable_warnings + +SET optimizer_switch='mrr_cost_based=off'; + +CREATE TABLE integers ( + id INT PRIMARY KEY AUTO_INCREMENT, + value INT, + KEY (value) +) COMMENT='engine "InnoDB"'; + +INSERT INTO integers (value) VALUES (0), (1), (2), (3); + +EXPLAIN SELECT * FROM integers + WHERE value IN (0, 2); + +SELECT * FROM integers + WHERE value IN (0, 2); + +DROP TABLE integers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test index 078e0b6e28e..9aeeef0e842 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test index 07a497d7871..4a2338714e4 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test index a74db4417b2..8b8e4754dc2 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test index 25a02398a66..f1b6ad62c88 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test index 7d663bef626..5ea33c4e150 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test index d11a3efe900..31b43712261 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test @@ -12,10 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.inc --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_mroonga_helper.inc @@ -28,7 +29,6 @@ CREATE TABLE diaries ( body TEXT, FULLTEXT INDEX body_index (body) ) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); @@ -36,13 +36,7 @@ INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); ---remove_file $MYSQLD_DATADIR/repair_test.mrn ---remove_file $MYSQLD_DATADIR/repair_test.mrn.001 ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000000 ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000105 ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000106 ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000107 ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000107.c +--remove_files_wildcard $MYSQLD_DATADIR repair_test.mrn* FLUSH TABLES; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test index 6d09479e554..f2b1f63a8e0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test @@ -12,10 +12,11 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.inc --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/have_mroonga_helper.inc @@ -28,7 +29,6 @@ CREATE TABLE diaries ( body TEXT, FULLTEXT INDEX body_index (body) ) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); @@ -36,14 +36,11 @@ INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); ---remove_file $MYSQLD_DATADIR/repair_test.mrn.0000106 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.000010A FLUSH TABLES; -# Error ER_CANT_OPEN_FILE syscall error 'repair_test.mrn.0000104' (No such file or directory) -# The (Error 0)[0]" replaces is for Solaris -# ---replace_result "(Error 0)[0]" "(No such file or directory)" +# Error ER_CANT_OPEN_FILE system call error: No such file or directory: failed to open path: --error ER_CANT_OPEN_FILE SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test index 7d98ca0bfa7..143270dcf20 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/skip_osx.inc @@ -27,7 +27,6 @@ CREATE TEMPORARY TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT ) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title) VALUES ("clear day"); INSERT INTO diaries (title) VALUES ("rainy day"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test index 9055715486b..7c848641626 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -31,22 +31,32 @@ SHOW CREATE TABLE simple_table; INSERT INTO simple_table (id) VALUES (1),(2); +disable_query_log; CONNECT(second_connection, localhost, root); +enable_query_log; USE test; START TRANSACTION; INSERT INTO simple_table (id) VALUES (3); +disable_query_log; CONNECTION default; +enable_query_log; SELECT * FROM simple_table; +disable_query_log; CONNECTION second_connection; +enable_query_log; COMMIT; +disable_query_log; CONNECTION default; +enable_query_log; SELECT * FROM simple_table; DROP TABLE simple_table; +disable_query_log; DISCONNECT second_connection; +enable_query_log; SET GLOBAL query_cache_size = @tmp_query_cache_size; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test index dd08d93cd47..f11ca4a9839 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test index ae9099a7ab9..36bc09be73b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -28,7 +28,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX title_index (title), FULLTEXT INDEX body_index (body) ) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test index 1920237fdad..b021b26b5e3 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -32,7 +32,6 @@ CREATE TABLE diaries ( FULLTEXT INDEX(content), KEY(day) ) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test index 7afeee05ffd..9052c434c31 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test index db1e2da9a18..ffa26994efe 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test index 2757c94b4c5..c6f2a2a14da 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries (body) values ("will start groonga!"); insert into diaries (body) values ("starting groonga..."); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test index 5e958528275..b80f60fcba5 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries (body) values ("will start groonga!"); select * from diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test index 8e9a9e3308a..ab75babfbac 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -26,7 +26,6 @@ create table diaries ( body text, fulltext index body_index (body) ) default charset utf8 COMMENT = 'engine "innodb"'; -show create table diaries; insert into diaries (body) values ("will start groonga!"); diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test index ead26bca2c1..71d44ab5704 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -25,9 +25,8 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, - FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); @@ -41,11 +40,17 @@ SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); SET GLOBAL mroonga_match_escalation_threshold = -1; --enable_warnings +disable_query_log; CONNECT(search_connection, localhost, root); +enable_query_log; USE test; + SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +disable_query_log; DISCONNECT search_connection; CONNECTION default; +enable_query_log; SET GLOBAL mroonga_match_escalation_threshold = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test index 5f5ae169890..91196faf612 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc @@ -25,9 +25,8 @@ CREATE TABLE diaries ( id INT PRIMARY KEY AUTO_INCREMENT, title TEXT, tags TEXT, - FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' ) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; -SHOW CREATE TABLE diaries; INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); diff --git a/storage/mroonga/packages/apt/Makefile.am b/storage/mroonga/packages/apt/Makefile.am index ca0e1dcb19d..0ebc7f67d04 100644 --- a/storage/mroonga/packages/apt/Makefile.am +++ b/storage/mroonga/packages/apt/Makefile.am @@ -1,11 +1,12 @@ REPOSITORIES_PATH = repositories DISTRIBUTIONS = debian ARCHITECTURES = i386 amd64 -CODE_NAMES = wheezy jessie +CODE_NAMES = jessie stretch +MYSQL_VARIANTS = 5.5 mariadb-10.0 all: -release: build sign-packages update-repository sign-repository upload +release: download build sign-packages update-repository sign-repository upload remove-existing-packages: for distribution in $(DISTRIBUTIONS); do \ @@ -45,21 +46,44 @@ upload: ensure-rsync-path build: build-package-deb -build-package-deb: prepare-build-package-deb +build-package-deb: source env.sh vagrant destroy --force - for architecture in $(ARCHITECTURES); do \ - for code_name in $(CODE_NAMES); do \ - id=debian-$$code_name-$$architecture; \ - vagrant up $$id || exit 1; \ - vagrant destroy --force $$id; \ + for variant in $(MYSQL_VARIANTS); do \ + cp env.sh tmp/; \ + echo "MYSQL_VARIANT=$${variant}" >> tmp/env.sh; \ + for architecture in $(ARCHITECTURES); do \ + for code_name in $(CODE_NAMES); do \ + rm -rf tmp/debian; \ + if [ $${variant} = "5.5" -a $${code_name} = "stretch" ]; then \ + continue; \ + fi; \ + if [ $${code_name} = "stretch" ]; then \ + cp -rp $(srcdir)/../debian-mariadb-10.0 tmp/debian; \ + for f in `find tmp/debian -maxdepth 2 -type f`; do \ + RENAMED=`echo $$f | sed 's/10.0/10.1/'`; \ + sed -i'' 's/10.0/10.1/g' $${f}; \ + if [ $${f} = $$RENAMED ]; then \ + continue; \ + fi; \ + mv $${f} $$RENAMED; \ + done; \ + if [ $${architecture} = "amd64" ]; then \ + sed -i'' 's,lib/mysql/,lib/x86_64-linux-gnu/mariadb18/,' \ + tmp/debian/mariadb-server-10.1-mroonga.install; \ + elif [ $${architecture} = "i386" ]; then \ + sed -i'' 's,lib/mysql/,lib/i386-linux-gnu/mariadb18/,' \ + tmp/debian/mariadb-server-10.1-mroonga.install; \ + fi; \ + else \ + cp -rp $(srcdir)/../debian-$${variant} tmp/debian; \ + fi; \ + id=debian-$$code_name-$$architecture; \ + vagrant up $$id || exit 1; \ + vagrant destroy --force $$id; \ + done; \ done; \ done -prepare-build-package-deb: source env.sh - cp env.sh tmp/ - rm -rf tmp/debian - cp -rp $(srcdir)/../debian tmp/ - source: tmp/$(PACKAGE)-$(VERSION).tar.gz tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz diff --git a/storage/mroonga/packages/apt/Vagrantfile b/storage/mroonga/packages/apt/Vagrantfile index 2829da879dd..ee4a6aebc23 100644 --- a/storage/mroonga/packages/apt/Vagrantfile +++ b/storage/mroonga/packages/apt/Vagrantfile @@ -6,31 +6,44 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vms = [ - { - :id => "debian-wheezy-i386", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8-i386_chef-provisionerless.box", - }, - { - :id => "debian-wheezy-amd64", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box", - }, { :id => "debian-jessie-i386", - :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0-i386_chef-provisionerless.box", + :box => "bento/debian-8.9-i386", }, { :id => "debian-jessie-amd64", - :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0_chef-provisionerless.box", + :box => "bento/debian-8.9", + }, + { + :id => "debian-stretch-i386", + :box => "bento/debian-9.1-i386", + }, + { + :id => "debian-stretch-amd64", + :box => "bento/debian-9.1", }, ] vms.each do |vm| config.vm.define(vm[:id]) do |node| - node.vm.box = vm[:id] - node.vm.box_url = vm[:box_url] + # Use official box + node.vm.box = vm[:box] if vm[:box] + # Use box and box_url until official box is released + node.vm.box = vm[:id] if vm[:box_url] + node.vm.box_url = vm[:box_url] if vm[:box_url] node.vm.provision(:shell, :path => "build-deb.sh") node.vm.provider("virtualbox") do |virtual_box| - virtual_box.memory = 768 + system_n_cpus = 1 + if File.exist?("/proc/cpuinfo") + system_n_cpus = File.readlines("/proc/cpuinfo").grep(/^processor/).size + end + if system_n_cpus > 1 + vm_n_cpus = system_n_cpus / 2 + else + vm_n_cpus = 1 + end + virtual_box.cpus = (ENV["VM_CPUS"] || vm_n_cpus).to_i + virtual_box.memory = (ENV["VM_MEMORY"] || 768).to_i end end end diff --git a/storage/mroonga/packages/apt/build-deb.sh b/storage/mroonga/packages/apt/build-deb.sh index 510886cb24f..e0e03d8ec15 100755 --- a/storage/mroonga/packages/apt/build-deb.sh +++ b/storage/mroonga/packages/apt/build-deb.sh @@ -2,8 +2,6 @@ LANG=C -mysql_server_package=mysql-server - run() { "$@" @@ -15,14 +13,37 @@ run() . /vagrant/tmp/env.sh +code_name=$(lsb_release --codename --short) +case "${MYSQL_VARIANT}" in + mariadb-*) + case "${code_name}" in + stretch) + mysql_server_package=mariadb-server-10.1 + MYSQL_VARIANT=mariadb-10.1 + ;; + *) + mysql_server_package=mariadb-server-${MYSQL_VARIANT##mariadb-} + ;; + esac + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadb-client-lgpl-dev" + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadbd-dev" + ;; + *) + mysql_server_package=mysql-server-${MYSQL_VARIANT} + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqlclient-dev" + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqld-dev" + ;; +esac + grep '^deb ' /etc/apt/sources.list | \ sed -e 's/^deb /deb-src /' > /etc/apt/sources.list.d/base-source.list +run sudo sed -i'' -e 's/httpredir/ftp.jp/g' /etc/apt/sources.list + run apt-get update run apt-get install -y lsb-release distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') -code_name=$(lsb_release --codename --short) case "${distribution}" in debian) component=main @@ -59,16 +80,23 @@ run apt-get install -V -y build-essential devscripts ${DEPENDED_PACKAGES} run apt-get build-dep -y ${mysql_server_package} run mkdir -p build -run cp /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz \ - build/${PACKAGE}_${VERSION}.orig.tar.gz run cd build -run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz -run cd ${PACKAGE}-${VERSION}/ +run tar xfz /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz +run mv ${PACKAGE}-${VERSION} ${PACKAGE}-${MYSQL_VARIANT}-${VERSION} +run tar cfz ${PACKAGE}-${MYSQL_VARIANT}_${VERSION}.orig.tar.gz \ + ${PACKAGE}-${MYSQL_VARIANT}-${VERSION} +run cd ${PACKAGE}-${MYSQL_VARIANT}-${VERSION}/ run cp -rp /vagrant/tmp/debian debian # export DEB_BUILD_OPTIONS=noopt -MYSQL_PACKAGE_INFO=$(apt-cache show mysql-server | grep Version | sort | tail -1) +MYSQL_PACKAGE_INFO=$(apt-cache show ${mysql_server_package} | + grep Version | + sort | + tail -1) MYSQL_PACKAGE_VERSION=${MYSQL_PACKAGE_INFO##Version: } -sed -i "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/" debian/control +sed -i'' \ + -e "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/g" \ + -e "s/MARIADB_VERSION/$MYSQL_PACKAGE_VERSION/g" \ + debian/control run debuild -us -uc run cd - diff --git a/storage/mroonga/packages/apt/env.sh.in b/storage/mroonga/packages/apt/env.sh.in index a44d6b36871..51109aee4f7 100644 --- a/storage/mroonga/packages/apt/env.sh.in +++ b/storage/mroonga/packages/apt/env.sh.in @@ -7,8 +7,9 @@ libgroonga-dev pkg-config libmecab-dev mecab-utils -libmysqlclient-dev -libmysqld-dev +gdb +libxml2-dev +unixodbc-dev libssl-dev groonga-normalizer-mysql wget diff --git a/storage/mroonga/packages/apt/sign-packages.sh b/storage/mroonga/packages/apt/sign-packages.sh index 11a4aea26db..57c985f38f6 100755 --- a/storage/mroonga/packages/apt/sign-packages.sh +++ b/storage/mroonga/packages/apt/sign-packages.sh @@ -23,7 +23,7 @@ run() for code_name in ${CODES}; do case ${code_name} in - squeeze|wheezy|jessie|unstable) + jessie|stretch|unstable) distribution=debian ;; *) diff --git a/storage/mroonga/packages/apt/sign-repository.sh b/storage/mroonga/packages/apt/sign-repository.sh index fb0de850d6f..e0d963ffb5f 100755 --- a/storage/mroonga/packages/apt/sign-repository.sh +++ b/storage/mroonga/packages/apt/sign-repository.sh @@ -23,7 +23,7 @@ run() for code_name in ${CODES}; do case ${code_name} in - squeeze|wheezy|jessie|unstable) + jessie|stretch|unstable) distribution=debian ;; *) diff --git a/storage/mroonga/packages/apt/update-repository.sh b/storage/mroonga/packages/apt/update-repository.sh index da1f8cd121c..a95ad117ccc 100755 --- a/storage/mroonga/packages/apt/update-repository.sh +++ b/storage/mroonga/packages/apt/update-repository.sh @@ -109,7 +109,7 @@ EOF for code_name in ${CODES}; do case ${code_name} in - squeeze|wheezy|jessie|unstable) + jessie|stretch|unstable) distribution=debian component=main ;; diff --git a/storage/mroonga/packages/check-utility.sh b/storage/mroonga/packages/check-utility.sh deleted file mode 100755 index 211e231a473..00000000000 --- a/storage/mroonga/packages/check-utility.sh +++ /dev/null @@ -1,665 +0,0 @@ -#!/bin/sh - -# Usage: check-utility.sh [--install-groonga] -# [--check-install] -# [--check-address] -# [--enable-repository] -# -# CODES="squeeze wheezy unstable lucid natty oneiric precise" -# DISTRIBUTIONS="centos fedora" - -CHROOT_ROOT=/var/lib/chroot -CHECK_ADDRESS=0 -CHECK_INSTALL=0 -CHECK_INSTALL_PACKAGE=mysql-server-mroonga -CHECK_BUILD=0 -CHECK_DEPENDS=0 -CHECK_PROVIDES=0 -ENABLE_REPOSITORY=0 -DISABLE_REPOSITORY=0 -INSTALL_SCRIPT=0 -INSTALL_MROONGA=0 -UNINSTALL_MROONGA=0 - -common_deb_procedure () -{ - for code in $CODES; do - for arch in $DEB_ARCHITECTURES; do - root_dir=$CHROOT_ROOT/$code-$arch - eval $1 $code $arch $root_dir - done - done -} - -common_rpm_procedure () -{ - for dist in $DISTRIBUTIONS; do - case $dist in - "fedora") - DISTRIBUTIONS_VERSION="19" - ;; - "centos") - DISTRIBUTIONS_VERSION="5 6" - ;; - esac - for ver in $DISTRIBUTIONS_VERSION; do - for arch in $RPM_ARCHITECTURES; do - root_dir=$CHROOT_ROOT/$dist-$ver-$arch - eval $1 $dist $arch $ver $root_dir - done - done - done -} - -echo_packages_repository_address () -{ - root_dir=$1 - code=$2 - arch=$3 - address=`grep "packages.groonga.org" $root_dir/etc/hosts | grep -v "#"` - if [ -z "$address" ]; then - echo "$code-$arch: default" - else - echo "$code-$arch: $address" - fi -} - -setup_distributions () -{ - if [ -z "$DISTRIBUTIONS" ]; then - DISTRIBUTIONS="centos fedora" - fi -} - -setup_rpm_architectures () -{ - if [ -z "$RPM_ARCHITECTURES" ]; then - RPM_ARCHITECTURES="i386 x86_64" - fi -} - -setup_codes () -{ - if [ -z "$CODES" ]; then - CODES="squeeze wheezy jessie unstable lucid precise quantal raring" - fi -} -setup_deb_architectures () -{ - if [ -z "$DEB_ARCHITECTURES" ]; then - DEB_ARCHITECTURES="i386 amd64" - fi -} - -check_packages_repository_address () -{ - common_deb_procedure "check_packages_deb_repository_address" - common_rpm_procedure "check_packages_rpm_repository_address" -} - -check_packages_deb_repository_address () -{ - code=$1 - arch=$2 - root_dir=$4 - echo_packages_repository_address "$root_dir" "$code" "$arch" -} - -check_packages_rpm_repository_address () -{ - dist=$1 - arch=$2 - ver=$3 - root_dir=$4 - echo_packages_repository_address "$root_dir" "$dist-$ver" "$arch" -} - -host_address () -{ - ifconfig_result=`LANG=C /sbin/ifconfig wlan0` - inet_addr=`echo "$ifconfig_result" | grep "inet addr:192"` - address=`echo $inet_addr | ruby -ne '/inet addr:(.+?)\s/ =~ $_ && puts($1)'` - HOST_ADDRESS=$address -} - -check_build_packages () -{ - common_deb_procedure "check_build_deb_packages" - common_rpm_procedure "check_build_rpm_packages" -} - -check_build_deb_packages () -{ - code=$1 - arch=$2 - BASE_VERSION=`cat ../version` - RESULT_SET=`find apt/repositories -name "*$BASE_VERSION*" | grep $code | grep $arch` - if [ -z "$RESULT_SET" ]; then - printf "%8s %5s %s => 0 deb\n" $code $arch $BASE_VERSION - else - PACKAGE_COUNT=`find apt/repositories -name "*$BASE_VERSION*" | grep $code | grep $arch | wc | awk '{print \$1}'` - printf "%8s %5s %s => %2d debs\n" $code $arch $BASE_VERSION $PACKAGE_COUNT - fi -} - -check_build_rpm_packages () -{ - dist=$1 - arch=$2 - ver=$3 - BASE_VERSION=`cat ../version` - FIND_PATH=yum/repositories/$dist/$ver/$arch - RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*"` - if [ -z "$RESULT_SET" ]; then - printf "%8s %6s %s => 0 rpm\n" $dist$ver $arch $BASE_VERSION - else - PACKAGE_COUNT=`find $FIND_PATH -name "*$BASE_VERSION*" | wc -l` - printf "%8s %6s %s => %2d rpms\n" $dist$ver $arch $BASE_VERSION $PACKAGE_COUNT - fi -} - -check_depends_packages () -{ - common_deb_procedure "check_depends_deb_packages" - common_rpm_procedure "check_depends_rpm_packages" -} - -check_depends_deb_packages () -{ - code=$1 - arch=$2 - BASE_VERSION=`cat ../version` - FIND_PATH=apt/repositories/*/pool/$code - RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*.deb"` - if [ -z "$RESULT_SET" ]; then - printf "%8s %5s %s => 404 deb\n" $code $arch $BASE_VERSION - else - for pkg in $RESULT_SET; do - DEB_NAME=`basename $pkg` - DEPENDS=`dpkg -I $pkg | grep "Depends"` - printf "%8s %5s %s => %s\n" $code $arch $DEB_NAME "$DEPENDS" - done - fi -} - -check_depends_rpm_packages () -{ - dist=$1 - arch=$2 - ver=$3 - BASE_VERSION=`cat ../version` - FIND_PATH=yum/repositories/$dist/$ver/$arch - RESULT_SET=`find $FIND_PATH -name "*$BASE_VERSION*"` - if [ -z "$RESULT_SET" ]; then - printf "%8s %6s %s => 404 rpm\n" $dist$ver $arch $BASE_VERSION - else - for pkg in $RESULT_SET; do - RPM_NAME=`basename $pkg` - DEPENDS=`rpm -qp --requires $pkg | grep -i "mysql" | tr -t '\n' ' '` - printf "%9s %6s %s => %s\n" $dist$ver $arch $RPM_NAME "$DEPENDS" - done - fi -} - -check_provided_mysql_packages () -{ - common_deb_procedure "check_provided_mysql_deb_packages" - common_rpm_procedure "check_provided_mysql_rpm_packages" - for code in $CODES; do - echo $code - cat tmp/$code-amd64-mysql-server.txt - done - for dist in $DISTRIBUTIONS; do - echo $dist - cat tmp/$dist-x86_64-mysql-server.txt - done -} - -check_provided_mysql_deb_packages () -{ - code=$1 - arch=$2 - root_dir=$3 - cat > tmp/check-provided-mysql.sh < /dev/null -apt-cache show mysql-server | grep "Version" | head -1 > /tmp/$code-$arch-mysql-server.txt -EOF - if [ -d $root_dir ]; then - CHECK_SCRIPT=check-provided-mysql.sh - echo "copy check script $CHECK_SCRIPT to $root_dir/tmp" - sudo rm -f $root_dir/tmp/$CHECK_SCRIPT - cp tmp/$CHECK_SCRIPT $root_dir/tmp - sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT - sudo chname $code-$arch chroot $root_dir /tmp/$CHECK_SCRIPT - cp $root_dir/tmp/$code-$arch-mysql-server.txt tmp - fi -} - -check_provided_mysql_rpm_packages () -{ - dist=$1 - arch=$2 - ver=$3 - root_dir=$4 - cat > tmp/check-provided-mysql.sh < /dev/null -yum info mysql-server | grep "Version" > /tmp/$code-$arch-mysql-server.txt -EOF - if [ -d $root_dir ]; then - CHECK_SCRIPT=check-provided-mysql.sh - echo "copy check script $CHECK_SCRIPT to $root_dir/tmp" - sudo rm -f $root_dir/tmp/$CHECK_SCRIPT - cp tmp/$CHECK_SCRIPT $root_dir/tmp - sudo chmod 755 $root_dir/tmp/$CHECK_SCRIPT - sudo chname $code-$arch chroot $root_dir /tmp/$CHECK_SCRIPT - cp $root_dir/tmp/$code-$arch-mysql-server.txt tmp - fi -} - -check_installed_mroonga_packages () -{ - common_deb_procedure "check_installed_mroonga_deb_packages" - common_rpm_procedure "check_installed_mroonga_rpm_packages" -} - -check_installed_mroonga_deb_packages () -{ - code=$1 - arch=$2 - root_dir=$3 - cat > tmp/check-deb-mroonga.sh < tmp/check-rpm-mroonga.sh < tmp/install-aptitude-mroonga.sh < tmp/install-aptget-mroonga.sh < tmp/install-centos5-mroonga.sh < tmp/install-centos6-mroonga.sh < tmp/install-fedora-mroonga.sh < $UNINSTALL_SCRIPT < tmp/$UNINSTALL_SCRIPT < tmp/enable-repository.sh < /tmp/hosts -echo "$HOST_ADDRESS packages.groonga.org" >> /tmp/hosts -cp -f /tmp/hosts /etc/hosts -EOF - common_deb_procedure "enable_temporaly_mroonga_deb_repository" - common_rpm_procedure "enable_temporaly_mroonga_rpm_repository" - check_packages_repository_address -} - -enable_temporaly_mroonga_deb_repository () -{ - code=$1 - arch=$2 - root_dir=$4 - today=`date '+%Y%m%d.%s'` - if [ -d $root_dir ]; then - sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today - sudo cp tmp/enable-repository.sh $root_dir/tmp - sudo chname $code-$arch chroot $root_dir /tmp/enable-repository.sh - fi -} - -enable_temporaly_mroonga_rpm_repository () -{ - dist=$1 - arch=$2 - ver=$3 - root_dir=$4 - today=`date '+%Y%m%d.%s'` - if [ -d $root_dir ]; then - sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today - sudo cp tmp/enable-repository.sh $root_dir/tmp - sudo chname $code-$arch chroot $root_dir /tmp/enable-repository.sh - fi -} - -disable_temporaly_mroonga_repository () -{ - cat > tmp/disable-repository.sh < /tmp/hosts -cp -f /tmp/hosts /etc/hosts -EOF - common_deb_procedure "disable_temporaly_mroonga_deb_repository" - common_rpm_procedure "disable_temporaly_mroonga_rpm_repository" - check_packages_repository_address -} - -disable_temporaly_mroonga_deb_repository () -{ - code=$1 - arch=$2 - root_dir=$4 - DISABLE_SCRIPT=disable-repository.sh - today=`date '+%Y%m%d.%s'` - if [ -d $root_dir ]; then - sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today - cp tmp/$DISABLE_SCRIPT $root_dir/tmp - chmod 755 $root_dir/tmp/$DISABLE_SCRIPT - sudo chname $code-$arch chroot $root_dir /tmp/$DISABLE_SCRIPT - fi - -} - -disable_temporaly_mroonga_rpm_repository () -{ - dist=$1 - arch=$2 - ver=$3 - root_dir=$4 - DISABLE_SCRIPT=disable-repository.sh - today=`date '+%Y%m%d.%s'` - if [ -d $root_dir ]; then - sudo cp $root_dir/etc/hosts $root_dir/etc/hosts.$today - cp tmp/$DISABLE_SCRIPT $root_dir/tmp - chmod 755 $root_dir/tmp/$DISABLE_SCRIPT - sudo chname $code-$arch chroot $root_dir /tmp/$DISABLE_SCRIPT - fi -} - -host_address -echo $HOST_ADDRESS - -while [ $# -ne 0 ]; do - case $1 in - --check-install) - CHECK_INSTALL=1 - shift - if [ ! -z "$1" ]; then - case $1 in - groonga|mroonga|roonga|mecab|mysql) - CHECK_INSTALL_PACKAGE=$1 - ;; - *) - ;; - esac - fi - ;; - --check-address) - CHECK_ADDRESS=1 - shift - ;; - --check-depends) - CHECK_DEPENDS=1 - shift - ;; - --check-provides) - CHECK_PROVIDES=1 - shift - ;; - --check-build) - CHECK_BUILD=1 - shift - ;; - --enable-repository) - ENABLE_REPOSITORY=1 - shift - ;; - --disable-repository) - DISABLE_REPOSITORY=1 - shift - ;; - --install-mroonga) - INSTALL_MROONGA=1 - shift - ;; - --uninstall-mroonga) - UNINSTALL_MROONGA=1 - shift - ;; - --code) - shift - if [ "$1" = "all" ]; then - setup_codes - else - CODES=$1 - fi - shift - ;; - --code-arch) - shift - if [ "$1" = "all" ]; then - setup_deb_architectures - else - DEB_ARCHITECTURES=$1 - fi - shift - ;; - --dist) - shift - if [ "$1" = "all" ]; then - setup_distributions - else - DISTRIBUTIONS=$1 - fi - shift - ;; - --dist-arch) - shift - if [ "$1" = "all" ]; then - setup_rpm_architectures - else - RPM_ARCHITECTURES=$1 - fi - shift - ;; - *) - shift - ;; - esac -done - -mkdir -p tmp -setup_deb_architectures -setup_rpm_architectures - -if [ $CHECK_INSTALL -ne 0 ]; then - check_installed_mroonga_packages -fi -if [ $CHECK_ADDRESS -ne 0 ]; then - check_packages_repository_address -fi -if [ $CHECK_BUILD -ne 0 ]; then - check_build_packages -fi -if [ $CHECK_DEPENDS -ne 0 ]; then - check_depends_packages -fi -if [ $CHECK_PROVIDES -ne 0 ]; then - check_provided_mysql_packages -fi -if [ $ENABLE_REPOSITORY -ne 0 ]; then - enable_temporaly_mroonga_repository -fi -if [ $DISABLE_REPOSITORY -ne 0 ]; then - disable_temporaly_mroonga_repository -fi -if [ $INSTALL_MROONGA -ne 0 ]; then - install_mroonga_packages -fi -if [ $UNINSTALL_MROONGA -ne 0 ]; then - uninstall_mroonga_packages -fi - diff --git a/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga b/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga deleted file mode 100644 index 259f8d1dc0c..00000000000 --- a/storage/mroonga/packages/debian/apparmor/mysql-server-mroonga +++ /dev/null @@ -1,5 +0,0 @@ -/usr/lib/groonga/plugins/ r, -/usr/lib/groonga/plugins/** rm, -/etc/mecabrc r, -/var/lib/mecab/dic/** r, -#include diff --git a/storage/mroonga/packages/debian/changelog b/storage/mroonga/packages/debian/changelog deleted file mode 100644 index 366edca7b4e..00000000000 --- a/storage/mroonga/packages/debian/changelog +++ /dev/null @@ -1,415 +0,0 @@ -mroonga (5.04-1) unstable; urgency=low - - * New upstream release. - - -- Masafumi Yokoyama Mon, 29 Jun 2015 00:00:00 +0900 - -mroonga (5.03-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Fri, 29 May 2015 00:00:00 +0900 - -mroonga (5.02-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Wed, 29 Apr 2015 00:00:00 +0900 - -mroonga (5.01-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sun, 29 Mar 2015 00:00:00 +0900 - -mroonga (5.00-1) unstable; urgency=low - - * New upstream release. - - -- Mon, 09 Feb 2015 00:00:00 +0900 - -mroonga (4.10-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Thu, 29 Jan 2015 00:00:00 +0900 - -mroonga (4.09-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Mon, 29 Dec 2014 00:00:00 +0900 - -mroonga (4.08-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 29 Nov 2014 00:00:00 +0900 - -mroonga (4.07-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Wed, 29 Oct 2014 00:00:00 +0900 - -mroonga (4.06-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Mon, 29 Sep 2014 00:00:00 +0900 - -mroonga (4.05-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Fri, 29 Aug 2014 00:00:00 +0900 - -mroonga (4.04-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Tue, 29 Jul 2014 00:00:00 +0900 - -mroonga (4.03-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Thu, 29 May 2014 00:00:00 +0900 - -mroonga (4.02-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Tue, 29 Apr 2014 00:00:00 +0900 - -mroonga (4.01-2) unstable; urgency=low - - * Built for mysql-server 5.5.37 - - -- HAYASHI Kentaro Mon, 28 Apr 2014 00:00:00 +0900 - -mroonga (4.01-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 29 Mar 2014 00:00:00 +0900 - -mroonga (4.00-2) unstable; urgency=low - - * Built for mysql-server 5.5.35+dfsg-2 on Debian jessie - * Built for mysql-server 5.5.35+dfsg-2 on Debian sid - - -- HAYASHI Kentaro Thu, 06 Mar 2014 00:00:00 +0900 - -mroonga (4.00-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sun, 09 Feb 2014 00:00:00 +0900 - -mroonga (3.12-2) unstable; urgency=low - - * Built for mysql-server updates on Ubuntu 12.04,12.10, and 13.10. - - -- HAYASHI Kentaro Wed, 29 Jan 2014 13:12:56 +0900 - -mroonga (3.12-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Wed, 29 Jan 2014 00:00:00 +0900 - -mroonga (3.11-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sun, 29 Dec 2013 00:00:00 +0900 - -mroonga (3.10-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Fri, 29 Nov 2013 00:00:00 +0900 - -mroonga (3.09-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Tue, 29 Oct 2013 00:00:00 +0900 - -mroonga (3.08-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sun, 29 Sep 2013 00:00:00 +0900 - -mroonga (3.07-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Thu, 29 Aug 2013 00:00:00 +0900 - -mroonga (3.06-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Mon, 29 Jul 2013 00:00:00 +0900 - -mroonga (3.05-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 29 Jun 2013 00:00:00 +0900 - -mroonga (3.04-2) unstable; urgency=low - - * Built for mysql-server 5.5.31-0ubuntu0.12.04.2 on Ubuntu 12.04 (precise) - - -- HAYASHI Kentaro Thu, 13 Jun 2013 00:00:00 +0900 - -mroonga (3.04-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Wed, 29 May 2013 00:00:00 +0900 - -mroonga (3.03-2) unstable; urgency=low - - * Built for mysql-server 5.5.31+dfsg-0+wheezy1 on Debian wheezy - * Built for mysql-server 5.5.31+dfsg-1 on Debian unstable - - -- HAYASHI Kentaro Thu, 16 May 2013 00:00:00 +0900 - -mroonga (3.03-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Mon, 29 Apr 2013 00:00:00 +0900 - -mroonga (3.02-2) unstable; urgency=low - - * Built for mysql-server 5.5.29-0ubuntu0.12.04.2 on Ubuntu 12.04 (precise) - - -- HAYASHI Kentaro Fri, 29 Mar 2013 22:15:39 +0900 - -mroonga (3.02-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Fri, 29 Mar 2013 00:00:00 +0900 - -mroonga (3.01-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Thu, 28 Feb 2013 00:00:00 +0900 - -mroonga (3.00-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 09 Feb 2013 00:00:00 +0900 - -mroonga (2.10-2) unstable; urgency=low - - * Built for mysql-server 5.5.29+dfsg-1 on Debian/unstable. - * Built for mysql-server 5.1.67-0ubuntu0.10.04.1 on Ubuntu 10.04(lucid). - * Built for mysql-server 5.1.67-0ubuntu0.11.10.1 on Ubuntu 11.10(oneiric). - * Built for mysql-server 5.5.29-0ubuntu0.12.04.1 on Ubuntu 12.04(precise). - * Built for mysql-server 5.5.29-0ubuntu0.12.10.1 on Ubuntu 12.10(quantal). - - -- HAYASHI Kentaro Thu, 24 Jan 2013 10:28:16 +0900 - -mroonga (2.10-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 29 Dec 2012 00:00:00 +0900 - -mroonga (2.09-2) unstable; urgency=low - - * Built for mysql-server 5.5.28-0ubuntu0.12.10.2 on Ubuntu 12.10. - Reported by @watanabekiyokaz - - -- HAYASHI Kentaro Wed, 12 Dec 2012 13:28:00 +0900 - -mroonga (2.09-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Thu, 29 Nov 2012 00:00:00 +0900 - -mroonga (2.08-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Mon, 29 Oct 2012 00:00:00 +0900 - -mroonga (2.07-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sat, 29 Sep 2012 00:00:00 +0900 - -mroonga (2.06-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Wed, 29 Aug 2012 00:00:00 +0900 - -mroonga (2.05-1) unstable; urgency=low - - * New upstream release. - - -- HAYASHI Kentaro Sun, 29 Jul 2012 00:00:00 +0900 - -mroonga (2.04-1) unstable; urgency=low - - * New upstream release. - * Ensure deleting mroonga plugin before install. - Suggested by Kazuhiro Isobe. Thanks!!! - - -- Kouhei Sutou Fri, 29 Jun 2012 00:00:00 +0900 - -mroonga (2.03-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Tue, 29 May 2012 00:00:00 +0900 - -mroonga (2.02-1) unstable; urgency=low - - * New upstream release. - * Require groonga >= 2.0.2. - - -- Kouhei Sutou Sun, 29 Apr 2012 00:00:00 +0900 - -mroonga (2.01-1) unstable; urgency=low - - * New upstream release. - * Ensure plugin is uninstalled by closing all tables use mroonga. - - -- Kouhei Sutou Thu, 29 Mar 2012 00:00:00 +0900 - -mroonga (2.00-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Wed, 29 Feb 2012 00:00:00 +0900 - -mroonga (1.20-1) unstable; urgency=low - - * New upstream release. - * Add mysql-server-mroonga-compatible package for "groonga" storage engine. - - -- Kouhei Sutou Sun, 29 Jan 2012 00:00:00 +0900 - -mroonga (1.11-1) unstable; urgency=low - - * New upstream release. - * Change apparmor configuration file name: - mysql-server-groonga -> mysql-server-mroonga - - -- Kouhei Sutou Thu, 29 Dec 2011 00:00:00 +0900 - -mroonga (1.10-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Sat, 29 Oct 2011 00:00:00 +0900 - -groonga-storage-engine (1.0.0-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Thu, 29 Sep 2011 00:00:00 +0900 - -groonga-storage-engine (0.9-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Mon, 29 Aug 2011 00:00:00 +0900 - -groonga-storage-engine (0.8-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Fri, 29 Jul 2011 00:00:00 +0900 - -groonga-storage-engine (0.7-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Wed, 29 Jun 2011 00:00:00 +0900 - -groonga-storage-engine (0.6-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Sun, 29 May 2011 00:00:00 +0900 - -groonga-storage-engine (0.5-4) unstable; urgency=low - - * fix a typo. - - -- Kouhei Sutou Tue, 30 Mar 2011 01:05:00 +0900 - -groonga-storage-engine (0.5-3) unstable; urgency=low - - * fix AppArmor files. - - -- Kouhei Sutou Tue, 30 Mar 2011 00:59:00 +0900 - -groonga-storage-engine (0.5-2) unstable; urgency=low - - * hook script fix. - - -- Kouhei Sutou Tue, 30 Mar 2011 00:58:00 +0900 - -groonga-storage-engine (0.5-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Tue, 29 Mar 2011 00:00:00 +0900 - -groonga-storage-engine (0.4-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Mon, 29 Nov 2010 00:00:00 +0900 - -groonga-storage-engine (0.3-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Fri, 29 Oct 2010 16:34:04 +0900 - -groonga-storage-engine (0.2-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Sat, 25 Sep 2010 14:52:49 +0900 - -groonga-storage-engine (0.1-4) unstable; urgency=low - - * follow configure option changes. - - -- Kouhei Sutou Fri, 10 Sep 2010 08:45:53 +0900 - -groonga-storage-engine (0.1-3) unstable; urgency=low - - * Use HEAD. - - -- Kouhei Sutou Thu, 02 Sep 2010 12:03:46 +0900 - -groonga-storage-engine (0.1-2) unstable; urgency=low - - * Built with groonga 1.0.0. - - -- Kouhei Sutou Mon, 30 Aug 2010 13:26:25 +0900 - -groonga-storage-engine (0.1-1) unstable; urgency=low - - * New upstream release. - - -- Kouhei Sutou Mon, 23 Aug 2010 13:52:01 +0900 diff --git a/storage/mroonga/packages/debian/compat b/storage/mroonga/packages/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/storage/mroonga/packages/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/storage/mroonga/packages/debian/control.in b/storage/mroonga/packages/debian/control.in deleted file mode 100644 index d6d03fa9a4e..00000000000 --- a/storage/mroonga/packages/debian/control.in +++ /dev/null @@ -1,51 +0,0 @@ -Source: mroonga -Section: database -Priority: optional -Maintainer: Kouhei Sutou -Build-Depends: - debhelper (>= 7.0.50), - autotools-dev, - pkg-config, - libgroonga-dev (>= @REQUIRED_GROONGA_VERSION@), - groonga-normalizer-mysql, - libmysqlclient-dev, - libmysqld-dev, - libssl-dev, - wget, - lsb-release -Standards-Version: 3.9.1 -Homepage: http://mroonga.org/ - -Package: mysql-server-mroonga -Section: database -Architecture: any -Replaces: mysql-server-groonga (<< 1.10-1) -Breaks: mysql-server-groonga (<< 1.10-1) -Depends: - ${misc:Depends}, - ${shlibs:Depends}, - libgroonga0 (>= @REQUIRED_GROONGA_VERSION@), - mysql-server (= MYSQL_VERSION), - groonga-normalizer-mysql -Description: A fast fulltext searchable storage engine for MySQL. - Mroonga is a fast fulltext searchable storage engine for MySQL. - It is based on Groonga, a fast fulltext search engine and column store. - Groonga is good at real time update. - . - This package provides a MySQL storage engine as a shared library. - This provides "mroonga" storage engine. It means you can use - "ENGINE = mroonga" in "CREATE TABLE". - -Package: mysql-server-mroonga-doc -Section: doc -Architecture: all -Replaces: mysql-server-groonga-doc (<< 1.10-1) -Breaks: mysql-server-groonga-doc (<< 1.10-1) -Depends: - ${misc:Depends} -Description: Documentation of Mroonga. - Mroonga is a fast fulltext searchable storage engine for MySQL. - It is based on Groonga, a fast fulltext search engine and column store. - Groonga is good at real time update. - . - This package provides documentation of Mroonga. diff --git a/storage/mroonga/packages/debian/copyright b/storage/mroonga/packages/debian/copyright deleted file mode 100644 index bb41984e8e4..00000000000 --- a/storage/mroonga/packages/debian/copyright +++ /dev/null @@ -1,27 +0,0 @@ -This work was packaged for Debian by: - - Kouhei Sutou on Thu, 02 Sep 2010 13:51:56 +0900. - -It was downloaded: - - - -Upstream Author(s): - - Tetsuro IKEDA - Daijiro MORI - Tasuku SUENAGA - Kouhei Sutou - -Copyright: - - Copyright(C) 2009-2010 Tetsuro IKEDA - -License: - - LGPLv2.1 - - See `/usr/share/common-licenses/LGPL-2.1'. - -The Debian packaging is done by Kouhei Sutou in 2010, -and put into public domain, anyone can use it for any purpose. diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install b/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install deleted file mode 100644 index ad2e27ef7dd..00000000000 --- a/storage/mroonga/packages/debian/mysql-server-mroonga-doc.install +++ /dev/null @@ -1 +0,0 @@ -usr/share/doc/mysql-server-mroonga-doc/ diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.install b/storage/mroonga/packages/debian/mysql-server-mroonga.install deleted file mode 100644 index 03f64cfedb4..00000000000 --- a/storage/mroonga/packages/debian/mysql-server-mroonga.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/mysql/plugin/ha_mroonga.so* -usr/share/mroonga/* -debian/apparmor/mysql-server-mroonga etc/apparmor.d/abstractions/ diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.postinst b/storage/mroonga/packages/debian/mysql-server-mroonga.postinst deleted file mode 100755 index 9a3db8784a2..00000000000 --- a/storage/mroonga/packages/debian/mysql-server-mroonga.postinst +++ /dev/null @@ -1,72 +0,0 @@ -#! /bin/sh - -set -e - -prevver="$2" - -install_plugin() { - cat /usr/share/mroonga/install.sql | \ - mysql --defaults-file=/etc/mysql/debian.cnf || true -} - -install_apparmor() { - mysql_apparmor_profile_name=usr.sbin.mysqld - mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name} - mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name} - apparmor_profile_name=mysql-server-mroonga - include_profile="#include " - local_apparmor_profile=/etc/apparmor.d/local/${apparmor_profile_name} - if test -f "${mysql_local_apparmor_profile}"; then - if ! grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then - echo >> "${mysql_local_apparmor_profile}" - echo "${include_profile}" >> "${mysql_local_apparmor_profile}" - fi - else - mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql - mysql_plugin_dir=/usr/lib/mysql/plugin - if test -f "${mysql_abstraction_apparmor_profile}" && \ - ! grep -q "${mysql_plugin_dir}" \ - "${mysql_abstraction_apparmor_profile}"; then - # For Lucid. - cat <> "${mysql_abstraction_apparmor_profile}" - -# ${apparmor_profile_name}: START -# Added by mysql-server-mroonga. -${mysql_plugin_dir}/ r, -${mysql_plugin_dir}/*.so* mr, -${include_profile} -# ${apparmor_profile_name}: END -EOF - fi - fi - - if ! test -e "$local_apparmor_profile"; then - mkdir -p $(dirname "$local_apparmor_profile") - cat < "$local_apparmor_profile" -# Site-specific additions and overrides for ${apparmor_profile_name}. -# For more details, please see /etc/apparmor.d/local/README. -EOF - fi - - if aa-status --enabled 2>/dev/null; then - apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true - fi - - true -} - -case "$1" in - configure) - install_apparmor - install_plugin - ;; - abort-upgrade|abort-deconfigure|abort-remove) - : - ;; - *) - echo "Called with unknown argument $1, bailing out." - exit 1 - ;; -esac - -#DEBHELPER# diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.postrm b/storage/mroonga/packages/debian/mysql-server-mroonga.postrm deleted file mode 100755 index 84d7f1ef4ab..00000000000 --- a/storage/mroonga/packages/debian/mysql-server-mroonga.postrm +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh - -set -e - -if [ "$1" = "purge" ]; then - mysql_apparmor_profile_name=usr.sbin.mysqld - mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name} - mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name} - mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql - apparmor_profile_name=mysql-server-mroonga - if test -f "${mysql_local_apparmor_profile}"; then - include_profile="#include " - if grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then - sed -i'' -e "s,${include_profile},," \ - "${mysql_local_apparmor_profile}" - fi - else - start_marker_re="^# ${apparmor_profile_name}: START$" - end_marker_re="^# ${apparmor_profile_name}: END$" - if test -f "${mysql_abstraction_apparmor_profile}" && \ - grep -q "${start_marker_re}" \ - "${mysql_abstraction_apparmor_profile}"; then - sed -i'' -e "/${start_marker_re}/,/${end_marker_re}/d" \ - "${mysql_abstraction_apparmor_profile}" - fi - fi - - rm -f "/etc/apparmor.d/local/${apparmor_profile_name}" || true - rmdir /etc/apparmor.d/local 2>/dev/null || true - - if aa-status --enabled 2>/dev/null; then - apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true - fi -fi - -#DEBHELPER# - -exit 0 diff --git a/storage/mroonga/packages/debian/mysql-server-mroonga.prerm b/storage/mroonga/packages/debian/mysql-server-mroonga.prerm deleted file mode 100755 index 7fad990d75f..00000000000 --- a/storage/mroonga/packages/debian/mysql-server-mroonga.prerm +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e - -cat /usr/share/mroonga/uninstall.sql | \ - mysql --defaults-file=/etc/mysql/debian.cnf || true - -#DEBHELPER# - -exit 0 diff --git a/storage/mroonga/packages/debian/rules b/storage/mroonga/packages/debian/rules deleted file mode 100755 index 2a397b333e1..00000000000 --- a/storage/mroonga/packages/debian/rules +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile-gmake -*- -# -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 -# This has to be exported to make some magic below work. -export DH_OPTIONS - -export MYSQL_VERSION := $(shell apt-cache show mysql-server-5.5 | grep Version | head -n 1 | awk '{print $$2}' | awk -F '-' '{print $$1}') - -%: - dh $@ - -override_dh_auto_configure: - path=main/m/mysql-5.5/mysql-5.5_$(MYSQL_VERSION).orig.tar.gz; \ - if [ "$$(lsb_release --id --short)" = "Ubuntu" ]; then \ - base_url=http://archive.ubuntu.com/ubuntu/pool; \ - security_base_url=http://security.ubuntu.com/ubuntu/pool; \ - else \ - base_url=http://ftp.debian.org/debian/pool; \ - security_base_url=http://security.debian.org/pool/updates; \ - fi; \ - wget $${security_base_url}/$${path} || \ - wget $${base_url}/$${path} - tar xf mysql-5.5_$(MYSQL_VERSION).orig.tar.gz - dh_auto_configure -- --with-mysql-source=./mysql-$(MYSQL_VERSION) - -# disable 'make check'. -override_dh_auto_test: - -override_dh_install: - mv debian/tmp/usr/share/doc/mroonga/ \ - debian/tmp/usr/share/doc/mysql-server-mroonga-doc/ - dh_install -# if test -x /usr/bin/dh_apparmor; then \ -# dh_apparmor \ -# -pmysql-server-mroonga \ -# --profile-name=usr.lib.mysql.plugin.ha_mroonga; \ -# fi diff --git a/storage/mroonga/packages/rpm/centos/Makefile.am b/storage/mroonga/packages/rpm/centos/Makefile.am index e7b22cfa025..72d860a90f2 100644 --- a/storage/mroonga/packages/rpm/centos/Makefile.am +++ b/storage/mroonga/packages/rpm/centos/Makefile.am @@ -1,9 +1,19 @@ EXTRA_DIST = \ mysql55-mroonga.spec.in \ mysql56-community-mroonga.spec.in \ - mariadb-mroonga.spec.in + mysql57-community-mroonga.spec.in \ + mariadb-mroonga.spec.in \ + mariadb-10.1-mroonga.spec.in \ + mariadb-10.2-mroonga.spec.in \ + percona-server-56-mroonga.spec.in \ + percona-server-57-mroonga.spec.in noinst_DATA = \ mysql55-mroonga.spec \ mysql56-community-mroonga.spec \ - mariadb-mroonga.spec + mysql57-community-mroonga.spec \ + mariadb-mroonga.spec \ + mariadb-10.1-mroonga.spec \ + mariadb-10.2-mroonga.spec \ + percona-server-56-mroonga.spec \ + percona-server-57-mroonga.spec diff --git a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in index 04d1c41f2cc..d23c499fd44 100644 --- a/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in +++ b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in @@ -1,18 +1,18 @@ %define mariadb_epoch_default 1 -%define mariadb_version_default 5.5.41 +%define mariadb_version_default 5.5.56 %define mariadb_release_default 2 -%define mariadb_dist_default .el7_0 -%define mariadb_download_base_url_default http://vault.centos.org/7.1.1503/os/Source/SPackages +%define mariadb_dist_default .el7 +%define mariadb_download_base_url_default http://vault.centos.org/7.4.1708/os/Source/SPackages/ %define mariadb_spec_file_default mariadb.spec -%{!?mariadb_epoch:%define mariadb_epoch %{mariadb_epoch_default}} -%{!?mariadb_version:%define mariadb_version %{mariadb_version_default}} -%{!?mariadb_release:%define mariadb_release %{mariadb_release_default}} -%{!?mariadb_dist:%define mariadb_dist %{mariadb_dist_default}} -%{!?mariadb_download_base_url:%define mariadb_download_base_url %{mariadb_download_base_url_default}} -%{!?mariadb_spec_file:%define mariadb_spec_file %{mariadb_spec_file_default}} +%define _mariadb_epoch %{?mariadb_epoch:%{mariadb_epoch}}%{!?mariadb_epoch:%{mariadb_epoch_default}} +%define _mariadb_version %{?mariadb_version:%{mariadb_version}}%{!?mariadb_version:%{mariadb_version_default}} +%define _mariadb_release %{?mariadb_release:%{mariadb_release}}%{!?mariadb_release:%{mariadb_release_default}} +%define _mariadb_dist %{?mariadb_dist:%{mariadb_dist}}%{!?mariadb_dist:%{mariadb_dist_default}} +%define _mariadb_download_base_url %{?mariadb_download_base_url:%{mariadb_download_base_url}}%{!?mariadb_download_base_url:%{mariadb_download_base_url_default}} +%define _mariadb_spec_file %{?mariadb_spec_file:%{mariadb_spec_file}}%{!?mariadb_spec_file:%{mariadb_spec_file_default}} -%define mariadb_package_version %{mariadb_epoch}:%{mariadb_version}-%{mariadb_release}%{mariadb_dist} +%define _mariadb_package_version %{_mariadb_epoch}:%{_mariadb_version}-%{_mariadb_release}%{_mariadb_dist} %define groonga_required_version @REQUIRED_GROONGA_VERSION@ @@ -30,9 +30,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) BuildRequires: groonga-devel >= %{groonga_required_version} BuildRequires: groonga-normalizer-mysql-devel BuildRequires: wget -BuildRequires: mariadb-devel = %{mariadb_package_version} -Requires: mariadb-server = %{mariadb_package_version} -Requires: mariadb = %{mariadb_package_version} +BuildRequires: mariadb-devel = %{_mariadb_package_version} +Requires: mariadb-server = %{_mariadb_package_version} +Requires: mariadb = %{_mariadb_package_version} Requires: groonga-libs >= %{groonga_required_version} Requires: groonga-normalizer-mysql @@ -53,21 +53,21 @@ Documentation for Mroonga %prep %setup -q -n mroonga-%{version} -mariadb_full_version=%{mariadb_version}-%{mariadb_release}%{mariadb_dist} +mariadb_full_version=%{_mariadb_version}-%{_mariadb_release}%{_mariadb_dist} srpm=mariadb-${mariadb_full_version}.src.rpm if [ ! -f ../../SRPMS/$srpm ]; then - wget --continue -O ../../SRPMS/$srpm %{mariadb_download_base_url}/$srpm + wget --continue -O ../../SRPMS/$srpm %{_mariadb_download_base_url}/$srpm rpm -Uvh ../../SRPMS/$srpm rm ../../SRPMS/$srpm fi %build -mariadb_source=../mariadb-%{mariadb_version} +mariadb_source=../mariadb-%{_mariadb_version} if [ ! -d ${mariadb_source} ]; then rpmbuild -bc \ --define 'runselftest 0' \ --define 'optflags -O0' \ - ../../SPECS/%{mariadb_spec_file} + ../../SPECS/%{_mariadb_spec_file} fi %configure \ --disable-static \ @@ -86,7 +86,7 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/ rm -rf $RPM_BUILD_ROOT %post -if /usr/bin/mysql -u root -e "quit"; then +if /usr/bin/mysql -u root -e "quit" > /dev/null 2>&1; then password_option="" else password_option="-p" @@ -128,7 +128,7 @@ eval $command || \ %preun uninstall_sql=%{_datadir}/mroonga/uninstall.sql -if mysql -u root -e "quit"; then +if mysql -u root -e "quit" > /dev/null 2>&1; then password_option="" else password_option="-p" @@ -154,6 +154,84 @@ fi %doc mysql-mroonga-doc/* %changelog +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Fri Sep 15 2017 Kouhei Sutou - 7.06-2 +- rebuild against the latest MariaDB. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Wed Dec 16 2015 Kouhei Sutou - 5.10-2 +- rebuild against MariaDB on CentOS 7.2. Reported by Larry Kim. Thanks!!! + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + * Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 - new upstream release. diff --git a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in index e20e1b32162..8bd2ba540d3 100644 --- a/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in +++ b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in @@ -1,26 +1,26 @@ %{?scl:%scl_package mroonga} %{!?scl:%global pkg_name %{name}} -%{!?centos_ver:%define centos_ver 5} +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} -%if %{centos_ver} == 6 -%define mysql_version_default 5.5.41 -%define mysql_release_default 2 -%define mysql_dist_default el6.centos.alt -%define mysql_download_base_url_default http://vault.centos.org/6.6/SCL/Source/SPackages +%if %{_centos_ver} == 6 +%define mysql_version_default 5.5.52 +%define mysql_release_default 1 +%define mysql_dist_default el6 +%define mysql_download_base_url_default http://vault.centos.org/6.8/sclo/Source/rh/mysql55/ %define mysql_spec_file_default mysql.spec %else -%define mysql_version_default 5.5.40 -%define mysql_release_default 2 +%define mysql_version_default 5.5.45 +%define mysql_release_default 1 %define mysql_dist_default el5 %define mysql_download_base_url_default http://vault.centos.org/5.11/updates/SRPMS %define mysql_spec_file_default mysql.spec %endif -%{!?mysql_version:%define mysql_version %{mysql_version_default}} -%{!?mysql_release:%define mysql_release %{mysql_release_default}} -%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}} -%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}} -%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}} +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}} %define groonga_required_version @REQUIRED_GROONGA_VERSION@ @@ -39,10 +39,10 @@ BuildRequires: groonga-devel >= %{groonga_required_version} BuildRequires: groonga-normalizer-mysql-devel BuildRequires: wget BuildRequires: which -BuildRequires: mysql55-mysql-devel = %{mysql_version}-%{mysql_release}.%{mysql_dist} +BuildRequires: mysql55-mysql-devel = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} BuildRequires: mysql55-build -Requires: mysql55-mysql-server = %{mysql_version}-%{mysql_release}.%{mysql_dist} -Requires: mysql55-mysql = %{mysql_version}-%{mysql_release}.%{mysql_dist} +Requires: mysql55-mysql-server = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} +Requires: mysql55-mysql = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} Requires: groonga-libs >= %{groonga_required_version} Requires: groonga-normalizer-mysql %{?scl:Requires: %scl_runtime} @@ -64,21 +64,21 @@ Documentation for Mroonga %prep %setup -q -n %{pkg_name}-%{version} -mysql_full_version=%{mysql_version}-%{mysql_release}.%{mysql_dist} +mysql_full_version=%{_mysql_version}-%{_mysql_release}.%{_mysql_dist} srpm=mysql55-mysql-${mysql_full_version}.src.rpm if [ ! -f ../../SRPMS/$srpm ]; then - wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm + wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm rpm -Uvh ../../SRPMS/$srpm fi %build -mysql_source=../mysql-%{mysql_version} +mysql_source=../mysql-%{_mysql_version} if [ ! -d ${mysql_source} ]; then specs_dir= MYSQL_RPMBUILD_TEST=no rpmbuild -bp \ --define 'runselftest 0' \ --define 'optflags -O0' \ - ../../SPECS/%{mysql_spec_file} + ../../SPECS/%{_mysql_spec_file} fi %configure --disable-static --with-mysql-source=${mysql_source} \ --disable-fast-mutexes \ @@ -97,10 +97,10 @@ rm -rf $RPM_BUILD_ROOT %post mysql_command=`scl enable mysql55 'which mysql'` -password_option="" -$mysql_command -u root -e "quit" -if [ $? -ne 0 ]; then - password_option="-p" +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then + password_option="" +else + password_option="-p" fi current_version=0 version=`echo %{groonga_required_version} | sed -e 's/\.//g'` @@ -137,7 +137,7 @@ eval $command || \ %preun uninstall_sql=%{_datadir}/mroonga/uninstall.sql mysql_command=`scl enable mysql55 'which mysql'` -if $mysql_command -u root -e "quit"; then +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then password_option="" else password_option="-p" @@ -163,6 +163,87 @@ fi %doc mysql-mroonga-doc/* %changelog +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + * Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 - new upstream release. diff --git a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in index f3233d17afe..dea7cebc7d9 100644 --- a/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in +++ b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in @@ -1,24 +1,24 @@ -%{!?centos_ver:%define centos_ver 6} +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} -%if %{centos_ver} == 7 -%define mysql_version_default 5.6.25 +%if %{_centos_ver} == 7 +%define mysql_version_default 5.6.37 %define mysql_release_default 2 %define mysql_dist_default el7 %define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/7/SRPMS %define mysql_spec_file_default mysql.spec %else -%define mysql_version_default 5.6.25 +%define mysql_version_default 5.6.37 %define mysql_release_default 2 %define mysql_dist_default el6 %define mysql_download_base_url_default http://repo.mysql.com/yum/mysql-5.6-community/el/6/SRPMS %define mysql_spec_file_default mysql.spec %endif -%{!?mysql_version:%define mysql_version %{mysql_version_default}} -%{!?mysql_release:%define mysql_release %{mysql_release_default}} -%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}} -%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}} -%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}} +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}} %define groonga_required_version @REQUIRED_GROONGA_VERSION@ @@ -38,9 +38,10 @@ BuildRequires: groonga-normalizer-mysql-devel BuildRequires: wget BuildRequires: which BuildRequires: gcc, gcc-c++ -BuildRequires: mysql-community-devel = %{mysql_version}-%{mysql_release}.%{mysql_dist} -Requires: mysql-community-server = %{mysql_version}-%{mysql_release}.%{mysql_dist} -Requires: mysql-community-client = %{mysql_version}-%{mysql_release}.%{mysql_dist} +BuildRequires: numactl-devel +BuildRequires: mysql-community-devel = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} +Requires: mysql-community-server = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} +Requires: mysql-community-client = %{_mysql_version}-%{_mysql_release}.%{_mysql_dist} Requires: groonga-libs >= %{groonga_required_version} Requires: groonga-normalizer-mysql @@ -61,21 +62,21 @@ Documentation for Mroonga %prep %setup -q -n mroonga-%{version} -mysql_full_version=%{mysql_version}-%{mysql_release}.%{mysql_dist} +mysql_full_version=%{_mysql_version}-%{_mysql_release}.%{_mysql_dist} srpm=mysql-community-${mysql_full_version}.src.rpm if [ ! -f ../../SRPMS/$srpm ]; then - wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm + wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm rpm -Uvh ../../SRPMS/$srpm fi %build -mysql_source=../mysql-%{mysql_version}/mysql-%{mysql_version} +mysql_source=../mysql-%{_mysql_version}/mysql-%{_mysql_version} if [ ! -d ${mysql_source} ]; then specs_dir= MYSQL_RPMBUILD_TEST=no rpmbuild -bp \ --define 'runselftest 0' \ --define 'optflags -O0' \ - ../../SPECS/%{mysql_spec_file} + ../../SPECS/%{_mysql_spec_file} fi %configure \ --disable-static \ @@ -102,10 +103,10 @@ else fi mysql_command=`which mysql` -password_option="" -$mysql_command -u root -e "quit" -if [ $? -ne 0 ]; then - password_option="-p" +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then + password_option="" +else + password_option="-p" fi current_version=0 version=`echo %{groonga_required_version} | sed -e 's/\.//g'` @@ -153,7 +154,7 @@ fi uninstall_sql=%{_datadir}/mroonga/uninstall.sql mysql_command=`which mysql` -if $mysql_command -u root -e "quit"; then +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then password_option="" else password_option="-p" @@ -183,10 +184,118 @@ fi %doc mysql-mroonga-doc/* %changelog +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Wed Aug 23 2017 Kentaro Hayashi - 7.05-2 +- build against MySQL 5.6.37 on CentOS 7. Reported by Hiroshi Kagami. Thanks!!! + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Fri Jul 21 2017 Kentaro Hayashi - 7.04-2 +- build against MySQL 5.6.37 on CentOS 6. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Apr 12 2017 Kentaro Hayashi - 7.01-2 +- build against MySQL 5.6.36 Reported by @tigersun2000. Thanks!!! + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Mon Oct 24 2016 Kouhei Sutou - 6.09-2 +- build against MySQL 5.6.34. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Wed Sep 14 2016 Kentaro Hayashi - 6.08-2 +- build against MySQL 5.6.33. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Mon Jun 06 2016 Kouhei Sutou - 6.03-2 +- build against MySQL 5.6.30. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Wed Dec 09 2015 Kouhei Sutou - 5.10-2 +- build against MySQL 5.6.28. Reported by @stealthinu. Thanks!!! + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Sat Oct 03 2015 Kouhei Sutou - 5.08-2 +- build against MySQL 5.6.27. Reported by @star_orihime. Thanks!!! + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + * Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 - new upstream release. -* Thu Jun 02 2015 Masafumi Yokoyama - 5.03-2 +* Tue Jun 02 2015 Masafumi Yokoyama - 5.03-2 - build against MySQL 5.6.25. * Fri May 29 2015 HAYASHI Kentaro - 5.03-1 diff --git a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in index cf1947e2676..abf3bfdee9e 100644 --- a/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in +++ b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in @@ -1,16 +1,16 @@ -%{!?centos_ver:%define centos_ver 6} +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} -%define mysql_version_default 5.6.24 -%define mysql_release_default rel72.2 +%define mysql_version_default 5.6.37 +%define mysql_release_default rel82.2 %define mysql_dist_default %{?dist} -%define mysql_download_base_url_default http://repo.percona.com/centos/%{centos_ver}/SRPMS +%define mysql_download_base_url_default http://repo.percona.com/centos/%{_centos_ver}/SRPMS %define mysql_spec_file_default percona-server.spec -%{!?mysql_version:%define mysql_version %{mysql_version_default}} -%{!?mysql_release:%define mysql_release %{mysql_release_default}} -%{!?mysql_dist:%define mysql_dist %{mysql_dist_default}} -%{!?mysql_download_base_url:%define mysql_download_base_url %{mysql_download_base_url_default}} -%{!?mysql_spec_file:%define mysql_spec_file %{mysql_spec_file_default}} +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?mysql_spec_file:%{mysql_spec_file_default}} %define groonga_required_version @REQUIRED_GROONGA_VERSION@ @@ -31,10 +31,10 @@ BuildRequires: wget BuildRequires: which BuildRequires: gcc BuildRequires: gcc-c++ -BuildRequires: Percona-Server-devel-56 = %{mysql_version}-%{mysql_release}%{mysql_dist} +BuildRequires: Percona-Server-devel-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist} BuildRequires: selinux-policy-devel -Requires: Percona-Server-server-56 = %{mysql_version}-%{mysql_release}%{mysql_dist} -Requires: Percona-Server-client-56 = %{mysql_version}-%{mysql_release}%{mysql_dist} +Requires: Percona-Server-server-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist} +Requires: Percona-Server-client-56 = %{_mysql_version}-%{_mysql_release}%{_mysql_dist} Requires: groonga-libs >= %{groonga_required_version} Requires: groonga-normalizer-mysql @@ -55,23 +55,26 @@ Documentation for Mroonga %prep %setup -q -n mroonga-%{version} -mysql_full_version=%{mysql_version}-%{mysql_release}.generic +mysql_full_version=%{_mysql_version}-%{_mysql_release}.generic srpm=Percona-Server-56-${mysql_full_version}.src.rpm if [ ! -f ../../SRPMS/$srpm ]; then - wget --continue -O ../../SRPMS/$srpm %{mysql_download_base_url}/$srpm + wget --continue -O ../../SRPMS/$srpm %{_mysql_download_base_url}/$srpm rpm -Uvh ../../SRPMS/$srpm fi %build -mysql_source=../percona-server-%{mysql_version}-$(echo %{mysql_release} | sed -e 's/rel//') +mysql_source=../percona-server-%{_mysql_version}-$(echo %{_mysql_release} | sed -e 's/rel//') if [ ! -d ${mysql_source} ]; then specs_dir= rpmbuild -bp \ --define 'runselftest 0' \ --define 'optflags -O0' \ - ../../SPECS/%{mysql_spec_file} + ../../SPECS/%{_mysql_spec_file} fi -%configure --disable-static --with-mysql-source=${mysql_source} \ +%configure \ + --disable-static \ + --with-mysql-source=${mysql_source} \ + --enable-fast-mutexes \ %{?mroonga_configure_options} make %{?_smp_mflags} @@ -94,9 +97,11 @@ fi mysql_command=`which mysql` password_option="" -$mysql_command -u root -e "quit" -if [ $? -ne 0 ]; then - password_option="-p" + +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then + password_option="" +else + password_option="-p" fi current_version=0 version=`echo %{groonga_required_version} | sed -e 's/\.//g'` @@ -144,7 +149,7 @@ fi uninstall_sql=%{_datadir}/mroonga/uninstall.sql mysql_command=`which mysql` -if $mysql_command -u root -e "quit"; then +if $mysql_command -u root -e "quit" > /dev/null 2>&1; then password_option="" else password_option="-p" @@ -174,5 +179,95 @@ fi %doc mysql-mroonga-doc/* %changelog +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Mon Aug 14 2017 Kentaro Hayashi - 7.05-2 +- build against Percona Server 5.6.36rel82.1 Reported by @tigersun2000_twitter. Thanks!!! + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Thu May 17 2017 Kentaro Hayashi - 7.02-2 +- build against Percona Server 5.6.36. Reported by @pinpikokun. Thanks!!! + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Mon Oct 24 2016 Kouhei Sutou - 6.09-2 +- build against Percona Server 5.6.33. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + * Tue Mar 17 2015 Kouhei Sutou - 5.00-1 - initial release. diff --git a/storage/mroonga/packages/source/Makefile.am b/storage/mroonga/packages/source/Makefile.am index 143f5d0387e..efd09777add 100644 --- a/storage/mroonga/packages/source/Makefile.am +++ b/storage/mroonga/packages/source/Makefile.am @@ -1,17 +1,17 @@ MROONGA_BASE = $(PACKAGE)-$(VERSION) MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz -GROONGA_VERSION = 5.0.5 +GROONGA_VERSION = 7.0.7 GROONGA_BASE = groonga-$(GROONGA_VERSION) GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz -GROONGA_NORMALIZER_MYSQL_VERSION = 1.1.0 +GROONGA_NORMALIZER_MYSQL_VERSION = 1.1.1 GROONGA_NORMALIZER_MYSQL_BASE = \ groonga-normalizer-mysql-$(GROONGA_NORMALIZER_MYSQL_VERSION) GROONGA_NORMALIZER_MYSQL_TAR_GZ = \ $(GROONGA_NORMALIZER_MYSQL_BASE).tar.gz -MARIADB_VERSION = 10.0.20 +MARIADB_VERSION = 10.1.28 MARIADB_BASE = mariadb-$(MARIADB_VERSION) MARIADB_TAR_GZ = $(MARIADB_BASE).tar.gz @@ -29,7 +29,7 @@ CURL = curl --fail --silent --show-error all: -release: archive upload +release: download archive upload ensure-rsync-path: @if test -z "$(RSYNC_PATH)"; then \ @@ -88,6 +88,8 @@ tmp/$(MARIADB_WITH_MROONGA_BASE).stamp: $(MARIADB_WITH_MROONGA_ARCHIVES) mkdir -p $$(dirname $(BUNDLED_GROONGA_PATH)) tar xf tmp/$(GROONGA_TAR_GZ) rm -rf $(GROONGA_BASE)/test + cd $(GROONGA_BASE)/vendor && ruby download_mecab.rb + cd $(GROONGA_BASE)/vendor && ruby download_lz4.rb mv $(GROONGA_BASE) $(BUNDLED_GROONGA_PATH) tar xf tmp/$(GROONGA_NORMALIZER_MYSQL_TAR_GZ) @@ -103,7 +105,7 @@ files/$(MARIADB_WITH_MROONGA_BASE).tar.gz: tmp/$(MARIADB_WITH_MROONGA_BASE).stam mkdir -p files/ (cd tmp && tar czf ../$@ $(MARIADB_WITH_MROONGA_BASE)) -PATCHES = \ +PATCHES = \ patches/mariadb-10.0.3-windows-build.diff tmp/$(MARIADB_WITH_MROONGA_FOR_WINDOWS_BASE).stamp: tmp/$(MARIADB_WITH_MROONGA_BASE).stamp $(PATCHES) diff --git a/storage/mroonga/packages/ubuntu/Makefile.am b/storage/mroonga/packages/ubuntu/Makefile.am index 2297a50bfc9..7241391bcbf 100644 --- a/storage/mroonga/packages/ubuntu/Makefile.am +++ b/storage/mroonga/packages/ubuntu/Makefile.am @@ -1,5 +1,13 @@ -CODE_NAMES = precise,trusty,utopic,vivid +CODE_NAMES = trusty,xenial,zesty SOURCE = ../$(PACKAGE)-$(VERSION).tar.gz +SOURCE_55_BASE = $(PACKAGE)-5.5 +SOURCE_55 = $(SOURCE_55_BASE)_$(VERSION).orig.tar.gz +SOURCE_56_BASE = $(PACKAGE)-5.6 +SOURCE_56 = $(SOURCE_56_BASE)_$(VERSION).orig.tar.gz +SOURCE_57_BASE = $(PACKAGE)-5.7 +SOURCE_57 = $(SOURCE_57_BASE)_$(VERSION).orig.tar.gz +SOURCE_MARIADB_10_0_BASE = $(PACKAGE)-mariadb-10.0 +SOURCE_MARIADB_10_0 = $(SOURCE_MARIADB_10_0_BASE)_$(VERSION).orig.tar.gz all: @@ -13,12 +21,37 @@ upload: source ensure-launchpad-configuration ./upload.rb \ --package '$(PACKAGE)' \ --version '$(VERSION)' \ - --source-archive '$(SOURCE)' \ + --source-archive-directory '$(builddir)/' \ --code-names '$(CODE_NAMES)' \ - --debian-directory '$(srcdir)/../debian/' \ + --debian-base-directory '$(srcdir)/../' \ + --ppa '$(LAUNCHPAD_PPA)' \ --pgp-sign-key '$(LAUNCHPAD_UPLOADER_PGP_KEY)' -source: $(SOURCE) +source: $(SOURCE_55) $(SOURCE_56) $(SOURCE_57) $(SOURCE_MARIADB_10_0) $(SOURCE): ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $(SOURCE) + +$(SOURCE_55): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_55_BASE)-$(VERSION) + tar cfz $(SOURCE_55) $(SOURCE_55_BASE)-$(VERSION) + rm -r $(SOURCE_55_BASE)-$(VERSION) + +$(SOURCE_56): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_56_BASE)-$(VERSION) + tar cfz $(SOURCE_56) $(SOURCE_56_BASE)-$(VERSION) + rm -r $(SOURCE_56_BASE)-$(VERSION) + +$(SOURCE_57): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_57_BASE)-$(VERSION) + tar cfz $(SOURCE_57) $(SOURCE_57_BASE)-$(VERSION) + rm -r $(SOURCE_57_BASE)-$(VERSION) + +$(SOURCE_MARIADB_10_0): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) + tar cfz $(SOURCE_MARIADB_10_0) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) + rm -r $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) diff --git a/storage/mroonga/packages/ubuntu/upload.rb b/storage/mroonga/packages/ubuntu/upload.rb index 8743520b5ac..1fedb2ecbe6 100755 --- a/storage/mroonga/packages/ubuntu/upload.rb +++ b/storage/mroonga/packages/ubuntu/upload.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014-2016 Kouhei Sutou # Copyright(C) 2014 HAYASHI Kentaro # # This library is free software; you can redistribute it and/or @@ -24,6 +24,7 @@ require "open-uri" class Uploader def initialize @dput_configuration_name = "groonga-ppa" + @use_pbuilder = false end def run @@ -36,7 +37,22 @@ class Uploader @required_groonga_version = required_groonga_version @code_names.each do |code_name| - upload(code_name) + mysql55_version = @mysql55_versions[code_name] + mysql56_version = @mysql56_versions[code_name] + mysql57_version = @mysql57_versions[code_name] + mariadb10_0_version = @mariadb10_0_versions[code_name] + if mysql55_version + upload(code_name, "5.5", mysql55_version) + end + if mysql56_version + upload(code_name, "5.6", mysql56_version) + end + if mysql57_version + upload(code_name, "5.7", mysql57_version) + end + if mariadb10_0_version + upload(code_name, "mariadb-10.0", mariadb10_0_version) + end end end @@ -66,18 +82,37 @@ allow_unsigned_uploads = 0 end def ensure_mysql_version - @mysql_version = {} + @mysql_versions = {} + @mysql55_versions = {} + @mysql56_versions = {} + @mysql57_versions = {} + @mariadb10_0_versions = {} @code_names.each do |code_name| - open("http://packages.ubuntu.com/#{code_name}/allpackages?format=txt.gz") do |file| - file.each_line do |line| - @mysql_version[code_name] = $1 if line =~ /\Amysql-server \((.+?)\).+/ + source_names = [code_name, "#{code_name}-updates"] + source_names.each do |source_name| + allpackages_url = + "http://packages.ubuntu.com/#{source_name}/allpackages?format=txt.gz" + open(allpackages_url) do |file| + file.each_line do |line| + case line + when /\Amysql-server \((.+?)[\s)]/ + @mysql_versions[code_name] = $1 + when /\Amysql-server-5\.5 \((.+?)[\s)]/ + @mysql55_versions[code_name] = $1 + when /\Amysql-server-5\.6 \((.+?)[\s)]/ + @mysql56_versions[code_name] = $1 + when /\Amysql-server-5\.7 \((.+?)[\s)]/ + @mysql57_versions[code_name] = $1 + when /\Amariadb-server-10\.0 \((.+?)[\s)]/ + @mariadb10_0_versions[code_name] = $1 + end + end end end end end def parse_command_line! - parser = OptionParser.new parser.on("--package=NAME", "The package name") do |name| @@ -87,59 +122,97 @@ allow_unsigned_uploads = 0 "The version") do |version| @version = version end - parser.on("--source-archive=ARCHIVE", - "The source archive") do |source_archive| - @source_archive = Pathname.new(source_archive).expand_path + parser.on("--source-archive-directory=DIRECTORY", + "The directory that has source archives") do |directory| + @source_archive_directory = Pathname.new(directory).expand_path end parser.on("--code-names=CODE_NAME1,CODE_NAME2,CODE_NAME3,...", Array, "The target code names") do |code_names| @code_names = code_names end - parser.on("--debian-directory=DIRECTORY", - "The debian/ directory") do |debian_directory| - @debian_directory = Pathname.new(debian_directory).expand_path + parser.on("--debian-base-directory=DIRECTORY", + "The directory that has debianXX/ directory") do |directory| + @debian_base_directory = Pathname.new(directory).expand_path + end + parser.on("--ppa=PPA", + "The personal package archive name (groonga-ppa or groonga-nightly") do |ppa| + @dput_configuration_name = ppa end parser.on("--pgp-sign-key=KEY", "The PGP key to sign .changes and .dsc") do |pgp_sign_key| @pgp_sign_key = pgp_sign_key end - parser.on("--pbuilder", - "Use pbuilder for build check") do |pbuilder| - @use_pbuilder = pbuilder + parser.on("--[no-]pbuilder", + "Use pbuilder for build check") do |use_pbuilder| + @use_pbuilder = use_pbuilder end parser.parse! end - def upload(code_name) + def upload(code_name, mysql_short_version, mysql_version) + default_mysql_version = (@mysql_versions[code_name] == mysql_version) + deb_package_name = "#{@package}-#{mysql_short_version}" in_temporary_directory do - FileUtils.cp(@source_archive.to_s, - "#{@package}_#{@version}.orig.tar.gz") - run_command("tar", "xf", @source_archive.to_s) - directory_name = "#{@package}-#{@version}" + source_archive = + @source_archive_directory + "#{deb_package_name}_#{@version}.orig.tar.gz" + run_command("tar", "xf", source_archive.to_s) + directory_name = "#{deb_package_name}-#{@version}" Dir.chdir(directory_name) do - FileUtils.cp_r(@debian_directory.to_s, "debian") + debian_directory = + @debian_base_directory + "debian-#{mysql_short_version}" + FileUtils.cp_r(debian_directory.to_s, "debian") deb_version = "#{current_deb_version.succ}~#{code_name}1" run_command("dch", "--distribution", code_name, "--newversion", deb_version, "Build for #{code_name}.") - case code_name - when "vivid" - run_command("sed", - "-i", "-e", "s,5\\.5,5.6,g", - "debian/rules") + remove_versionless_mroonga = true + if default_mysql_version or mysql_short_version.start_with?("mariadb-") + remove_versionless_mroonga = false + end + if remove_versionless_mroonga + control_content = File.read("debian/control") + File.open("debian/control", "w") do |control| + in_mysql_server_mroonga = false + control_content.each_line do |line| + case line.chomp + when "" + if in_mysql_server_mroonga + in_mysql_server_mroonga = false + else + control.print(line) + end + when "Package: mysql-server-mroonga" + in_mysql_server_mroonga = true + else + next if in_mysql_server_mroonga + control.print(line) + end + end + end end run_command("sed", - "-i", "-e", "s,MYSQL_VERSION,#{@mysql_version[code_name]},", + "-i", "-e", + "s,MYSQL_VERSION\\|MARIADB_VERSION,#{mysql_version},", "debian/control") - run_command("debuild", "-S", "-sa", "-pgpg2", "-k#{@pgp_sign_key}") + run_command("debuild", + "--no-lintian", + # Workaround for Launchpad. Launchpad doesn't accept + # .buildinfo yet. + # See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853795 + "--buildinfo-option=-O", + "-d", + "-S", + "-sa", + "-pgpg2", + "-k#{@pgp_sign_key}") if @use_pbuilder run_command("pbuilder-dist", code_name, "build", - "../#{@package}_#{deb_version}.dsc") + "../#{deb_package_name}_#{deb_version}.dsc") else run_command("dput", @dput_configuration_name, - "../#{@package}_#{deb_version}_source.changes") + "../#{deb_package_name}_#{deb_version}_source.changes") end end end diff --git a/storage/mroonga/packages/windows/Makefile.am b/storage/mroonga/packages/windows/Makefile.am index 192709fac6d..240c3873a89 100644 --- a/storage/mroonga/packages/windows/Makefile.am +++ b/storage/mroonga/packages/windows/Makefile.am @@ -1,12 +1,12 @@ EXTRA_DIST = \ README.md \ - build-vc2013.bat \ - build-vc2013-zip-32.bat \ - build-vc2013-zip-64.bat \ - build-vc2013-msi-32.bat \ - build-vc2013-msi-64.bat \ build-vc2015.bat \ build-vc2015-zip-32.bat \ build-vc2015-zip-64.bat \ build-vc2015-msi-32.bat \ - build-vc2015-msi-64.bat + build-vc2015-msi-64.bat \ + build-vc2017.bat \ + build-vc2017-zip-32.bat \ + build-vc2017-zip-64.bat \ + build-vc2017-msi-32.bat \ + build-vc2017-msi-64.bat diff --git a/storage/mroonga/packages/windows/README.md b/storage/mroonga/packages/windows/README.md index f220634b1e7..8737f26232a 100644 --- a/storage/mroonga/packages/windows/README.md +++ b/storage/mroonga/packages/windows/README.md @@ -6,16 +6,16 @@ TODO... ## Build with Visual C++ Express -You need to use Visual C++ 2013 or later to build Mroonga with Express -edition. `build-vc2013.bat` is a build batch script to build with -Visual C++ Express 2013. +You need to use Visual Studio 2015 for Windows Desktop or later to build Mroonga with express +edition. `build-vc2015.bat` is a build batch script to build with +Visual Studio 2015 for Windows Desktop. Note that you can't build MSI file with Express edition. You need to use Professional edition or upper editions to build MSI file. -## Build with Visual C++ Professional +## Build with Visual Studio Community You can build both zip file MSI file with Professional edition. But now, this feature is temporary disabled. -If you want to create MSI package, please uncomment in `build-vc2013.bat`. -And then, you can build MSI package with Visual Studio 2013 Professional. +If you want to create MSI package, please uncomment in `build-vc2015.bat`. +And then, you can build MSI package with Visual Studio 2015 Community. diff --git a/storage/mroonga/packages/windows/build-vc2013-msi-32.bat b/storage/mroonga/packages/windows/build-vc2013-msi-32.bat deleted file mode 100644 index 22b29972885..00000000000 --- a/storage/mroonga/packages/windows/build-vc2013-msi-32.bat +++ /dev/null @@ -1,8 +0,0 @@ -rmdir /S /Q build-vc2013-msi-32 -mkdir build-vc2013-msi-32 -cd build-vc2013-msi-32 -cmake ..\source -G "Visual Studio 12" > config.log -cmake --build . --config RelWithDebInfo > build.log -cmake --build . --config RelWithDebInfo --target msi > msi.log -move *.msi ..\ -cd .. diff --git a/storage/mroonga/packages/windows/build-vc2013-msi-64.bat b/storage/mroonga/packages/windows/build-vc2013-msi-64.bat deleted file mode 100644 index c83a376cdb9..00000000000 --- a/storage/mroonga/packages/windows/build-vc2013-msi-64.bat +++ /dev/null @@ -1,8 +0,0 @@ -rmdir /S /Q build-vc2013-msi-64 -mkdir build-vc2013-msi-64 -cd build-vc2013-msi-64 -cmake ..\source -G "Visual Studio 12 Win64" > config.log -cmake --build . --config RelWithDebInfo > build.log -cmake --build . --config RelWithDebInfo --target msi > msi.log -move *.msi ..\ -cd .. diff --git a/storage/mroonga/packages/windows/build-vc2013-zip-32.bat b/storage/mroonga/packages/windows/build-vc2013-zip-32.bat deleted file mode 100644 index d3e0e4f8b8e..00000000000 --- a/storage/mroonga/packages/windows/build-vc2013-zip-32.bat +++ /dev/null @@ -1,8 +0,0 @@ -rmdir /S /Q build-vc2013-zip-32 -mkdir build-vc2013-zip-32 -cd build-vc2013-zip-32 -cmake ..\source -G "Visual Studio 12" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log -cmake --build . --config RelWithDebInfo > build.log -cmake --build . --config RelWithDebInfo --target package > zip.log -move *.zip ..\ -cd .. diff --git a/storage/mroonga/packages/windows/build-vc2013-zip-64.bat b/storage/mroonga/packages/windows/build-vc2013-zip-64.bat deleted file mode 100644 index 6ca288b6a8b..00000000000 --- a/storage/mroonga/packages/windows/build-vc2013-zip-64.bat +++ /dev/null @@ -1,8 +0,0 @@ -rmdir /S /Q build-vc2013-zip-64 -mkdir build-vc2013-zip-64 -cd build-vc2013-zip-64 -cmake ..\source -G "Visual Studio 12 Win64" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log -cmake --build . --config RelWithDebInfo > build.log -cmake --build . --config RelWithDebInfo --target package > zip.log -move *.zip ..\ -cd .. diff --git a/storage/mroonga/packages/windows/build-vc2013.bat b/storage/mroonga/packages/windows/build-vc2013.bat deleted file mode 100644 index 99d7e4042c5..00000000000 --- a/storage/mroonga/packages/windows/build-vc2013.bat +++ /dev/null @@ -1,4 +0,0 @@ -build-vc2013-zip-32.bat -build-vc2013-zip-64.bat -REM build-vc2013-msi-32.bat -REM build-vc2013-msi-64.bat diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-32.bat b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat index 4c92b5c02cc..69d803e84fe 100644 --- a/storage/mroonga/packages/windows/build-vc2015-msi-32.bat +++ b/storage/mroonga/packages/windows/build-vc2015-msi-32.bat @@ -1,7 +1,7 @@ rmdir /S /Q build-vc2015-msi-32 mkdir build-vc2015-msi-32 cd build-vc2015-msi-32 -cmake ..\source -G "Visual Studio 14" > config.log +cmake ..\source -G "Visual Studio 14 2015" > config.log cmake --build . --config RelWithDebInfo > build.log cmake --build . --config RelWithDebInfo --target msi > msi.log move *.msi ..\ diff --git a/storage/mroonga/packages/windows/build-vc2015-msi-64.bat b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat index 82bc2a148ec..a3d6681bf3b 100644 --- a/storage/mroonga/packages/windows/build-vc2015-msi-64.bat +++ b/storage/mroonga/packages/windows/build-vc2015-msi-64.bat @@ -1,7 +1,7 @@ rmdir /S /Q build-vc2015-msi-64 mkdir build-vc2015-msi-64 cd build-vc2015-msi-64 -cmake ..\source -G "Visual Studio 14 Win64" > config.log +cmake ..\source -G "Visual Studio 14 2015 Win64" > config.log cmake --build . --config RelWithDebInfo > build.log cmake --build . --config RelWithDebInfo --target msi > msi.log move *.msi ..\ diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-32.bat b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat index 5cef259afe5..8247fd542f3 100644 --- a/storage/mroonga/packages/windows/build-vc2015-zip-32.bat +++ b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat @@ -1,7 +1,12 @@ rmdir /S /Q build-vc2015-zip-32 mkdir build-vc2015-zip-32 cd build-vc2015-zip-32 -cmake ..\source -G "Visual Studio 14" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log +cmake ..\source -G "Visual Studio 14 2015" ^ + -DMRN_GROONGA_EMBED=OFF ^ + -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^ + -DGRN_WITH_BUNDLED_LZ4=ON ^ + -DGRN_WITH_BUNDLED_MECAB=ON ^ + > config.log cmake --build . --config RelWithDebInfo > build.log cmake --build . --config RelWithDebInfo --target package > zip.log move *.zip ..\ diff --git a/storage/mroonga/packages/windows/build-vc2015-zip-64.bat b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat index caabca179e7..b56d80eb151 100644 --- a/storage/mroonga/packages/windows/build-vc2015-zip-64.bat +++ b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat @@ -1,7 +1,12 @@ rmdir /S /Q build-vc2015-zip-64 mkdir build-vc2015-zip-64 cd build-vc2015-zip-64 -cmake ..\source -G "Visual Studio 14 Win64" -DMRN_GROONGA_EMBED=OFF -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF > config.log +cmake ..\source -G "Visual Studio 14 2015 Win64" ^ + -DMRN_GROONGA_EMBED=OFF ^ + -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^ + -DGRN_WITH_BUNDLED_LZ4=ON ^ + -DGRN_WITH_BUNDLED_MECAB=ON ^ + > config.log cmake --build . --config RelWithDebInfo > build.log cmake --build . --config RelWithDebInfo --target package > zip.log move *.zip ..\ diff --git a/storage/mroonga/packages/windows/build-vc2015.bat b/storage/mroonga/packages/windows/build-vc2015.bat index f9ac1765792..729f181dbe3 100644 --- a/storage/mroonga/packages/windows/build-vc2015.bat +++ b/storage/mroonga/packages/windows/build-vc2015.bat @@ -1,4 +1,4 @@ -build-vc2015-zip-32.bat -build-vc2015-zip-64.bat +call build-vc2015-zip-32.bat +call build-vc2015-zip-64.bat REM build-vc2015-msi-32.bat REM build-vc2015--msi-64.bat diff --git a/storage/mroonga/packages/yum/Makefile.am b/storage/mroonga/packages/yum/Makefile.am index 8321619868f..9d1bd6061c6 100644 --- a/storage/mroonga/packages/yum/Makefile.am +++ b/storage/mroonga/packages/yum/Makefile.am @@ -1,7 +1,16 @@ REPOSITORIES_PATH = repositories DISTRIBUTIONS = centos ARCHITECTURES = i386 x86_64 -MYSQL_VARIANTS = mysql55 mysql56-community mariadb percona-server-56 +MYSQL_VARIANTS = \ + mysql55 \ + mysql56-community \ + mysql57-community \ + mariadb \ + mariadb-10.1 \ + mariadb-10.2 \ + percona-server-56 \ + percona-server-57 +CENTOS_VERSIONS = 6 7 SPEC_DIR = $(builddir)/../rpm/centos all: @@ -47,7 +56,8 @@ build-in-vm: source specs env.sh "$(PACKAGE)" \ "$(SPEC_DIR)" \ "$(MYSQL_VARIANTS)" \ - "$(ARCHITECTURES)" + "$(ARCHITECTURES)" \ + "$(CENTOS_VERSIONS)" source: tmp/$(PACKAGE)-$(VERSION).tar.gz @@ -61,4 +71,7 @@ $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz: specs: $(SPEC_DIR)/mysql55-$(PACKAGE).spec specs: $(SPEC_DIR)/mysql56-community-$(PACKAGE).spec specs: $(SPEC_DIR)/mariadb-$(PACKAGE).spec +specs: $(SPEC_DIR)/mariadb-10.1-$(PACKAGE).spec +specs: $(SPEC_DIR)/mariadb-10.2-$(PACKAGE).spec specs: $(SPEC_DIR)/percona-server-56-$(PACKAGE).spec +specs: $(SPEC_DIR)/percona-server-57-$(PACKAGE).spec diff --git a/storage/mroonga/packages/yum/Vagrantfile b/storage/mroonga/packages/yum/Vagrantfile index da41350eed3..af14bc9a76b 100644 --- a/storage/mroonga/packages/yum/Vagrantfile +++ b/storage/mroonga/packages/yum/Vagrantfile @@ -6,32 +6,23 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vms = [ - { - :id => "centos-5-i386", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11-i386_chef-provisionerless.box", - }, - { - :id => "centos-5-x86_64", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.11_chef-provisionerless.box", - }, { :id => "centos-6-i386", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6-i386_chef-provisionerless.box", + :box => "bento/centos-6.9-i386", }, { :id => "centos-6-x86_64", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.6_chef-provisionerless.box", + :box => "bento/centos-6.9", }, { :id => "centos-7-x86_64", - :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.1_chef-provisionerless.box", + :box => "bento/centos-7.4", }, ] vms.each do |vm| config.vm.define(vm[:id]) do |node| - node.vm.box = vm[:id] - node.vm.box_url = vm[:box_url] + node.vm.box = vm[:box] node.vm.provision(:shell, :path => "build-rpm.sh") node.vm.provider("virtualbox") do |virtual_box| system_n_cpus = 1 @@ -44,6 +35,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vm_n_cpus = 1 end virtual_box.cpus = vm_n_cpus + virtual_box.memory = (ENV["VM_MEMORY"] || 1024).to_i end end end diff --git a/storage/mroonga/packages/yum/build-in-vm.sh b/storage/mroonga/packages/yum/build-in-vm.sh index cf9ef581fd0..fc84e45024c 100755 --- a/storage/mroonga/packages/yum/build-in-vm.sh +++ b/storage/mroonga/packages/yum/build-in-vm.sh @@ -1,8 +1,8 @@ #!/bin/sh -if [ $# != 4 ]; then +if [ $# != 5 ]; then echo "Usage: $0 PACKAGE SPEC_DIR MYSQL_VARIANTS ARCHITECTURES" - echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64'" + echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64' '6 7'" exit 1 fi @@ -10,6 +10,7 @@ PACKAGE="$1" SPEC_DIR="$2" MYSQL_VARIANTS="$3" ARCHITECTURES="$4" +CENTOS_VERSIONS="$5" run() { @@ -30,21 +31,42 @@ for mysql_variant in ${MYSQL_VARIANTS}; do architectures="${ARCHITECTURES}" case ${mysql_variant} in mysql55) - centos_versions="5 6" + centos_versions="6" ;; mysql56-community) centos_versions="6 7" ;; + mysql57-community) + centos_versions="6 7" + ;; mariadb) centos_versions="7" ;; + mariadb-10.1) + centos_versions="6 7" + ;; + mariadb-10.2) + centos_versions="6 7" + ;; percona-server-56) centos_versions="6 7" ;; + percona-server-57) + centos_versions="6 7" + ;; esac for architecture in ${architectures}; do for centos_version in ${centos_versions}; do + skip=1 + for given_version in ${CENTOS_VERSIONS}; do + if [ ${given_version} = ${centos_version} ]; then + skip=0 + fi + done + if [ $skip -eq 1 ]; then + continue + fi if [ ${mysql_variant} = mysql55 -a ${centos_version} = 6 -a ${architecture} = i386 ]; then continue fi diff --git a/storage/mroonga/packages/yum/build-rpm.sh b/storage/mroonga/packages/yum/build-rpm.sh index 8661e659390..6ba943ae74d 100755 --- a/storage/mroonga/packages/yum/build-rpm.sh +++ b/storage/mroonga/packages/yum/build-rpm.sh @@ -70,36 +70,94 @@ case ${distribution} in run yum install -y mariadb-devel ;; centos) + release_rpm=groonga-release-1.3.0-1.noarch.rpm + if [ ${distribution_version} = 5 ]; then + wget http://packages.groonga.org/${distribution}/${release_rpm} + run yum install -y --nogpgcheck ${release_rpm} + rm -f ${release_rpm} + else + run yum install -y \ + http://packages.groonga.org/${distribution}/${release_rpm} + fi + run yum makecache + case ${package_name} in mysql55-${PACKAGE}) USE_MYSQLSERVICES_COMPAT=yes run yum install -y scl-utils-build if [ ${distribution_version} = 6 ]; then - run yum install -y centos-release-SCL + run yum install -y centos-release-scl fi run yum install -y mysql55-mysql-devel mysql55-build ;; - mysql56-community-${PACKAGE}) - release_rpm=mysql-community-release-el${distribution_version}-5.noarch.rpm + mysql5?-community-${PACKAGE}) + release_rpm=mysql-community-release-el${distribution_version}-7.noarch.rpm run yum -y install http://repo.mysql.com/${release_rpm} - run yum -y install mysql-community-devel + if [ "${package_name}" = "mysql57-community-${PACKAGE}" ]; then + run yum install -y yum-utils + run yum-config-manager --disable mysql56-community + run yum-config-manager --enable mysql57-community + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + fi + run yum install -y mysql-community-devel ;; mariadb-${PACKAGE}) - run yum -y install mariadb-devel - ;; + run yum install -y mariadb-devel + ;; + mariadb-10.1-${PACKAGE}) + if [ "${architecture}" = "x86_64" ]; then + mariadb_architecture="amd64" + else + mariadb_architecture="x86" + fi + cat < /etc/yum.repos.d/MariaDB.repo +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/${distribution}${distribution_version}-${mariadb_architecture} +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +REPO + run yum install -y MariaDB-devel + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + ;; + mariadb-10.2-${PACKAGE}) + if [ "${architecture}" = "x86_64" ]; then + mariadb_architecture="amd64" + else + mariadb_architecture="x86" + fi + cat < /etc/yum.repos.d/MariaDB.repo +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.2/${distribution}${distribution_version}-${mariadb_architecture} +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +REPO + run yum install -y MariaDB-devel + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + ;; percona-server-56-${PACKAGE}) - release_rpm_version=0.1-3 + release_rpm_version=0.1-4 release_rpm=percona-release-${release_rpm_version}.noarch.rpm - run yum -y install http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm} - run yum -y install Percona-Server-devel-56 + run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm} + run yum install -y Percona-Server-devel-56 + ;; + percona-server-57-${PACKAGE}) + release_rpm_version=0.1-4 + release_rpm=percona-release-${release_rpm_version}.noarch.rpm + run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm} + run yum install -y Percona-Server-devel-57 + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi ;; esac - - release_rpm=groonga-release-1.1.0-1.noarch.rpm - wget http://packages.groonga.org/${distribution}/${release_rpm} - run rpm -U ${release_rpm} - rm -f ${release_rpm} - run yum makecache ;; esac run yum install -y ${DEPENDED_PACKAGES} @@ -109,6 +167,11 @@ if [ "${package_name}" = "percona-server-56-${PACKAGE}" ]; then rpmbuild_options="$rpmbuild_options --define 'dist .el7'" fi fi +if [ "${package_name}" = "percona-server-57-${PACKAGE}" ]; then + if [ "${distribution_version}" = "7" ]; then + rpmbuild_options="$rpmbuild_options --define 'dist .el7'" + fi +fi if [ "${USE_MYSQLSERVICES_COMPAT}" = "yes" ]; then rpmbuild_options="$rpmbuild_options --define 'mroonga_configure_options --with-libmysqlservices-compat'" fi diff --git a/storage/mroonga/packages/yum/env.sh.in b/storage/mroonga/packages/yum/env.sh.in index 8c6d05baf5c..3d327a17efb 100644 --- a/storage/mroonga/packages/yum/env.sh.in +++ b/storage/mroonga/packages/yum/env.sh.in @@ -9,6 +9,7 @@ make gperf readline-devel openssl-devel +zlib-devel time wget ncurses-devel @@ -23,6 +24,9 @@ perl-Env perl-Test-Simple pam-devel selinux-policy-devel +numactl-devel groonga-devel groonga-normalizer-mysql-devel +cyrus-sasl-devel +openldap-devel " diff --git a/storage/mroonga/packages/yum/update-repository.sh b/storage/mroonga/packages/yum/update-repository.sh index 630b6c87422..59eeafa55aa 100755 --- a/storage/mroonga/packages/yum/update-repository.sh +++ b/storage/mroonga/packages/yum/update-repository.sh @@ -22,8 +22,6 @@ run() for distribution in ${DISTRIBUTIONS}; do for dir in ${DESTINATION}${distribution}/*/*; do - # "--checksum sha" is for CentOS 5. If we drop CentOS 5 support, - # we can remove the option. - test -d $dir && run createrepo --checksum sha $dir + test -d $dir && run createrepo $dir done; done diff --git a/storage/mroonga/plugin_version b/storage/mroonga/plugin_version index 48c32b26a12..120096f1f8f 100644 --- a/storage/mroonga/plugin_version +++ b/storage/mroonga/plugin_version @@ -1 +1 @@ -5.4 \ No newline at end of file +7.7 \ No newline at end of file diff --git a/storage/mroonga/required_groonga_version b/storage/mroonga/required_groonga_version index a1ef0cae183..024b4b9b53a 100644 --- a/storage/mroonga/required_groonga_version +++ b/storage/mroonga/required_groonga_version @@ -1 +1 @@ -5.0.2 +7.0.6 diff --git a/storage/mroonga/test/run-sql-test.sh b/storage/mroonga/test/run-sql-test.sh index f1679dc70fa..d3aaf6aecf7 100755 --- a/storage/mroonga/test/run-sql-test.sh +++ b/storage/mroonga/test/run-sql-test.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright(C) 2010 Tetsuro IKEDA -# Copyright(C) 2010-2013 Kouhei Sutou +# Copyright(C) 2010-2017 Kouhei Sutou # Copyright(C) 2011 Kazuhiko # # This library is free software; you can redistribute it and/or @@ -16,7 +16,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA export BASE_DIR="$(cd $(dirname $0); pwd)" top_dir="$BASE_DIR/.." @@ -24,31 +24,44 @@ mroonga_test_dir="${top_dir}/mysql-test/mroonga" n_processors=1 case `uname` in - Linux) - n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)" - ;; - Darwin) - n_processors="$(/usr/sbin/sysctl -n hw.ncpu)" - ;; - *) - : - ;; + Linux) + n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)" + ;; + Darwin) + n_processors="$(/usr/sbin/sysctl -n hw.ncpu)" + ;; + *) + : + ;; esac if [ "$NO_MAKE" != "yes" ]; then - MAKE_ARGS= - if [ -n "$n_processors" ]; then - MAKE_ARGS="-j${n_processors}" - fi - make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 + MAKE_ARGS= + if [ -n "$n_processors" ]; then + MAKE_ARGS="-j${n_processors}" + fi + make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 fi . "${top_dir}/config.sh" bundled_groonga_normalizer_mysql_dir="${top_dir}/vendor/groonga/vendor/plugins/groonga-normalizer-mysql" if [ -d "${bundled_groonga_normalizer_mysql_dir}" ]; then - GRN_PLUGINS_DIR="${bundled_groonga_normalizer_mysql_dir}" - export GRN_PLUGINS_DIR + GRN_PLUGINS_DIR="${bundled_groonga_normalizer_mysql_dir}" + export GRN_PLUGINS_DIR +fi + +maria_storage_dir="${MYSQL_SOURCE_DIR}/storage/maria" +if [ -d "${maria_storage_dir}" ]; then + mariadb="yes" +else + mariadb="no" +fi +percona_udf_dir="${MYSQL_SOURCE_DIR}/plugin/percona-udf" +if [ -d "${percona_udf_dir}" ]; then + percona="yes" +else + percona="no" fi source_mysql_test_dir="${MYSQL_SOURCE_DIR}/mysql-test" @@ -58,51 +71,47 @@ source_test_include_dir="${source_mysql_test_dir}/include" build_test_suites_dir="${build_mysql_test_dir}/suite" build_test_include_dir="${build_mysql_test_dir}/include" case "${MYSQL_VERSION}" in - 5.1.*) - plugins_dir="${MYSQL_BUILD_DIR}/lib/mysql/plugin" - if [ ! -d "${build_test_suites_dir}" ]; then - mkdir -p "${build_test_suites_dir}" + 5.1.*) + plugins_dir="${MYSQL_BUILD_DIR}/lib/mysql/plugin" + if [ ! -d "${build_test_suites_dir}" ]; then + mkdir -p "${build_test_suites_dir}" + fi + ;; + *) + if [ ! -d "${build_test_suites_dir}" ]; then + ln -s "${source_test_suites_dir}" "${build_test_suites_dir}" + fi + if [ "${mariadb}" = "yes" ]; then + if [ "${MRN_BUNDLED}" != "TRUE" ]; then + mariadb_mroonga_plugin_dir="${MYSQL_BUILD_DIR}/plugin/mroonga" + if [ ! -e "${mariadb_mroonga_plugin_dir}" ]; then + ln -s "${top_dir}" "${mariadb_mroonga_plugin_dir}" fi - ;; - *) - if [ ! -d "${build_test_suites_dir}" ]; then - ln -s "${source_test_suites_dir}" "${build_test_suites_dir}" - fi - maria_storage_dir="${MYSQL_SOURCE_DIR}/storage/maria" - if [ -d "${maria_storage_dir}" ]; then - mariadb="yes" - else - mariadb="no" - fi - if [ "${mariadb}" = "yes" ]; then - if [ "${MRN_BUNDLED}" != "TRUE" ]; then - mariadb_mroonga_plugin_dir="${MYSQL_BUILD_DIR}/plugin/mroonga" - if [ ! -e "${mariadb_mroonga_plugin_dir}" ]; then - ln -s "${top_dir}" "${mariadb_mroonga_plugin_dir}" - fi - fi - plugins_dir= - else - plugins_dir="${MYSQL_SOURCE_DIR}/lib/plugin" - fi - ;; + fi + plugins_dir= + elif [ "${percona}" = "yes" ]; then + plugins_dir="${MYSQL_SOURCE_DIR}/lib/mysql/plugin" + else + plugins_dir="${MYSQL_SOURCE_DIR}/lib/plugin" + fi + ;; esac same_link_p() { - src=$1 - dest=$2 - if [ -L "$dest" -a "$(readlink "$dest")" = "$src" ]; then - return 0 - else - return 1 - fi + src=$1 + dest=$2 + if [ -L "$dest" -a "$(readlink "$dest")" = "$src" ]; then + return 0 + else + return 1 + fi } mroonga_mysql_test_suite_dir="${build_test_suites_dir}/mroonga" if ! same_link_p "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}"; then - rm -rf "${mroonga_mysql_test_suite_dir}" - ln -s "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}" + rm -rf "${mroonga_mysql_test_suite_dir}" + ln -s "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}" fi innodb_test_suite_dir="${build_test_suites_dir}/innodb" @@ -110,27 +119,27 @@ mroonga_wrapper_innodb_test_suite_name="mroonga_wrapper_innodb" mroonga_wrapper_innodb_test_suite_dir="${build_test_suites_dir}/${mroonga_wrapper_innodb_test_suite_name}" mroonga_wrapper_innodb_include_dir="${mroonga_wrapper_innodb_test_suite_dir}/include/" if [ "$0" -nt "$(dirname "${mroonga_wrapper_innodb_test_suite_dir}")" ]; then - rm -rf "${mroonga_wrapper_innodb_test_suite_dir}" + rm -rf "${mroonga_wrapper_innodb_test_suite_dir}" fi if [ ! -d "${mroonga_wrapper_innodb_test_suite_dir}" ]; then - cp -rp "${innodb_test_suite_dir}" "${mroonga_wrapper_innodb_test_suite_dir}" - mkdir -p "${mroonga_wrapper_innodb_include_dir}" - cp -rp "${source_test_include_dir}"/innodb[-_]*.inc \ - "${mroonga_wrapper_innodb_include_dir}" - ruby -i'' \ - -pe "\$_.gsub!(/\\bengine\\s*=\\s*innodb\\b([^;\\n]*)/i, + cp -rp "${innodb_test_suite_dir}" "${mroonga_wrapper_innodb_test_suite_dir}" + mkdir -p "${mroonga_wrapper_innodb_include_dir}" + cp -rp "${source_test_include_dir}"/innodb[-_]*.inc \ + "${mroonga_wrapper_innodb_include_dir}" + ruby -i'' \ + -pe "\$_.gsub!(/\\bengine\\s*=\\s*innodb\\b([^;\\n]*)/i, \"ENGINE=mroonga\\\1 COMMENT='ENGINE \\\"InnoDB\\\"'\") \$_.gsub!(/\\b(storage_engine\\s*=\\s*)innodb\\b([^;\\n]*)/i, \"\\\1mroonga\") \$_.gsub!(/^(--\\s*source\\s+)(include\\/innodb)/i, \"\\\1suite/mroonga_wrapper_innodb/\\\2\") " \ - ${mroonga_wrapper_innodb_test_suite_dir}/r/*.result \ - ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test \ - ${mroonga_wrapper_innodb_test_suite_dir}/include/*.inc - sed -i'' \ - -e '1 i --source ../mroonga/include/mroonga/have_mroonga.inc' \ - ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test + ${mroonga_wrapper_innodb_test_suite_dir}/r/*.result \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test \ + ${mroonga_wrapper_innodb_test_suite_dir}/include/*.inc + sed -i'' \ + -e '1 i --source ../mroonga/include/mroonga/have_mroonga.inc' \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test fi all_test_suite_names="" @@ -138,84 +147,87 @@ suite_dir="${mroonga_test_dir}/.." cd "${suite_dir}" suite_dir="$(pwd)" for test_suite_name in \ - $(find mroonga -type d -name 'include' '!' -prune -o \ - -type d '!' -name 'mroonga' \ - '!' -name 'include' \ - '!' -name '[tr]'); do - if [ -n "${all_test_suite_names}" ]; then - all_test_suite_names="${all_test_suite_names}," - fi - all_test_suite_names="${all_test_suite_names}${test_suite_name}" + $(find mroonga -type d -name 'include' '!' -prune -o \ + -type d '!' -name 'mroonga' \ + '!' -name 'include' \ + '!' -name '[tr]'); do + if [ -n "${all_test_suite_names}" ]; then + all_test_suite_names="${all_test_suite_names}," + fi + all_test_suite_names="${all_test_suite_names}${test_suite_name}" done cd - if [ -n "${plugins_dir}" ]; then - if [ -d "${top_dir}/.libs" ]; then - make -C ${top_dir} \ - install-pluginLTLIBRARIES \ - plugindir=${plugins_dir} > /dev/null || \ - exit 1 - else - mkdir -p "${plugins_dir}" - cp "${top_dir}/ha_mroonga.so" "${plugins_dir}" || exit 1 - fi + if [ -d "${top_dir}/.libs" ]; then + make -C ${top_dir} \ + install-pluginLTLIBRARIES \ + plugindir=${plugins_dir} > /dev/null || \ + exit 1 + else + mkdir -p "${plugins_dir}" + cp "${top_dir}/ha_mroonga.so" "${plugins_dir}" || exit 1 + fi fi +mysql_test_run_options="" test_suite_names="" test_names="" while [ $# -gt 0 ]; do - case "$1" in - --manual-gdb|--debug) - n_processors=1 - break - ;; - --*) - break - ;; + arg="$1" + shift + case "$arg" in + --manual-gdb|--gdb|--client-gdb|--boot-gdb|--debug|--valgrind) + n_processors=1 + mysql_test_run_options="${mysql_test_run_options} ${arg}" + ;; + --*) + mysql_test_run_options="${mysql_test_run_options} ${arg}" + ;; + *) + case "$arg" in + */t/*.test) + test_suite_name=$(echo "$arg" | sed -e 's,/t/.*\.test,,g') + test_suite_name=$(cd "$test_suite_name" && pwd) + test_name=$(echo "$arg" | sed -e 's,.*/t/\(.*\)\.test,\1,g') + ;; *) - case "$1" in - */t/*.test) - test_suite_name=$(echo "$1" | sed -e 's,/t/.*\.test,,g') - test_suite_name=$(cd "$test_suite_name" && pwd) - test_name=$(echo "$1" | sed -e 's,.*/t/\(.*\)\.test,\1,g') - ;; - *) - if [ -d "$1" ]; then - test_suite_name=$(cd "$1" && pwd) - else - test_suite_name="$1" - fi - test_name="" - ;; - esac - shift + if [ -d "$arg" ]; then + test_suite_name=$(cd "$arg" && pwd) + else + test_suite_name="$arg" + fi + test_name="" + ;; + esac - if [ -n "${test_name}" ]; then - if [ -n "${test_names}" ]; then - test_names="${test_names}|" - fi - test_names="${test_names}.*${test_name}" - fi + if [ -n "${test_name}" ]; then + if [ -n "${test_names}" ]; then + test_names="${test_names}|" + fi + test_names="${test_names}${test_name}" + fi - test_suite_name=$(echo "$test_suite_name" | sed -e "s,^${suite_dir}/,,") - if echo "${test_suite_names}" | grep --quiet "${test_suite_name}"; then - continue - fi - if [ -n "${test_suite_names}" ]; then - test_suite_names="${test_suite_names}," - fi - test_suite_names="${test_suite_names}${test_suite_name}" - ;; - esac + test_suite_name=$(echo "$test_suite_name" | sed -e "s,^${suite_dir}/,,") + if echo "${test_suite_names}" | grep --quiet "${test_suite_name}"; then + continue + fi + if [ -n "${test_suite_names}" ]; then + test_suite_names="${test_suite_names}," + fi + test_suite_names="${test_suite_names}${test_suite_name}" + ;; + esac done if [ -z "$test_suite_names" ]; then - test_suite_names="${all_test_suite_names}" + test_suite_names="${all_test_suite_names}" fi mysql_test_run_args="" -mysql_test_run_args="${mysql_test_run_args} --mem" -mysql_test_run_args="${mysql_test_run_args} --no-check-testcases" +if [ "${percona}" != "yes" ]; then + mysql_test_run_args="${mysql_test_run_args} --mem" +fi mysql_test_run_args="${mysql_test_run_args} --parallel=${n_processors}" mysql_test_run_args="${mysql_test_run_args} --retry=1" mysql_test_run_args="${mysql_test_run_args} --suite=${test_suite_names}" @@ -223,10 +235,10 @@ mysql_test_run_args="${mysql_test_run_args} --force" mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-load-add=ha_mroonga.so" mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-mroonga=ON" if [ -n "$test_names" ]; then - mysql_test_run_args="${mysql_test_run_args} --do-test=${test_names}" + mysql_test_run_args="${mysql_test_run_args} --do-test=${test_names}" fi (cd "$build_mysql_test_dir" && \ - ./mysql-test-run.pl \ - ${mysql_test_run_args} \ - "$@") + perl -I . ./mysql-test-run.pl \ + ${mysql_test_run_args} \ + ${mysql_test_run_options}) diff --git a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp index a5d0d81c340..54a9f35b03f 100644 --- a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp +++ b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include diff --git a/storage/mroonga/tools/prepare-sphinx-html.rb b/storage/mroonga/tools/prepare-sphinx-html.rb index 76eed24a042..71e12f0e3ca 100755 --- a/storage/mroonga/tools/prepare-sphinx-html.rb +++ b/storage/mroonga/tools/prepare-sphinx-html.rb @@ -48,13 +48,6 @@ def fix_html_link(html, language) end end -def add_language_annotation_to_source_label(html) - html.gsub(/>(ソースコードを表示)#{label}(英語)<" - end -end - def fix_js_link(js, language) fix_link_path(js) end @@ -156,7 +149,6 @@ language_dirs.each do |language_dir| content = fix_link(content, extension, language) if extension == "html" content = insert_facebook_html(content, language) - content = add_language_annotation_to_source_label(content) end dest_path.open("wb") do |dest| dest.print(content.strip) diff --git a/storage/mroonga/tools/travis/before_script.sh b/storage/mroonga/tools/travis/before_script.sh index 2b4591a60a4..e3e22c8768a 100755 --- a/storage/mroonga/tools/travis/before_script.sh +++ b/storage/mroonga/tools/travis/before_script.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(C) 2012-2015 Kouhei Sutou +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # set -x set -e @@ -40,6 +40,7 @@ if [ "${MROONGA_BUNDLED}" = "yes" ]; then cmake_args=("${cmake_args[@]}" -DWITHOUT_TOKUDB=TRUE) if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then cmake_args=("${cmake_args[@]}" -DWITH_EMBEDDED_SERVER=TRUE) + cmake_args=("${cmake_args[@]}" -DMRN_BUILD_FOR_EMBEDDED_SERVER=TRUE) fi cmake . "${cmake_args[@]}" else @@ -49,9 +50,48 @@ else PATH=$(echo /opt/mysql/server-*/bin/):$PATH fi configure_args=("--with-mysql-source=$PWD/vendor/mysql") - if [ "${MYSQL_VERSION}" = "mysql-5.6.25" ]; then - configure_args=("${configure_args[@]}" --enable-fast-mutexes) - fi + case "${MYSQL_VERSION}" in + mysql-5.6) + configure_args=("${configure_args[@]}" --enable-fast-mutexes) + ;; + mysql-5.7) + boost_archive=boost_1_59_0.tar.gz + curl -L -O http://downloads.sourceforge.net/project/boost/boost/1.59.0/${boost_archive} + sudo mkdir -p /usr/global/share + sudo mv ${boost_archive} /usr/global/share/ + (cd vendor/mysql && sudo debian/rules override_dh_auto_configure) + ;; + mariadb-5.5) + (cd vendor/mysql && sudo debian/rules configure) + configure_args=("${configure_args[@]}" + "--with-mysql-build=$PWD/vendor/mysql/builddir") + ;; + percona-server-5.6) + (cd vendor/mysql && \ + sudo debian/rules configure SKIP_DEBUG_BINARY=yes && \ + cd builddir/libservices && \ + sudo make > /dev/null && \ + cd ../extra && \ + sudo make > /dev/null) + configure_args=("${configure_args[@]}" + "--enable-fast-mutexes" + "--with-mysql-build=$PWD/vendor/mysql/builddir" + "--with-mysql-config=$PWD/vendor/mysql/builddir/scripts/mysql_config") + ;; + percona-server-5.7) + (cd vendor/mysql && \ + sudo debian/rules override_dh_auto_configure SKIP_DEBUG_BINARY=yes && \ + cd builddir/libservices && \ + sudo make > /dev/null && \ + cd ../extra && \ + sudo make > /dev/null) + configure_args=("${configure_args[@]}" + "--with-mysql-build=$PWD/vendor/mysql/builddir" + "--with-mysql-config=$PWD/vendor/mysql/builddir/scripts/mysql_config") + ;; + *) + : + ;; + esac ./configure "${configure_args[@]}" - cat "$(mysql_config --include | sed -e 's/-I//g')/my_config.h" fi diff --git a/storage/mroonga/tools/travis/install.sh b/storage/mroonga/tools/travis/install.sh index c723eb69f35..7596c1ccc32 100755 --- a/storage/mroonga/tools/travis/install.sh +++ b/storage/mroonga/tools/travis/install.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright(C) 2012-2015 Kouhei Sutou +# Copyright(C) 2012-2017 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -14,21 +14,50 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# set -x +set -x set -e -mariadb_download_base=http://mirror.jmu.edu/pub/mariadb +# export GROONGA_MASTER=yes +# export GROONGA_NORMALIZER_MYSQL_MASTER=yes -export GROONGA_MASTER=yes -export GROONGA_NORMALIZER_MYSQL_MASTER=yes +#mariadb_download_base=http://mirror.jmu.edu/pub/mariadb +mariadb_download_base=http://ftp.osuosl.org/pub/mariadb + +version=$(echo "$MYSQL_VERSION" | sed -r -e 's/^(mysql|mariadb|percona-server)-//') +series=$(echo "$version" | sed -r -e 's/^([0-9]+\.[0-9]+).*$/\1/g') + +setup_mariadb_apt() +{ + distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z') + code_name=$(lsb_release --short --codename) + component=main + apt_url_base="${mariadb_download_base}/repo/${series}" + cat < +# Copyright(C) 2012-2016 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # set -x set -e @@ -43,11 +43,7 @@ fi build() { - if [ "${MROONGA_BUNDLED}" = "yes" ]; then - make -j${n_processors} > /dev/null - else - make -j${n_processors} > /dev/null - fi + make -j${n_processors} > /dev/null } run_unit_test() @@ -62,8 +58,12 @@ prepare_mysql_test_dir() mysql_test_dir=/usr/mysql-test if [ -d /usr/lib/mysql-testsuite/ ]; then sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/ + elif [ -d /usr/lib/mysql-test/ ]; then + sudo cp -a /usr/lib/mysql-test/ ${mysql_test_dir}/ elif [ -d /usr/share/mysql/mysql-test/ ]; then sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/ + elif [ -d /usr/share/mysql-test/ ]; then + sudo cp -a /usr/share/mysql-test/ ${mysql_test_dir}/ elif [ -d /opt/mysql/ ]; then mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test) else @@ -100,6 +100,9 @@ run_sql_test() if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then test_args=("${test_args[@]}" "--embedded-server") fi + if [ "${MROONGA_TEST_PS_PROTOCOL}" = "yes" ]; then + test_args=("${test_args[@]}" "--ps-protocol") + fi if [ "${MROONGA_BUNDLED}" = "yes" ]; then # Plugins aren't supported. @@ -112,16 +115,17 @@ run_sql_test() ${mroonga_dir}/test/run-sql-test.sh \ "${test_args[@]}" \ - --parallel="${n_processors}" + --parallel="${n_processors}" \ + --retry=3 else prepare_sql_test cd ${mysql_test_dir}/ - ./mysql-test-run.pl \ + perl ./mysql-test-run.pl \ "${test_args[@]}" \ --no-check-testcases \ --parallel="${n_processors}" \ - --retry=1 \ + --retry=3 \ --suite="${test_suite_names}" \ --force fi diff --git a/storage/mroonga/udf/mrn_udf_command.cpp b/storage/mroonga/udf/mrn_udf_command.cpp index d14f3ffd49d..b4d0f8b20a3 100644 --- a/storage/mroonga/udf/mrn_udf_command.cpp +++ b/storage/mroonga/udf/mrn_udf_command.cpp @@ -2,7 +2,7 @@ /* Copyright(C) 2010 Tetsuro IKEDA Copyright(C) 2010-2013 Kentoku SHIBA - Copyright(C) 2011-2013 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,39 +25,93 @@ #include #include #include +#include #include +#include + +#include MRN_BEGIN_DECLS extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; struct CommandInfo { - grn_ctx ctx; + grn_ctx *ctx; grn_obj *db; bool use_shared_db; + grn_obj command; String result; }; -MRN_API my_bool mroonga_command_init(UDF_INIT *initid, UDF_ARGS *args, +MRN_API my_bool mroonga_command_init(UDF_INIT *init, UDF_ARGS *args, char *message) { CommandInfo *info = NULL; - initid->ptr = NULL; - if (args->arg_count != 1) { - sprintf(message, - "mroonga_command(): Incorrect number of arguments: %u for 1", - args->arg_count); + init->ptr = NULL; + if (args->arg_count == 0) { + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): Wrong number of arguments: %u for 1..", + args->arg_count); goto error; } - if (args->arg_type[0] != STRING_RESULT) { - strcpy(message, - "mroonga_command(): The 1st argument must be command as string"); + + if ((args->arg_count % 2) == 0) { + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): The number of arguments must be odd: %u", + args->arg_count); goto error; } - initid->maybe_null = 1; - initid->const_item = 1; + + for (unsigned int i = 0; i < args->arg_count; ++i) { + switch (args->arg_type[i]) { + case STRING_RESULT: + // OK + break; + case REAL_RESULT: + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): Argument must be string: <%g>", + *reinterpret_cast(args->args[i])); + goto error; + break; + case INT_RESULT: + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): Argument must be string: <%lld>", + *reinterpret_cast(args->args[i])); + goto error; + break; + case DECIMAL_RESULT: + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): Argument must be string: <%.*s>", + static_cast(args->lengths[i]), + args->args[i]); + goto error; + break; + default: + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): Argument must be string: <%d>(%u)", + args->arg_type[i], + i); + goto error; + break; + } + } + init->maybe_null = 1; + init->const_item = 0; info = (CommandInfo *)mrn_my_malloc(sizeof(CommandInfo), MYF(MY_WME | MY_ZEROFILL)); @@ -66,53 +120,100 @@ MRN_API my_bool mroonga_command_init(UDF_INIT *initid, UDF_ARGS *args, goto error; } - grn_ctx_init(&(info->ctx), 0); + info->ctx = mrn_context_pool->pull(); { const char *current_db_path = MRN_THD_DB_PATH(current_thd); const char *action; if (current_db_path) { action = "open database"; - int error = mrn_db_manager->open(current_db_path, &(info->db)); + char encoded_db_path[FN_REFLEN + 1]; + uint encoded_db_path_length = + tablename_to_filename(current_db_path, + encoded_db_path, + sizeof(encoded_db_path)); + encoded_db_path[encoded_db_path_length] = '\0'; + mrn::Database *db; + int error = mrn_db_manager->open(encoded_db_path, &db); if (error == 0) { - grn_ctx_use(&(info->ctx), info->db); + info->db = db->get(); + grn_ctx_use(info->ctx, info->db); info->use_shared_db = true; } } else { action = "create anonymous database"; - info->db = grn_db_create(&(info->ctx), NULL, NULL); + info->db = grn_db_create(info->ctx, NULL, NULL); info->use_shared_db = false; } if (!info->db) { - sprintf(message, - "mroonga_command(): failed to %s: %s", - action, - info->ctx.errbuf); + grn_snprintf(message, + MYSQL_ERRMSG_SIZE, + MYSQL_ERRMSG_SIZE, + "mroonga_command(): failed to %s: %s", + action, + info->ctx->errbuf); goto error; } } + GRN_TEXT_INIT(&(info->command), 0); - initid->ptr = (char *)info; + init->ptr = (char *)info; return FALSE; error: if (info) { if (!info->use_shared_db) { - grn_obj_close(&(info->ctx), info->db); + grn_obj_close(info->ctx, info->db); } - grn_ctx_fin(&(info->ctx)); + mrn_context_pool->release(info->ctx); my_free(info); } return TRUE; } -MRN_API char *mroonga_command(UDF_INIT *initid, UDF_ARGS *args, char *result, +static void mroonga_command_escape_value(grn_ctx *ctx, + grn_obj *command, + const char *value, + unsigned long value_length) +{ + GRN_TEXT_PUTC(ctx, command, '"'); + + const char *value_current = value; + const char *value_end = value_current + value_length; + while (value_current < value_end) { + int char_length = grn_charlen(ctx, value_current, value_end); + + if (char_length == 0) { + break; + } else if (char_length == 1) { + switch (*value_current) { + case '\\': + case '"': + GRN_TEXT_PUTC(ctx, command, '\\'); + GRN_TEXT_PUTC(ctx, command, *value_current); + break; + case '\n': + GRN_TEXT_PUTS(ctx, command, "\\n"); + break; + default: + GRN_TEXT_PUTC(ctx, command, *value_current); + break; + } + } else { + GRN_TEXT_PUT(ctx, command, value_current, char_length); + } + + value_current += char_length; + } + + GRN_TEXT_PUTC(ctx, command, '"'); +} + +MRN_API char *mroonga_command(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error) { - CommandInfo *info = (CommandInfo *)initid->ptr; - grn_ctx *ctx = &(info->ctx); - char *command; - unsigned int command_length; + CommandInfo *info = (CommandInfo *)init->ptr; + grn_ctx *ctx = info->ctx; int flags = 0; if (!args->args[0]) { @@ -120,11 +221,31 @@ MRN_API char *mroonga_command(UDF_INIT *initid, UDF_ARGS *args, char *result, return NULL; } - *is_null = 0; - command = args->args[0]; - command_length = args->lengths[0]; + GRN_BULK_REWIND(&(info->command)); + GRN_TEXT_PUT(ctx, &(info->command), args->args[0], args->lengths[0]); + for (unsigned int i = 1; i < args->arg_count; i += 2) { + if (!args->args[i] || !args->args[i + 1]) { + *is_null = 1; + return NULL; + } - grn_ctx_send(ctx, command, command_length, 0); + const char *name = args->args[i]; + unsigned long name_length = args->lengths[i]; + GRN_TEXT_PUTS(ctx, &(info->command), " --"); + GRN_TEXT_PUT(ctx, &(info->command), name, name_length); + + const char *value = args->args[i + 1]; + unsigned long value_length = args->lengths[i + 1]; + GRN_TEXT_PUTS(ctx, &(info->command), " "); + mroonga_command_escape_value(ctx, &(info->command), value, value_length); + } + + *is_null = 0; + + grn_ctx_send(ctx, + GRN_TEXT_VALUE(&(info->command)), + GRN_TEXT_LEN(&(info->command)), + 0); if (ctx->rc) { my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); goto error; @@ -156,14 +277,15 @@ error: return NULL; } -MRN_API void mroonga_command_deinit(UDF_INIT *initid) +MRN_API void mroonga_command_deinit(UDF_INIT *init) { - CommandInfo *info = (CommandInfo *)initid->ptr; + CommandInfo *info = (CommandInfo *)init->ptr; if (info) { + GRN_OBJ_FIN(info->ctx, &(info->command)); if (!info->use_shared_db) { - grn_obj_close(&(info->ctx), info->db); + grn_obj_close(info->ctx, info->db); } - grn_ctx_fin(&(info->ctx)); + mrn_context_pool->release(info->ctx); MRN_STRING_FREE(info->result); my_free(info); } diff --git a/storage/mroonga/udf/mrn_udf_escape.cpp b/storage/mroonga/udf/mrn_udf_escape.cpp index 89b08a1c6d5..b97327fb1d0 100644 --- a/storage/mroonga/udf/mrn_udf_escape.cpp +++ b/storage/mroonga/udf/mrn_udf_escape.cpp @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* - Copyright(C) 2013-2015 Kouhei Sutou + Copyright(C) 2013-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -23,33 +23,56 @@ #include #include #include +#include MRN_BEGIN_DECLS +extern mrn::ContextPool *mrn_context_pool; + struct EscapeInfo { - grn_ctx ctx; + grn_ctx *ctx; + bool script_mode; grn_obj target_characters; - grn_obj escaped_query; - bool processed; + grn_obj escaped_value; }; -MRN_API my_bool mroonga_escape_init(UDF_INIT *initid, UDF_ARGS *args, +MRN_API my_bool mroonga_escape_init(UDF_INIT *init, UDF_ARGS *args, char *message) { EscapeInfo *info = NULL; + bool script_mode = false; - initid->ptr = NULL; + init->ptr = NULL; if (!(1 <= args->arg_count && args->arg_count <= 2)) { - sprintf(message, - "mroonga_escape(): Incorrect number of arguments: %u for 1..2", - args->arg_count); + snprintf(message, + MYSQL_ERRMSG_SIZE, + "mroonga_escape(): Incorrect number of arguments: %u for 1..2", + args->arg_count); goto error; } - if (args->arg_type[0] != STRING_RESULT) { - strcpy(message, - "mroonga_escape(): The 1st argument must be query as string"); - goto error; + + if (args->attribute_lengths[0] == strlen("script") && + strncmp(args->attributes[0], "script", strlen("script")) == 0) { + switch (args->arg_type[0]) { + case ROW_RESULT: + snprintf(message, + MYSQL_ERRMSG_SIZE, + "mroonga_escape(): " + "The 1st script argument must be " + "string, integer or floating point: "); + goto error; + break; + default: + break; + } + script_mode = true; + } else { + if (args->arg_type[0] != STRING_RESULT) { + strcpy(message, + "mroonga_escape(): The 1st query argument must be string"); + goto error; + } } if (args->arg_count == 2) { if (args->arg_type[1] != STRING_RESULT) { @@ -60,28 +83,27 @@ MRN_API my_bool mroonga_escape_init(UDF_INIT *initid, UDF_ARGS *args, } } - initid->maybe_null = 1; - initid->const_item = 1; + init->maybe_null = 1; - info = (EscapeInfo *)mrn_my_malloc(sizeof(EscapeInfo), - MYF(MY_WME | MY_ZEROFILL)); + info = static_cast(mrn_my_malloc(sizeof(EscapeInfo), + MYF(MY_WME | MY_ZEROFILL))); if (!info) { strcpy(message, "mroonga_escape(): out of memory"); goto error; } - grn_ctx_init(&(info->ctx), 0); + info->ctx = mrn_context_pool->pull(); + info->script_mode = script_mode; GRN_TEXT_INIT(&(info->target_characters), 0); - GRN_TEXT_INIT(&(info->escaped_query), 0); - info->processed = false; + GRN_TEXT_INIT(&(info->escaped_value), 0); - initid->ptr = (char *)info; + init->ptr = reinterpret_cast(info); return FALSE; error: if (info) { - grn_ctx_fin(&(info->ctx)); + mrn_context_pool->release(info->ctx); my_free(info); } return TRUE; @@ -89,32 +111,103 @@ error: static void escape(EscapeInfo *info, UDF_ARGS *args) { - grn_ctx *ctx = &(info->ctx); - char *query = args->args[0]; - unsigned int query_length = args->lengths[0]; + grn_ctx *ctx = info->ctx; - if (args->arg_count == 2) { - char *target_characters = args->args[1]; - unsigned int target_characters_length = args->lengths[1]; - GRN_TEXT_PUT(ctx, &(info->target_characters), - target_characters, - target_characters_length); - GRN_TEXT_PUTC(ctx, &(info->target_characters), '\0'); - grn_expr_syntax_escape(ctx, query, query_length, - GRN_TEXT_VALUE(&(info->target_characters)), - GRN_QUERY_ESCAPE, - &(info->escaped_query)); + GRN_BULK_REWIND(&(info->escaped_value)); + if (info->script_mode) { + switch (args->arg_type[0]) { + case STRING_RESULT: + { + char *value = args->args[0]; + unsigned long value_length = args->lengths[0]; + GRN_TEXT_PUTC(ctx, &(info->escaped_value), '"'); + if (args->arg_count == 2) { + grn_obj special_characters; + GRN_TEXT_INIT(&special_characters, 0); + GRN_TEXT_PUT(ctx, + &special_characters, + args->args[1], + args->lengths[1]); + GRN_TEXT_PUTC(ctx, &special_characters, '\0'); + grn_expr_syntax_escape(ctx, + value, + value_length, + GRN_TEXT_VALUE(&special_characters), + '\\', + &(info->escaped_value)); + GRN_OBJ_FIN(ctx, &special_characters); + } else { + const char *special_characters = "\"\\"; + grn_expr_syntax_escape(ctx, + value, + value_length, + special_characters, + '\\', + &(info->escaped_value)); + } + GRN_TEXT_PUTC(ctx, &(info->escaped_value), '"'); + } + break; + case REAL_RESULT: + { + double value = *reinterpret_cast(args->args[0]); + grn_text_ftoa(ctx, &(info->escaped_value), value); + } + break; + case INT_RESULT: + { + longlong value = *reinterpret_cast(args->args[0]); + grn_text_lltoa(ctx, &(info->escaped_value), value); + } + break; + case DECIMAL_RESULT: + { + grn_obj value_raw; + GRN_TEXT_INIT(&value_raw, GRN_OBJ_DO_SHALLOW_COPY); + GRN_TEXT_SET(ctx, &value_raw, args->args[0], args->lengths[0]); + grn_obj value; + GRN_FLOAT_INIT(&value, 0); + if (grn_obj_cast(ctx, &value_raw, &value, GRN_FALSE) == GRN_SUCCESS) { + grn_text_ftoa(ctx, &(info->escaped_value), GRN_FLOAT_VALUE(&value)); + } else { + GRN_TEXT_PUT(ctx, + &(info->escaped_value), + args->args[0], + args->lengths[0]); + } + GRN_OBJ_FIN(ctx, &value); + GRN_OBJ_FIN(ctx, &value_raw); + } + break; + default: + break; + } } else { - grn_expr_syntax_escape_query(ctx, query, query_length, - &(info->escaped_query)); + char *query = args->args[0]; + unsigned long query_length = args->lengths[0]; + if (args->arg_count == 2) { + char *target_characters = args->args[1]; + unsigned long target_characters_length = args->lengths[1]; + GRN_TEXT_PUT(ctx, &(info->target_characters), + target_characters, + target_characters_length); + GRN_TEXT_PUTC(ctx, &(info->target_characters), '\0'); + grn_expr_syntax_escape(ctx, query, query_length, + GRN_TEXT_VALUE(&(info->target_characters)), + GRN_QUERY_ESCAPE, + &(info->escaped_value)); + } else { + grn_expr_syntax_escape_query(ctx, query, query_length, + &(info->escaped_value)); + } } } -MRN_API char *mroonga_escape(UDF_INIT *initid, UDF_ARGS *args, char *result, +MRN_API char *mroonga_escape(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error) { - EscapeInfo *info = (EscapeInfo *)initid->ptr; - grn_ctx *ctx = &(info->ctx); + EscapeInfo *info = reinterpret_cast(init->ptr); + grn_ctx *ctx = info->ctx; if (!args->args[0]) { *is_null = 1; @@ -123,31 +216,28 @@ MRN_API char *mroonga_escape(UDF_INIT *initid, UDF_ARGS *args, char *result, *is_null = 0; - if (!info->processed) { - escape(info, args); - info->processed = true; - } + escape(info, args); if (ctx->rc) { my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); goto error; } - *length = GRN_TEXT_LEN(&(info->escaped_query)); - return (char *)(GRN_TEXT_VALUE(&(info->escaped_query))); + *length = GRN_TEXT_LEN(&(info->escaped_value)); + return GRN_TEXT_VALUE(&(info->escaped_value)); error: *error = 1; return NULL; } -MRN_API void mroonga_escape_deinit(UDF_INIT *initid) +MRN_API void mroonga_escape_deinit(UDF_INIT *init) { - EscapeInfo *info = (EscapeInfo *)initid->ptr; + EscapeInfo *info = reinterpret_cast(init->ptr); if (info) { - grn_obj_unlink(&(info->ctx), &(info->target_characters)); - grn_obj_unlink(&(info->ctx), &(info->escaped_query)); - grn_ctx_fin(&(info->ctx)); + grn_obj_unlink(info->ctx, &(info->target_characters)); + grn_obj_unlink(info->ctx, &(info->escaped_value)); + mrn_context_pool->release(info->ctx); my_free(info); } } diff --git a/storage/mroonga/udf/mrn_udf_highlight_html.cpp b/storage/mroonga/udf/mrn_udf_highlight_html.cpp new file mode 100644 index 00000000000..dc46ef5f205 --- /dev/null +++ b/storage/mroonga/udf/mrn_udf_highlight_html.cpp @@ -0,0 +1,494 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MRN_BEGIN_DECLS + +extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; + +typedef struct st_mrn_highlight_html_info +{ + grn_ctx *ctx; + grn_obj *db; + bool use_shared_db; + grn_obj *keywords; + String result_str; + struct { + bool used; + grn_obj *table; + grn_obj *default_column; + } query_mode; +} mrn_highlight_html_info; + +static my_bool mrn_highlight_html_prepare(mrn_highlight_html_info *info, + UDF_ARGS *args, + char *message, + grn_obj **keywords) +{ + MRN_DBUG_ENTER_FUNCTION(); + + grn_ctx *ctx = info->ctx; + const char *normalizer_name = "NormalizerAuto"; + grn_obj *expr = NULL; + String *result_str = &(info->result_str); + + *keywords = NULL; + + mrn::encoding::set_raw(ctx, system_charset_info); + if (system_charset_info->state & (MY_CS_BINSORT | MY_CS_CSSORT)) { + normalizer_name = NULL; + } + + *keywords = grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_PAT_KEY, + grn_ctx_at(ctx, GRN_DB_SHORT_TEXT), + NULL); + if (ctx->rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): " + "failed to create grn_pat for keywords: <%s>", + ctx->errbuf); + } + goto error; + } + if (normalizer_name) { + grn_obj_set_info(ctx, + *keywords, + GRN_INFO_NORMALIZER, + grn_ctx_get(ctx, normalizer_name, -1)); + } + + if (info->query_mode.used) { + if (!info->query_mode.table) { + grn_obj *short_text; + short_text = grn_ctx_at(info->ctx, GRN_DB_SHORT_TEXT); + info->query_mode.table = grn_table_create(info->ctx, + NULL, 0, NULL, + GRN_TABLE_HASH_KEY, + short_text, + NULL); + } + if (!info->query_mode.default_column) { + info->query_mode.default_column = + grn_obj_column(info->ctx, + info->query_mode.table, + GRN_COLUMN_NAME_KEY, + GRN_COLUMN_NAME_KEY_LEN); + } + + grn_obj *record = NULL; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->query_mode.table, expr, record); + if (!expr) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): " + "failed to create expression: <%s>", + ctx->errbuf); + } + goto error; + } + + mrn::QueryParser query_parser(info->ctx, + current_thd, + expr, + info->query_mode.default_column, + 0, + NULL); + grn_rc rc = query_parser.parse(args->args[1], args->lengths[1]); + if (rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): " + "failed to parse query: <%s>", + ctx->errbuf); + } + goto error; + } + + { + grn_obj extracted_keywords; + GRN_PTR_INIT(&extracted_keywords, GRN_OBJ_VECTOR, GRN_ID_NIL); + grn_expr_get_keywords(ctx, expr, &extracted_keywords); + + size_t n_keywords = + GRN_BULK_VSIZE(&extracted_keywords) / sizeof(grn_obj *); + for (size_t i = 0; i < n_keywords; ++i) { + grn_obj *extracted_keyword = GRN_PTR_VALUE_AT(&extracted_keywords, i); + grn_table_add(ctx, + *keywords, + GRN_TEXT_VALUE(extracted_keyword), + GRN_TEXT_LEN(extracted_keyword), + NULL); + if (ctx->rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): " + "failed to add a keyword: <%.*s>: <%s>", + static_cast(GRN_TEXT_LEN(extracted_keyword)), + GRN_TEXT_VALUE(extracted_keyword), + ctx->errbuf); + GRN_OBJ_FIN(ctx, &extracted_keywords); + } + goto error; + } + } + GRN_OBJ_FIN(ctx, &extracted_keywords); + } + } else { + for (unsigned int i = 1; i < args->arg_count; ++i) { + if (!args->args[i]) { + continue; + } + grn_table_add(ctx, + *keywords, + args->args[i], + args->lengths[i], + NULL); + if (ctx->rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): " + "failed to add a keyword: <%.*s>: <%s>", + static_cast(args->lengths[i]), + args->args[i], + ctx->errbuf); + } + goto error; + } + } + } + + result_str->set_charset(system_charset_info); + DBUG_RETURN(FALSE); + +error: + if (expr) { + grn_obj_close(ctx, expr); + } + if (*keywords) { + grn_obj_close(ctx, *keywords); + } + DBUG_RETURN(TRUE); +} + +MRN_API my_bool mroonga_highlight_html_init(UDF_INIT *init, + UDF_ARGS *args, + char *message) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_highlight_html_info *info = NULL; + + init->ptr = NULL; + + if (args->arg_count < 1) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): wrong number of arguments: %u for 1+", + args->arg_count); + goto error; + } + + + for (unsigned int i = 0; i < args->arg_count; ++i) { + switch (args->arg_type[i]) { + case STRING_RESULT: + /* OK */ + break; + case REAL_RESULT: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): all arguments must be string: " + "<%u>=<%g>", + i, *((double *)(args->args[i]))); + goto error; + break; + case INT_RESULT: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): all arguments must be string: " + "<%u>=<%lld>", + i, *((longlong *)(args->args[i]))); + goto error; + break; + default: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): all arguments must be string: <%u>", + i); + goto error; + break; + } + } + + init->maybe_null = 0; + + info = + reinterpret_cast( + mrn_my_malloc(sizeof(mrn_highlight_html_info), + MYF(MY_WME | MY_ZEROFILL))); + if (!info) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_highlight_html(): failed to allocate memory"); + goto error; + } + + info->ctx = mrn_context_pool->pull(); + { + const char *current_db_path = MRN_THD_DB_PATH(current_thd); + const char *action; + if (current_db_path) { + action = "open database"; + mrn::Database *db; + int error = mrn_db_manager->open(current_db_path, &db); + if (error == 0) { + info->db = db->get(); + grn_ctx_use(info->ctx, info->db); + info->use_shared_db = true; + } + } else { + action = "create anonymous database"; + info->db = grn_db_create(info->ctx, NULL, NULL); + info->use_shared_db = false; + } + if (!info->db) { + sprintf(message, + "mroonga_highlight_html(): failed to %s: %s", + action, + info->ctx->errbuf); + goto error; + } + } + + info->query_mode.used = FALSE; + + if (args->arg_count == 2 && + args->attribute_lengths[1] == strlen("query") && + strncmp(args->attributes[1], "query", strlen("query")) == 0) { + info->query_mode.used = TRUE; + info->query_mode.table = NULL; + info->query_mode.default_column = NULL; + } + + { + bool all_keywords_are_constant = TRUE; + for (unsigned int i = 1; i < args->arg_count; ++i) { + if (!args->args[i]) { + all_keywords_are_constant = FALSE; + break; + } + } + + if (all_keywords_are_constant) { + if (mrn_highlight_html_prepare(info, args, message, &(info->keywords))) { + goto error; + } + } else { + info->keywords = NULL; + } + } + + init->ptr = (char *)info; + + DBUG_RETURN(FALSE); + +error: + if (info) { + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + } + DBUG_RETURN(TRUE); +} + +static bool highlight_html(grn_ctx *ctx, + grn_pat *keywords, + const char *target, + size_t target_length, + String *output) +{ + MRN_DBUG_ENTER_FUNCTION(); + + grn_obj buffer; + + GRN_TEXT_INIT(&buffer, 0); + + { + const char *open_tag = ""; + size_t open_tag_length = strlen(open_tag); + const char *close_tag = ""; + size_t close_tag_length = strlen(close_tag); + + while (target_length > 0) { +#define MAX_N_HITS 16 + grn_pat_scan_hit hits[MAX_N_HITS]; + const char *rest; + size_t previous = 0; + size_t chunk_length; + + int n_hits = grn_pat_scan(ctx, + keywords, + target, + target_length, + hits, MAX_N_HITS, &rest); + for (int i = 0; i < n_hits; i++) { + if ((hits[i].offset - previous) > 0) { + grn_text_escape_xml(ctx, + &buffer, + target + previous, + hits[i].offset - previous); + } + GRN_TEXT_PUT(ctx, &buffer, open_tag, open_tag_length); + grn_text_escape_xml(ctx, + &buffer, + target + hits[i].offset, + hits[i].length); + GRN_TEXT_PUT(ctx, &buffer, close_tag, close_tag_length); + previous = hits[i].offset + hits[i].length; + } + + chunk_length = rest - target; + if ((chunk_length - previous) > 0) { + grn_text_escape_xml(ctx, + &buffer, + target + previous, + target_length - previous); + } + target_length -= chunk_length; + target = rest; +#undef MAX_N_HITS + } + } + + if (output->reserve(GRN_TEXT_LEN(&buffer))) { + my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); + GRN_OBJ_FIN(ctx, &buffer); + DBUG_RETURN(false); + } + + output->q_append(GRN_TEXT_VALUE(&buffer), GRN_TEXT_LEN(&buffer)); + GRN_OBJ_FIN(ctx, &buffer); + DBUG_RETURN(true); +} + +MRN_API char *mroonga_highlight_html(UDF_INIT *init, + UDF_ARGS *args, + char *result, + unsigned long *length, + char *is_null, + char *error) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_highlight_html_info *info = + reinterpret_cast(init->ptr); + + grn_ctx *ctx = info->ctx; + grn_obj *keywords = info->keywords; + String *result_str = &(info->result_str); + + if (!args->args[0]) { + *is_null = 1; + DBUG_RETURN(NULL); + } + + if (!keywords) { + if (mrn_highlight_html_prepare(info, args, NULL, &keywords)) { + goto error; + } + } + + *is_null = 0; + result_str->length(0); + + if (!highlight_html(ctx, + reinterpret_cast(keywords), + args->args[0], + args->lengths[0], + result_str)) { + goto error; + } + + if (!info->keywords) { + grn_rc rc = grn_obj_close(ctx, keywords); + if (rc != GRN_SUCCESS) { + my_printf_error(ER_MRN_ERROR_FROM_GROONGA_NUM, + ER_MRN_ERROR_FROM_GROONGA_STR, MYF(0), ctx->errbuf); + goto error; + } + } + + *length = result_str->length(); + DBUG_RETURN((char *)result_str->ptr()); + +error: + if (!info->keywords && keywords) { + grn_obj_close(ctx, keywords); + } + + *is_null = 1; + *error = 1; + + DBUG_RETURN(NULL); +} + +MRN_API void mroonga_highlight_html_deinit(UDF_INIT *init) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_highlight_html_info *info = + reinterpret_cast(init->ptr); + if (!info) { + DBUG_VOID_RETURN; + } + + if (info->keywords) { + grn_obj_close(info->ctx, info->keywords); + } + if (info->query_mode.used) { + if (info->query_mode.default_column) { + grn_obj_close(info->ctx, info->query_mode.default_column); + } + if (info->query_mode.table) { + grn_obj_close(info->ctx, info->query_mode.table); + } + } + MRN_STRING_FREE(info->result_str); + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + + DBUG_VOID_RETURN; +} + +MRN_END_DECLS diff --git a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp index b54f5c53206..fb4b5440ef1 100644 --- a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp +++ b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp @@ -2,7 +2,7 @@ /* Copyright(C) 2010 Tetsuro IKEDA Copyright(C) 2010-2013 Kentoku SHIBA - Copyright(C) 2011-2013 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -23,20 +23,21 @@ #include #include #include +#include MRN_BEGIN_DECLS -MRN_API my_bool last_insert_grn_id_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +MRN_API my_bool last_insert_grn_id_init(UDF_INIT *init, UDF_ARGS *args, char *message) { if (args->arg_count != 0) { strcpy(message, "last_insert_grn_id must not have arguments"); return 1; } - initid->maybe_null = 0; + init->maybe_null = 0; return 0; } -MRN_API longlong last_insert_grn_id(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, char *is_null, char *error) { THD *thd = current_thd; st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); @@ -47,7 +48,7 @@ MRN_API longlong last_insert_grn_id(UDF_INIT *initid, UDF_ARGS *args, char *is_n return last_insert_record_id; } -MRN_API void last_insert_grn_id_deinit(UDF_INIT *initid) +MRN_API void last_insert_grn_id_deinit(UDF_INIT *init) { } diff --git a/storage/mroonga/udf/mrn_udf_normalize.cpp b/storage/mroonga/udf/mrn_udf_normalize.cpp new file mode 100644 index 00000000000..dd597946ea8 --- /dev/null +++ b/storage/mroonga/udf/mrn_udf_normalize.cpp @@ -0,0 +1,212 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2015 Naoya Murakami + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MRN_BEGIN_DECLS + +extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; + +#define DEFAULT_NORMALIZER_NAME "NormalizerAuto" + +struct st_mrn_normalize_info +{ + grn_ctx *ctx; + grn_obj *db; + bool use_shared_db; + grn_obj *normalizer; + int flags; + String result_str; +}; + +MRN_API my_bool mroonga_normalize_init(UDF_INIT *init, UDF_ARGS *args, + char *message) +{ + st_mrn_normalize_info *info = NULL; + String *result_str = NULL; + + init->ptr = NULL; + if (!(1 <= args->arg_count && args->arg_count <= 2)) { + sprintf(message, + "mroonga_normalize(): Incorrect number of arguments: %u for 1..2", + args->arg_count); + goto error; + } + if (args->arg_type[0] != STRING_RESULT) { + strcpy(message, + "mroonga_normalize(): The 1st argument must be query as string"); + goto error; + } + if (args->arg_count == 2) { + if (args->arg_type[1] != STRING_RESULT) { + strcpy(message, + "mroonga_normalize(): " + "The 2st argument must be normalizer name as string"); + goto error; + } + } + + init->maybe_null = 1; + + info = (st_mrn_normalize_info *)mrn_my_malloc(sizeof(st_mrn_normalize_info), + MYF(MY_WME | MY_ZEROFILL)); + if (!info) { + strcpy(message, "mroonga_normalize(): out of memory"); + goto error; + } + + info->ctx = mrn_context_pool->pull(); + { + const char *current_db_path = MRN_THD_DB_PATH(current_thd); + const char *action; + if (current_db_path) { + action = "open database"; + mrn::Database *db; + int error = mrn_db_manager->open(current_db_path, &db); + if (error == 0) { + info->db = db->get(); + grn_ctx_use(info->ctx, info->db); + info->use_shared_db = true; + } + } else { + action = "create anonymous database"; + info->db = grn_db_create(info->ctx, NULL, NULL); + info->use_shared_db = false; + } + if (!info->db) { + sprintf(message, + "mroonga_normalize(): failed to %s: %s", + action, + info->ctx->errbuf); + goto error; + } + } + + if (args->arg_count == 1) { + info->normalizer = grn_ctx_get(info->ctx, DEFAULT_NORMALIZER_NAME, -1); + } else { + info->normalizer = grn_ctx_get(info->ctx, args->args[1], args->lengths[1]); + } + if (!info->normalizer) { + sprintf(message, "mroonga_normalize(): nonexistent normalizer %.*s", + (int)args->lengths[1], args->args[1]); + goto error; + } + info->flags = 0; + + result_str = &(info->result_str); + mrn::encoding::set_raw(info->ctx, system_charset_info); + result_str->set_charset(system_charset_info); + + init->ptr = (char *)info; + + return FALSE; + +error: + if (info) { + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + } + return TRUE; +} + +MRN_API char *mroonga_normalize(UDF_INIT *init, UDF_ARGS *args, char *result, + unsigned long *length, char *is_null, char *error) +{ + st_mrn_normalize_info *info = (st_mrn_normalize_info *)init->ptr; + grn_ctx *ctx = info->ctx; + String *result_str = &(info->result_str); + + if (!args->args[0]) { + *is_null = 1; + return NULL; + } + + result_str->length(0); + { + char *target = args->args[0]; + unsigned int target_length = args->lengths[0]; + grn_obj *grn_string; + const char *normalized; + unsigned int normalized_length_in_bytes; + unsigned int normalized_n_characters; + + grn_string = grn_string_open(ctx, + target, target_length, + info->normalizer, info->flags); + grn_string_get_normalized(ctx, grn_string, + &normalized, + &normalized_length_in_bytes, + &normalized_n_characters); + if (result_str->reserve(normalized_length_in_bytes)) { + my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); + goto error; + } + result_str->q_append(normalized, normalized_length_in_bytes); + result_str->length(normalized_length_in_bytes); + grn_obj_unlink(ctx, grn_string); + } + *is_null = 0; + + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + goto error; + } + + *length = result_str->length(); + return (char *)result_str->ptr(); + +error: + *is_null = 1; + *error = 1; + return NULL; +} + +MRN_API void mroonga_normalize_deinit(UDF_INIT *init) +{ + st_mrn_normalize_info *info = (st_mrn_normalize_info *)init->ptr; + + if (info) { + MRN_STRING_FREE(info->result_str); + if (info->normalizer) { + grn_obj_unlink(info->ctx, info->normalizer); + } + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + } +} + +MRN_END_DECLS diff --git a/storage/mroonga/udf/mrn_udf_query_expand.cpp b/storage/mroonga/udf/mrn_udf_query_expand.cpp new file mode 100644 index 00000000000..562499242fc --- /dev/null +++ b/storage/mroonga/udf/mrn_udf_query_expand.cpp @@ -0,0 +1,282 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MRN_BEGIN_DECLS + +extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; + +namespace mrn { + struct QueryExpandInfo { + grn_ctx *ctx; + grn_obj expanded_query; + grn_obj *term_column; + grn_obj *expanded_term_column; + }; +} + +static void mrn_query_expand_info_free(mrn::QueryExpandInfo *info) +{ + MRN_DBUG_ENTER_FUNCTION(); + + if (!info) { + DBUG_VOID_RETURN; + } + + if (info->ctx) { + GRN_OBJ_FIN(info->ctx, &(info->expanded_query)); + if (grn_obj_is_accessor(info->ctx, info->expanded_term_column)) { + grn_obj_unlink(info->ctx, info->expanded_term_column); + } + if (grn_obj_is_accessor(info->ctx, info->term_column)) { + grn_obj_unlink(info->ctx, info->term_column); + } + mrn_context_pool->release(info->ctx); + } + my_free(info); + + DBUG_VOID_RETURN; +} + +MRN_API my_bool mroonga_query_expand_init(UDF_INIT *init, + UDF_ARGS *args, + char *message) +{ + mrn::QueryExpandInfo *info = NULL; + + MRN_DBUG_ENTER_FUNCTION(); + + init->ptr = NULL; + if (args->arg_count != 4) { + sprintf(message, + "mroonga_query_expand(): wrong number of arguments: %u for 4", + args->arg_count); + goto error; + } + if (args->arg_type[0] != STRING_RESULT) { + strcpy(message, + "mroonga_query_expand(): " + "the 1st argument must be table name as string"); + goto error; + } + if (args->arg_type[1] != STRING_RESULT) { + strcpy(message, + "mroonga_query_expand(): " + "the 2nd argument must be term column name as string"); + goto error; + } + if (args->arg_type[2] != STRING_RESULT) { + strcpy(message, + "mroonga_query_expand(): " + "the 3nd argument must be expanded term column name as string"); + goto error; + } + if (args->arg_type[3] != STRING_RESULT) { + strcpy(message, + "mroonga_query_expand(): " + "the 4th argument must be query as string"); + goto error; + } + + init->maybe_null = 1; + + info = static_cast( + mrn_my_malloc(sizeof(mrn::QueryExpandInfo), + MYF(MY_WME | MY_ZEROFILL))); + if (!info) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): failed to allocate memory"); + goto error; + } + + { + const char *current_db_path = MRN_THD_DB_PATH(current_thd); + if (!current_db_path) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): no current database"); + goto error; + } + + mrn::Database *db; + int error = mrn_db_manager->open(current_db_path, &db); + if (error != 0) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): failed to open database: %s", + mrn_db_manager->error_message()); + goto error; + } + info->ctx = mrn_context_pool->pull(); + grn_ctx_use(info->ctx, db->get()); + } + + GRN_TEXT_INIT(&(info->expanded_query), 0); + + { + const char *table_name = args->args[0]; + unsigned int table_name_length = args->lengths[0]; + grn_obj *table = grn_ctx_get(info->ctx, + table_name, + table_name_length); + if (!table) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): table doesn't exist: <%.*s>", + static_cast(table_name_length), + table_name); + goto error; + } + + const char *term_column_name = args->args[1]; + unsigned int term_column_name_length = args->lengths[1]; + info->term_column = grn_obj_column(info->ctx, + table, + term_column_name, + term_column_name_length); + if (!info->term_column) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): term column doesn't exist: <%.*s.%.*s>", + static_cast(table_name_length), + table_name, + static_cast(term_column_name_length), + term_column_name); + goto error; + } + + const char *expanded_term_column_name = args->args[2]; + unsigned int expanded_term_column_name_length = args->lengths[2]; + info->expanded_term_column = grn_obj_column(info->ctx, + table, + expanded_term_column_name, + expanded_term_column_name_length); + if (!info->expanded_term_column) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): " + "expanded term column doesn't exist: <%.*s.%.*s>", + static_cast(table_name_length), + table_name, + static_cast(expanded_term_column_name_length), + expanded_term_column_name); + goto error; + } + } + + init->ptr = reinterpret_cast(info); + + DBUG_RETURN(FALSE); + +error: + mrn_query_expand_info_free(info); + DBUG_RETURN(TRUE); +} + +static void query_expand(mrn::QueryExpandInfo *info, UDF_ARGS *args) +{ + grn_ctx *ctx = info->ctx; + const char *query = args->args[3]; + unsigned int query_length = args->lengths[3]; + + mrn::QueryParser query_parser(info->ctx, + current_thd, + NULL, + NULL, + 0, + NULL); + const char *raw_query; + size_t raw_query_length; + grn_operator default_operator; + grn_expr_flags flags; + query_parser.parse_pragma(query, + query_length, + &raw_query, + &raw_query_length, + &default_operator, + &flags); + GRN_TEXT_SET(info->ctx, + &(info->expanded_query), + query, + raw_query - query); + grn_expr_syntax_expand_query_by_table(ctx, + raw_query, + raw_query_length, + flags, + info->term_column, + info->expanded_term_column, + &(info->expanded_query)); +} + +MRN_API char *mroonga_query_expand(UDF_INIT *init, + UDF_ARGS *args, + char *result, + unsigned long *length, + char *is_null, + char *error) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn::QueryExpandInfo *info = + reinterpret_cast(init->ptr); + grn_ctx *ctx = info->ctx; + + if (!args->args[3]) { + *is_null = 1; + DBUG_RETURN(NULL); + } + + *is_null = 0; + + query_expand(info, args); + + if (ctx->rc) { + char message[MYSQL_ERRMSG_SIZE]; + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_query_expand(): " + "failed to expand: %s", + ctx->errbuf); + my_message(ER_ERROR_ON_WRITE, message, MYF(0)); + goto error; + } + + *length = GRN_TEXT_LEN(&(info->expanded_query)); + DBUG_RETURN(GRN_TEXT_VALUE(&(info->expanded_query))); + +error: + *error = 1; + DBUG_RETURN(NULL); +} + +MRN_API void mroonga_query_expand_deinit(UDF_INIT *init) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn::QueryExpandInfo *info = + reinterpret_cast(init->ptr); + mrn_query_expand_info_free(info); + DBUG_VOID_RETURN; +} + +MRN_END_DECLS diff --git a/storage/mroonga/udf/mrn_udf_snippet.cpp b/storage/mroonga/udf/mrn_udf_snippet.cpp index 22ec0884014..7a35225545d 100644 --- a/storage/mroonga/udf/mrn_udf_snippet.cpp +++ b/storage/mroonga/udf/mrn_udf_snippet.cpp @@ -2,7 +2,7 @@ /* Copyright(C) 2010 Tetsuro IKEDA Copyright(C) 2010-2013 Kentoku SHIBA - Copyright(C) 2011-2014 Kouhei Sutou + Copyright(C) 2011-2017 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,13 +26,21 @@ #include #include #include +#include +#include #include +#include MRN_BEGIN_DECLS +extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; + struct st_mrn_snip_info { - grn_ctx ctx; + grn_ctx *ctx; + grn_obj *db; + bool use_shared_db; grn_obj *snippet; String result_str; }; @@ -42,7 +50,7 @@ static my_bool mrn_snippet_prepare(st_mrn_snip_info *snip_info, UDF_ARGS *args, { unsigned int i; CHARSET_INFO *cs; - grn_ctx *ctx = &snip_info->ctx; + grn_ctx *ctx = snip_info->ctx; long long snip_max_len; long long snip_max_num; long long skip_leading_spaces; @@ -121,12 +129,12 @@ error: return TRUE; } -MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +MRN_API my_bool mroonga_snippet_init(UDF_INIT *init, UDF_ARGS *args, char *message) { uint i; st_mrn_snip_info *snip_info = NULL; bool can_open_snippet = TRUE; - initid->ptr = NULL; + init->ptr = NULL; if (args->arg_count < 11 || (args->arg_count - 11) % 3) { sprintf(message, "Incorrect number of arguments for mroonga_snippet(): %u", @@ -168,8 +176,7 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes goto error; } } - initid->maybe_null = 1; - initid->const_item = 1; + init->maybe_null = 1; if (!(snip_info = (st_mrn_snip_info *) mrn_my_malloc(sizeof(st_mrn_snip_info), MYF(MY_WME | MY_ZEROFILL)))) @@ -177,8 +184,32 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes strcpy(message, "mroonga_snippet() out of memory"); goto error; } - grn_ctx_init(&snip_info->ctx, 0); - grn_db_create(&snip_info->ctx, NULL, 0); + snip_info->ctx = mrn_context_pool->pull(); + { + const char *current_db_path = MRN_THD_DB_PATH(current_thd); + const char *action; + if (current_db_path) { + action = "open database"; + mrn::Database *db; + int error = mrn_db_manager->open(current_db_path, &db); + if (error == 0) { + snip_info->db = db->get(); + grn_ctx_use(snip_info->ctx, snip_info->db); + snip_info->use_shared_db = true; + } + } else { + action = "create anonymous database"; + snip_info->db = grn_db_create(snip_info->ctx, NULL, NULL); + snip_info->use_shared_db = false; + } + if (!snip_info->db) { + sprintf(message, + "mroonga_snippet(): failed to %s: %s", + action, + snip_info->ctx->errbuf); + goto error; + } + } for (i = 1; i < args->arg_count; i++) { if (!args->args[i]) { @@ -191,24 +222,26 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes goto error; } } - initid->ptr = (char *) snip_info; + init->ptr = (char *) snip_info; return FALSE; error: if (snip_info) { - grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx)); - grn_ctx_fin(&snip_info->ctx); + if (!snip_info->use_shared_db) { + grn_obj_close(snip_info->ctx, snip_info->db); + } + mrn_context_pool->release(snip_info->ctx); my_free(snip_info); } return TRUE; } -MRN_API char *mroonga_snippet(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) +MRN_API char *mroonga_snippet(UDF_INIT *init, UDF_ARGS *args, char *result, + unsigned long *length, char *is_null, char *error) { - st_mrn_snip_info *snip_info = (st_mrn_snip_info *) initid->ptr; - grn_ctx *ctx = &snip_info->ctx; + st_mrn_snip_info *snip_info = (st_mrn_snip_info *) init->ptr; + grn_ctx *ctx = snip_info->ctx; String *result_str = &snip_info->result_str; char *target; unsigned int target_length; @@ -286,16 +319,18 @@ error: return NULL; } -MRN_API void mroonga_snippet_deinit(UDF_INIT *initid) +MRN_API void mroonga_snippet_deinit(UDF_INIT *init) { - st_mrn_snip_info *snip_info = (st_mrn_snip_info *) initid->ptr; + st_mrn_snip_info *snip_info = (st_mrn_snip_info *) init->ptr; if (snip_info) { if (snip_info->snippet) { - grn_obj_close(&snip_info->ctx, snip_info->snippet); + grn_obj_close(snip_info->ctx, snip_info->snippet); } MRN_STRING_FREE(snip_info->result_str); - grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx)); - grn_ctx_fin(&snip_info->ctx); + if (!snip_info->use_shared_db) { + grn_obj_close(snip_info->ctx, snip_info->db); + } + mrn_context_pool->release(snip_info->ctx); my_free(snip_info); } } diff --git a/storage/mroonga/udf/mrn_udf_snippet_html.cpp b/storage/mroonga/udf/mrn_udf_snippet_html.cpp new file mode 100644 index 00000000000..99c9edfbba8 --- /dev/null +++ b/storage/mroonga/udf/mrn_udf_snippet_html.cpp @@ -0,0 +1,444 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2015-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MRN_BEGIN_DECLS + +extern mrn::DatabaseManager *mrn_db_manager; +extern mrn::ContextPool *mrn_context_pool; + +typedef struct st_mrn_snippet_html_info +{ + grn_ctx *ctx; + grn_obj *db; + bool use_shared_db; + grn_obj *snippet; + String result_str; + struct { + bool used; + grn_obj *table; + grn_obj *default_column; + } query_mode; +} mrn_snippet_html_info; + +static my_bool mrn_snippet_html_prepare(mrn_snippet_html_info *info, + UDF_ARGS *args, + char *message, + grn_obj **snippet) +{ + MRN_DBUG_ENTER_FUNCTION(); + + grn_ctx *ctx = info->ctx; + int flags = GRN_SNIP_SKIP_LEADING_SPACES; + unsigned int width = 200; + unsigned int max_n_results = 3; + const char *open_tag = ""; + const char *close_tag = ""; + grn_snip_mapping *mapping = GRN_SNIP_MAPPING_HTML_ESCAPE; + grn_obj *expr = NULL; + String *result_str = &(info->result_str); + + *snippet = NULL; + + mrn::encoding::set_raw(ctx, system_charset_info); + if (!(system_charset_info->state & (MY_CS_BINSORT | MY_CS_CSSORT))) { + flags |= GRN_SNIP_NORMALIZE; + } + + *snippet = grn_snip_open(ctx, flags, + width, max_n_results, + open_tag, strlen(open_tag), + close_tag, strlen(close_tag), + mapping); + if (ctx->rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): failed to open grn_snip: <%s>", + ctx->errbuf); + } + goto error; + } + + if (info->query_mode.used) { + if (!info->query_mode.table) { + grn_obj *short_text; + short_text = grn_ctx_at(info->ctx, GRN_DB_SHORT_TEXT); + info->query_mode.table = grn_table_create(info->ctx, + NULL, 0, NULL, + GRN_TABLE_HASH_KEY, + short_text, + NULL); + } + if (!info->query_mode.default_column) { + info->query_mode.default_column = + grn_obj_column(info->ctx, + info->query_mode.table, + GRN_COLUMN_NAME_KEY, + GRN_COLUMN_NAME_KEY_LEN); + } + + grn_obj *record = NULL; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->query_mode.table, expr, record); + if (!expr) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): " + "failed to create expression: <%s>", + ctx->errbuf); + } + goto error; + } + + mrn::QueryParser query_parser(info->ctx, + current_thd, + expr, + info->query_mode.default_column, + 0, + NULL); + grn_rc rc = query_parser.parse(args->args[1], args->lengths[1]); + if (rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): " + "failed to parse query: <%s>", + ctx->errbuf); + } + goto error; + } + + rc = grn_expr_snip_add_conditions(info->ctx, + expr, + *snippet, + 0, + NULL, NULL, + NULL, NULL); + if (rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): " + "failed to add conditions: <%s>", + ctx->errbuf); + } + goto error; + } + } else { + unsigned int i; + for (i = 1; i < args->arg_count; ++i) { + if (!args->args[i]) { + continue; + } + grn_rc rc = grn_snip_add_cond(ctx, *snippet, + args->args[i], args->lengths[i], + NULL, 0, + NULL, 0); + if (rc != GRN_SUCCESS) { + if (message) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): " + "failed to add a condition to grn_snip: <%s>", + ctx->errbuf); + } + goto error; + } + } + } + + result_str->set_charset(system_charset_info); + DBUG_RETURN(FALSE); + +error: + if (expr) { + grn_obj_close(ctx, expr); + } + if (*snippet) { + grn_obj_close(ctx, *snippet); + } + DBUG_RETURN(TRUE); +} + +MRN_API my_bool mroonga_snippet_html_init(UDF_INIT *init, + UDF_ARGS *args, + char *message) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_snippet_html_info *info = NULL; + + init->ptr = NULL; + + if (args->arg_count < 1) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): wrong number of arguments: %u for 1+", + args->arg_count); + goto error; + } + + + for (unsigned int i = 0; i < args->arg_count; ++i) { + switch (args->arg_type[i]) { + case STRING_RESULT: + /* OK */ + break; + case REAL_RESULT: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): all arguments must be string: " + "<%u>=<%g>", + i, *((double *)(args->args[i]))); + goto error; + break; + case INT_RESULT: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): all arguments must be string: " + "<%u>=<%lld>", + i, *((longlong *)(args->args[i]))); + goto error; + break; + default: + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): all arguments must be string: <%u>", + i); + goto error; + break; + } + } + + init->maybe_null = 1; + + info = (mrn_snippet_html_info *)mrn_my_malloc(sizeof(mrn_snippet_html_info), + MYF(MY_WME | MY_ZEROFILL)); + if (!info) { + snprintf(message, MYSQL_ERRMSG_SIZE, + "mroonga_snippet_html(): failed to allocate memory"); + goto error; + } + + info->ctx = mrn_context_pool->pull(); + { + const char *current_db_path = MRN_THD_DB_PATH(current_thd); + const char *action; + if (current_db_path) { + action = "open database"; + mrn::Database *db; + int error = mrn_db_manager->open(current_db_path, &db); + if (error == 0) { + info->db = db->get(); + grn_ctx_use(info->ctx, info->db); + info->use_shared_db = true; + } + } else { + action = "create anonymous database"; + info->db = grn_db_create(info->ctx, NULL, NULL); + info->use_shared_db = false; + } + if (!info->db) { + sprintf(message, + "mroonga_snippet_html(): failed to %s: %s", + action, + info->ctx->errbuf); + goto error; + } + } + + info->query_mode.used = FALSE; + + if (args->arg_count == 2 && + args->attribute_lengths[1] == strlen("query") && + strncmp(args->attributes[1], "query", strlen("query")) == 0) { + info->query_mode.used = TRUE; + info->query_mode.table = NULL; + info->query_mode.default_column = NULL; + } + + { + bool all_keywords_are_constant = TRUE; + for (unsigned int i = 1; i < args->arg_count; ++i) { + if (!args->args[i]) { + all_keywords_are_constant = FALSE; + break; + } + } + + if (all_keywords_are_constant) { + if (mrn_snippet_html_prepare(info, args, message, &(info->snippet))) { + goto error; + } + } else { + info->snippet = NULL; + } + } + + init->ptr = (char *)info; + + DBUG_RETURN(FALSE); + +error: + if (info) { + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + } + DBUG_RETURN(TRUE); +} + +MRN_API char *mroonga_snippet_html(UDF_INIT *init, + UDF_ARGS *args, + char *result, + unsigned long *length, + char *is_null, + char *error) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_snippet_html_info *info = + reinterpret_cast(init->ptr); + + grn_ctx *ctx = info->ctx; + grn_obj *snippet = info->snippet; + String *result_str = &(info->result_str); + + if (!args->args[0]) { + *is_null = 1; + DBUG_RETURN(NULL); + } + + if (!snippet) { + if (mrn_snippet_html_prepare(info, args, NULL, &snippet)) { + goto error; + } + } + + { + char *target = args->args[0]; + unsigned int target_length = args->lengths[0]; + + unsigned int n_results, max_tagged_length; + { + grn_rc rc = grn_snip_exec(ctx, snippet, target, target_length, + &n_results, &max_tagged_length); + if (rc != GRN_SUCCESS) { + my_printf_error(ER_MRN_ERROR_FROM_GROONGA_NUM, + ER_MRN_ERROR_FROM_GROONGA_STR, MYF(0), ctx->errbuf); + goto error; + } + } + + *is_null = 0; + result_str->length(0); + + { + const char *start_tag = "
"; + const char *end_tag = "
"; + size_t start_tag_length = strlen(start_tag); + size_t end_tag_length = strlen(end_tag); + unsigned int max_length_per_snippet = + start_tag_length + end_tag_length + max_tagged_length; + if (result_str->reserve(max_length_per_snippet * n_results)) { + my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); + goto error; + } + + for (unsigned int i = 0; i < n_results; ++i) { + result_str->q_append(start_tag, start_tag_length); + + unsigned int result_length; + grn_rc rc = + grn_snip_get_result(ctx, snippet, i, + (char *)result_str->ptr() + result_str->length(), + &result_length); + if (rc) { + my_printf_error(ER_MRN_ERROR_FROM_GROONGA_NUM, + ER_MRN_ERROR_FROM_GROONGA_STR, MYF(0), ctx->errbuf); + goto error; + } + result_str->length(result_str->length() + result_length); + + result_str->q_append(end_tag, end_tag_length); + } + } + + if (!info->snippet) { + grn_rc rc = grn_obj_close(ctx, snippet); + if (rc != GRN_SUCCESS) { + my_printf_error(ER_MRN_ERROR_FROM_GROONGA_NUM, + ER_MRN_ERROR_FROM_GROONGA_STR, MYF(0), ctx->errbuf); + goto error; + } + } + } + + *length = result_str->length(); + DBUG_RETURN((char *)result_str->ptr()); + +error: + if (!info->snippet && snippet) { + grn_obj_close(ctx, snippet); + } + + *is_null = 1; + *error = 1; + + DBUG_RETURN(NULL); +} + +MRN_API void mroonga_snippet_html_deinit(UDF_INIT *init) +{ + MRN_DBUG_ENTER_FUNCTION(); + + mrn_snippet_html_info *info = + reinterpret_cast(init->ptr); + if (!info) { + DBUG_VOID_RETURN; + } + + if (info->snippet) { + grn_obj_close(info->ctx, info->snippet); + } + if (info->query_mode.used) { + if (info->query_mode.default_column) { + grn_obj_close(info->ctx, info->query_mode.default_column); + } + if (info->query_mode.table) { + grn_obj_close(info->ctx, info->query_mode.table); + } + } + MRN_STRING_FREE(info->result_str); + if (!info->use_shared_db) { + grn_obj_close(info->ctx, info->db); + } + mrn_context_pool->release(info->ctx); + my_free(info); + + DBUG_VOID_RETURN; +} + +MRN_END_DECLS diff --git a/storage/mroonga/udf/sources.am b/storage/mroonga/udf/sources.am index 380ab4b60cf..ac2f098e310 100644 --- a/storage/mroonga/udf/sources.am +++ b/storage/mroonga/udf/sources.am @@ -1,5 +1,9 @@ libmrn_udf_la_SOURCES = \ mrn_udf_last_insert_grn_id.cpp \ mrn_udf_snippet.cpp \ + mrn_udf_snippet_html.cpp \ mrn_udf_command.cpp \ - mrn_udf_escape.cpp + mrn_udf_escape.cpp \ + mrn_udf_normalize.cpp \ + mrn_udf_highlight_html.cpp \ + mrn_udf_query_expand.cpp diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt index 6c448a4e606..e27070f9e0c 100644 --- a/storage/mroonga/vendor/groonga/CMakeLists.txt +++ b/storage/mroonga/vendor/groonga/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright(C) 2012-2015 Brazil +# Copyright(C) 2012-2016 Brazil # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,6 +18,7 @@ cmake_minimum_required(VERSION 2.6.2) # cmake_minimum_required(VERSION 2.6.4) # CentOS 5 set(GRN_PROJECT_NAME "groonga") +set(GRN_PROJECT_LABEL "Groonga") project("${GRN_PROJECT_NAME}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") @@ -39,7 +40,7 @@ if(MSVC) endif() if(CMAKE_C_COMPILER_ID STREQUAL "Clang") - set(CMAKE_COMPILER_IS_CLANGC ON) + set(CMAKE_COMPILER_IS_CLANGCC ON) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_COMPILER_IS_CLANGCXX ON) @@ -59,6 +60,8 @@ else() endif() endif() string(REGEX REPLACE "(^.*=|\n)" "" GRN_VERSION "${GRN_VERSION}") +string(REGEX REPLACE "\\." "," GRN_VERSION_RC "${GRN_VERSION}") +string(REGEX REPLACE "-.*$" "" GRN_VERSION_RC "${GRN_VERSION_RC}") include(CheckIncludeFile) include(CheckFunctionExists) @@ -97,25 +100,25 @@ set(GRN_DEFAULT_ENCODING CACHE STRING "Groonga's default encoding") set(GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD 0 - CACHE STRING "groonga default match escalation threshold") + CACHE STRING "Groonga's default match escalation threshold") set(GRN_DEFAULT_DOCUMENT_ROOT_BASE "html/admin" - CACHE PATH "groonga default document root base path") + CACHE PATH "Groonga's default document root base path") set(GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT "share/${GRN_PROJECT_NAME}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}" - CACHE PATH "groonga default relative document root") + CACHE PATH "Groonga's default relative document root") set(GRN_DEFAULT_DOCUMENT_ROOT "${CMAKE_INSTALL_PREFIX}/${GRN_DATA_DIR}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}" - CACHE PATH "groonga default document root") + CACHE PATH "Groonga's default document root") set(GRN_DEFAULT_DB_KEY "auto" CACHE STRING "Groonga's default DB key management algorithm") set(GRN_STACK_SIZE 1024 CACHE STRING - "DANGER!!! groonga stack size. Normarlly, you should not change this variable.") + "DANGER!!! Groonga's stack size. Normarlly, you should not change this variable.") set(GRN_LOCK_TIMEOUT - 10000000 + 900000 CACHE STRING "timeout to acquire a lock.") set(GRN_LOCK_WAIT_TIME_NANOSECOND @@ -129,42 +132,42 @@ set(GRN_PLUGINS_DIR set(GRN_PLUGIN_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}") set(GRN_DLL_FILENAME "${CMAKE_SHARED_LIBRARY_PREFIX}groonga${CMAKE_SHARED_LIBRARY_SUFFIX}") -set(GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE "synonyms.tsv") +set(GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE + "${GRN_CONFIG_DIR}/synonyms.tsv") set(GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE - "${CMAKE_INSTALL_PREFIX}/${GRN_DATA_DIR}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE}") + "${CMAKE_INSTALL_PREFIX}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE}") set(GRN_RELATIVE_RUBY_SCRIPTS_DIR "${LIB_DIR}/${GRN_PROJECT_NAME}/scripts/ruby") set(GRN_RUBY_SCRIPTS_DIR "${CMAKE_INSTALL_PREFIX}/${GRN_RELATIVE_RUBY_SCRIPTS_DIR}") -if(CMAKE_COMPILER_IS_GNUCC) +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} -std=gnu99") endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX) MY_CHECK_AND_SET_COMPILER_FLAG("-Wall") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-but-set-variable") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-sign-compare") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-pointer-sign") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-missing-field-initializers") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat=2") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat") MY_CHECK_AND_SET_COMPILER_FLAG("-Wstrict-aliasing=2") MY_CHECK_AND_SET_COMPILER_FLAG("-fno-strict-aliasing") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-disabled-optimization") MY_CHECK_AND_SET_COMPILER_FLAG("-Wfloat-equal") MY_CHECK_AND_SET_COMPILER_FLAG("-Wpointer-arith") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wdeclaration-after-statement") MY_CHECK_AND_SET_COMPILER_FLAG("-Wbad-function-cast") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wcast-align") - #MY_CHECK_AND_SET_COMPILER_FLAG("-Wredundant-decls") + if(NOT CMAKE_COMPILER_IS_CLANGCXX) + MY_CHECK_AND_SET_COMPILER_FLAG("-Wcast-align") + endif() + # MY_CHECK_AND_SET_COMPILER_FLAG("-Wredundant-decls") MY_CHECK_AND_SET_COMPILER_FLAG("-Wwrite-strings") MY_CHECK_AND_SET_COMPILER_FLAG("-fexceptions") MY_CHECK_AND_SET_COMPILER_FLAG("-fimplicit-templates") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-clobbered") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-sign-compare") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-missing-field-initializers") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") endif() @@ -304,7 +307,7 @@ else() endif() if(NOT USE_KQUEUE) - ac_check_headers(sys/poll.h) + ac_check_headers(poll.h) if(${HAVE_SYS_POLL_H}) ac_check_funcs(poll) if(${HAVE_POLL}) @@ -339,54 +342,92 @@ if(NOT ${GRN_WITH_ZLIB} STREQUAL "no") endif() endif() +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_lz4_version" + GRN_BUNDLED_LZ4_VERSION) +string(STRIP + "${GRN_BUNDLED_LZ4_VERSION}" + GRN_BUNDLED_LZ4_VERSION) +option(GRN_WITH_BUNDLED_LZ4 "use bundled LZ4" OFF) + set(GRN_WITH_LZ4 "auto" CACHE STRING "Support data compression by LZ4.") if(NOT ${GRN_WITH_LZ4} STREQUAL "no") - if(NOT DEFINED LIBLZ4_FOUND) - pkg_check_modules(LIBLZ4 liblz4) - endif() - if(LIBLZ4_FOUND) - set(GRN_WITH_LZ4 TRUE) + if(GRN_WITH_BUNDLED_LZ4) + set(LIBLZ4_INCLUDE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lz4-${GRN_BUNDLED_LZ4_VERSION}/lib") + set(LZ4_LIBS liblz4) else() - if(${GRN_WITH_LZ4} STREQUAL "yes") - message(FATAL_ERROR "No LZ4 found") + if(NOT DEFINED LIBLZ4_FOUND) + pkg_check_modules(LIBLZ4 liblz4) + endif() + if(LIBLZ4_FOUND) + find_library(LZ4_LIBS + NAMES ${LIBLZ4_LIBRARIES} + PATHS ${LIBLZ4_LIBRARY_DIRS} + NO_DEFAULT_PATH) + set(GRN_WITH_LZ4 TRUE) + else() + if(${GRN_WITH_LZ4} STREQUAL "yes") + message(FATAL_ERROR "No LZ4 found") + endif() + set(GRN_WITH_LZ4 FALSE) endif() - set(GRN_WITH_LZ4 FALSE) endif() endif() + +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_mecab_version" + GRN_BUNDLED_MECAB_VERSION) +string(STRIP + "${GRN_BUNDLED_MECAB_VERSION}" + GRN_BUNDLED_MECAB_VERSION) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_mecab_naist_jdic_version" + GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION) +string(STRIP + "${GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION}" + GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION) +option(GRN_WITH_BUNDLED_MECAB "use bundled MeCab" OFF) + set(GRN_WITH_MECAB "auto" CACHE STRING "use MeCab for morphological analysis") if(NOT ${GRN_WITH_MECAB} STREQUAL "no") - set(GRN_MECAB_CONFIG "mecab-config" CACHE FILEPATH "mecab-config path") - if(NOT CMAKE_CROSSCOMPILING) - find_program(GRN_MECAB_CONFIG_ABSOLUTE_PATH "${GRN_MECAB_CONFIG}") - endif() - if(EXISTS "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}") - execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --inc-dir - OUTPUT_VARIABLE MECAB_INCLUDE_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --libs-only-L - OUTPUT_VARIABLE MECAB_LIBRARY_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(MECAB_LIBRARIES "mecab") - ac_check_lib(${MECAB_LIBRARIES} mecab_new) - if(HAVE_LIBMECAB) - set(GRN_WITH_MECAB TRUE) + if(GRN_WITH_BUNDLED_MECAB) + set(MECAB_INCLUDE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/mecab-${GRN_BUNDLED_MECAB_VERSION}/src") + set(MECAB_LIBRARY_DIRS + "${CMAKE_CURRENT_BUILD_DIR}/vendor/mecab") + set(MECAB_LIBRARIES libmecab) + else() + set(GRN_MECAB_CONFIG "mecab-config" CACHE FILEPATH "mecab-config path") + if(NOT CMAKE_CROSSCOMPILING) + find_program(GRN_MECAB_CONFIG_ABSOLUTE_PATH "${GRN_MECAB_CONFIG}") + endif() + if(EXISTS "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}") + execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --inc-dir + OUTPUT_VARIABLE MECAB_INCLUDE_DIRS + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --libs-only-L + OUTPUT_VARIABLE MECAB_LIBRARY_DIRS + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(MECAB_LIBRARIES "mecab") + ac_check_lib(${MECAB_LIBRARIES} mecab_new) + if(HAVE_LIBMECAB) + set(GRN_WITH_MECAB TRUE) + else() + if(${GRN_WITH_MECAB} STREQUAL "yes") + message(FATAL_ERROR + "No MeCab library found: " + "include directories: <${MECAB_INCLUDE_DIRS}>, " + "library directories: <${MECAB_LIBRARY_DIRS}>") + endif() + set(GRN_WITH_MECAB FALSE) + endif() else() if(${GRN_WITH_MECAB} STREQUAL "yes") - message(FATAL_ERROR - "No MeCab library found: " - "include directories: <${MECAB_INCLUDE_DIRS}>, " - "library directories: <${MECAB_LIBRARY_DIRS}>") + message(FATAL_ERROR "No mecab-config found: <${GRN_MECAB_CONFIG}>") endif() set(GRN_WITH_MECAB FALSE) endif() - else() - if(${GRN_WITH_MECAB} STREQUAL "yes") - message(FATAL_ERROR "No mecab-config found: <${GRN_MECAB_CONFIG}>") - endif() - set(GRN_WITH_MECAB FALSE) endif() else() set(GRN_WITH_MECAB FALSE) @@ -487,41 +528,65 @@ else() set(GRN_WITH_LIBEVENT FALSE) endif() +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_message_pack_version" + GRN_BUNDLED_MESSAGE_PACK_VERSION) +string(STRIP + "${GRN_BUNDLED_MESSAGE_PACK_VERSION}" + GRN_BUNDLED_MESSAGE_PACK_VERSION) +option(GRN_WITH_BUNDLED_MESSAGE_PACK "use bundled MessagePack" OFF) + set(GRN_WITH_MESSAGE_PACK "auto" CACHE STRING "use MessagePack for suggestion") if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no") - if(NOT DEFINED MESSAGE_PACK_FOUND) - pkg_check_modules(MESSAGE_PACK msgpack) - endif() - if(MESSAGE_PACK_FOUND) - set(GRN_WITH_MESSAGE_PACK TRUE) + if(GRN_WITH_BUNDLED_MESSAGE_PACK) + set(MESSAGE_PACK_INCLUDE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/msgpack-${GRN_BUNDLED_MESSAGE_PACK_VERSION}/include") + set(MESSAGE_PACK_LIBS msgpackc) else() - if("${GRN_WITH_MESSAGE_PACK}" STREQUAL "yes" OR - "${GRN_WITH_MESSAGE_PACK}" STREQUAL "auto") - set(MESSAGE_PACK_INCLUDE_DIRS "") - set(MESSAGE_PACK_LIBRARY_DIRS "") - else() - set(MESSAGE_PACK_INCLUDE_DIRS "${GRN_WITH_MESSAGE_PACK}/include") - set(MESSAGE_PACK_LIBRARY_DIRS "${GRN_WITH_MESSAGE_PACK}/lib") + if(NOT DEFINED MESSAGE_PACK_FOUND) + pkg_check_modules(MESSAGE_PACK msgpack) endif() - set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - ac_check_lib(msgpack msgpack_version "${MESSAGE_PACK_LIBRARY_DIRS}") - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - if(HAVE_LIBMSGPACK) - set(MESSAGE_PACK_LIBRARIES "msgpack") + if(MESSAGE_PACK_FOUND) + find_library(MESSAGE_PACK_LIBS + NAMES ${MESSAGE_PACK_LIBRARIES} + PATHS ${MESSAGE_PACK_LIBRARY_DIRS} + NO_DEFAULT_PATH) set(GRN_WITH_MESSAGE_PACK TRUE) else() - if(${GRN_WITH_MESSAGE_PACK} STREQUAL "yes") - message(FATAL_ERROR "No MessagePack found") + if("${GRN_WITH_MESSAGE_PACK}" STREQUAL "yes" OR + "${GRN_WITH_MESSAGE_PACK}" STREQUAL "auto") + set(MESSAGE_PACK_INCLUDE_DIRS "") + set(MESSAGE_PACK_LIBRARY_DIRS "") + else() + set(MESSAGE_PACK_INCLUDE_DIRS "${GRN_WITH_MESSAGE_PACK}/include") + set(MESSAGE_PACK_LIBRARY_DIRS "${GRN_WITH_MESSAGE_PACK}/lib") + endif() + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + ac_check_lib(msgpack msgpack_version "${MESSAGE_PACK_LIBRARY_DIRS}") + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + if(HAVE_LIBMSGPACK) + find_library(MESSAGE_PACK_LIBS + NAMES "msgpack" + PATHS ${MESSAGE_PACK_LIBRARY_DIRS} + NO_DEFAULT_PATH) + set(GRN_WITH_MESSAGE_PACK TRUE) + else() + if(${GRN_WITH_MESSAGE_PACK} STREQUAL "yes") + message(FATAL_ERROR "No MessagePack found") + endif() + set(GRN_WITH_MESSAGE_PACK FALSE) endif() - set(GRN_WITH_MESSAGE_PACK FALSE) endif() endif() else() set(GRN_WITH_MESSAGE_PACK FALSE) endif() -find_program(RUBY NAMES "ruby2.1" "ruby21" "ruby") +find_program(RUBY NAMES + "ruby2.3" "ruby23" + "ruby2.2" "ruby22" + "ruby2.1" "ruby21" + "ruby") option(GRN_WITH_MRUBY "use mruby" OFF) if(GRN_WITH_MRUBY) @@ -532,6 +597,7 @@ else() set(MRUBY_INCLUDE_DIRS "") set(MRUBY_LIBS "") endif() +set(MRUBY_DEFINITIONS "MRB_INT64" "HAVE_ONIGMO_H") # TODO: Support using system Onigmo instead of bundled Onigmo. # set(GRN_WITH_ONIGMO ON) @@ -581,4 +647,9 @@ if(NOT GRN_EMBED) DESTINATION "${LIB_DIR}/pkgconfig/") endif() +install(FILES + "COPYING" + "README.md" + DESTINATION "${GRN_DATA_DIR}") + add_subdirectory(vendor/plugins) diff --git a/storage/mroonga/vendor/groonga/Makefile.am b/storage/mroonga/vendor/groonga/Makefile.am index 6f760a52b30..1fc7028ff7e 100644 --- a/storage/mroonga/vendor/groonga/Makefile.am +++ b/storage/mroonga/vendor/groonga/Makefile.am @@ -2,7 +2,7 @@ LOCALES = ja -ACLOCAL_AMFLAGS = ${ACLOCAL_ARGS} -I . +ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = 1.9.6 SUBDIRS = \ build \ @@ -20,16 +20,23 @@ SUBDIRS = \ doc #dist_data_DATA = EXTRA_DIST = \ - README.md \ - bindings \ - version-gen.sh \ - base_version \ - gpg_uid \ CMakeLists.txt \ - config.h.cmake + README.md \ + base_version \ + bindings \ + bundled_lz4_version \ + bundled_mecab_naist_jdic_version \ + bundled_mecab_version \ + config.h.cmake \ + gpg_uid \ + nginx_version \ + version-gen.sh pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = groonga.pc +if GRN_WITH_ARROW +pkgconfig_DATA += groonga-arrow.pc +endif .PHONY: FORCE @@ -42,6 +49,7 @@ include $(srcdir)/version.sh dist-hook: echo "$(GRN_VERSION)" > $(distdir)/version + cd $(distdir) && autoreconf --install --force && find . -name autom4te.cache | xargs rm -fr benchmark: cd test/benchmark && $(MAKE) benchmark @@ -74,8 +82,7 @@ update-latest-release: misc doc/source/install.rst \ doc/source/install/*.rst \ doc/locale/*/LC_MESSAGES/install.po \ - $(GROONGA_ORG_PATH)/index.html \ - $(GROONGA_ORG_PATH)/ja/index.html + $(GROONGA_ORG_PATH)/_config.yml update-po: @for lang in $(LOCALES); do \ diff --git a/storage/mroonga/vendor/groonga/README.md b/storage/mroonga/vendor/groonga/README.md index 09e5764a024..af0b5a7dbb5 100644 --- a/storage/mroonga/vendor/groonga/README.md +++ b/storage/mroonga/vendor/groonga/README.md @@ -6,6 +6,19 @@ Groonga is an open-source fulltext search engine and column store. See doc/source/ directory or http://groonga.org/docs/. +Here are shortcut links: + + * How to install: http://groonga.org/docs/install.html + * Tutorial: http://groonga.org/docs/tutorial.html + * How to build as a developer: http://groonga.org/docs/contribution/development/build.html + +## Community + + * [@groonga on Twitter](https://twitter.com/groonga/) + * [Groonga page on Facebook](https://www.facebook.com/groonga) + * [Mailing list on SourceForge.net](http://lists.sourceforge.net/mailman/listinfo/groonga-talk) + * [Chat room on Gitter](https://gitter.im/groonga/public) + ## Bundled software ### mruby diff --git a/storage/mroonga/vendor/groonga/appveyor.yml b/storage/mroonga/vendor/groonga/appveyor.yml index d755e6b49fd..fca8c229a55 100644 --- a/storage/mroonga/vendor/groonga/appveyor.yml +++ b/storage/mroonga/vendor/groonga/appveyor.yml @@ -1,19 +1,72 @@ version: "{build}" clone_depth: 10 -build_script: - - git submodule update --init - - cmake . -G "Visual Studio 12 2013 Win64" - - cmake --build . --config Debug + +environment: + matrix: + - VS_VERSION: 12 + ARCH: x86 + - VS_VERSION: 12 + ARCH: amd64 + - VS_VERSION: 14 + ARCH: x86 + - VS_VERSION: 14 + ARCH: amd64 notifications: - provider: Email to: - - kou@clear-code.com - - groonga-commit@lists.sourceforge.jp + - groonga-commit@lists.osdn.me on_build_status_changed: true -test: off -# before_test: -# - gem install grntest -# test_script: -# - grntest --groonga src\groonga.exe --base-directory test\command test\command\suite +init: + - set PATH=C:\Ruby22\bin;%PATH% + - set PATH=C:\msys64\usr\bin;%PATH% + - call + "C:\Program Files (x86)\Microsoft Visual Studio %VS_VERSION%.0\VC\vcvarsall.bat" + %ARCH% +# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +install: + - tzutil /s "Tokyo Standard Time" + # - choco install -y imdisk-toolkit + # - mkdir tmp + # - imdisk -a -t file -m tmp -o awe -s 1G -p "/fs:ntfs /q /y" + +build_script: + - git submodule update --init + - cd vendor + - ruby download_mecab.rb + - ruby download_message_pack.rb + - ruby download_lz4.rb + - cd .. + - set CMAKE_GENERATOR_NAME=Visual Studio %VS_VERSION% + - if "%VS_VERSION%" == "12" + set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% 2013 + - if "%VS_VERSION%" == "14" + set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% 2015 + - if "%ARCH%" == "amd64" + set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64 + - cmake . -G "%CMAKE_GENERATOR_NAME%" + -DCMAKE_INSTALL_PREFIX=c:\groonga + -DGRN_WITH_MRUBY=yes + -DGRN_WITH_BUNDLED_MECAB=yes + -DGRN_WITH_BUNDLED_MESSAGE_PACK=yes + -DGRN_WITH_BUNDLED_LZ4=yes + - cmake --build . --config Debug + - cmake --build . --config Debug --target Install + +before_test: + - git clone --depth 1 + https://github.com/groonga/grntest.git + test\command\grntest + - cd test\command\grntest + - bundle install --binstubs=..\bin + - cd ..\..\.. +test_script: + - ruby test\command\bin\grntest + --groonga c:\groonga\bin\groonga.exe + --base-directory test\command + --reporter mark + --n-workers 1 + --timeout 60 + test\command\suite diff --git a/storage/mroonga/vendor/groonga/autogen.sh b/storage/mroonga/vendor/groonga/autogen.sh index 66184bf13be..98dcc83a79e 100755 --- a/storage/mroonga/vendor/groonga/autogen.sh +++ b/storage/mroonga/vendor/groonga/autogen.sh @@ -6,15 +6,20 @@ case `uname -s` in Darwin) homebrew_aclocal=/usr/local/share/aclocal if [ -d $homebrew_aclocal ]; then - ACLOCAL_ARGS="$ACLOCAL_ARGS -I $homebrew_aclocal" + ACLOCAL_PATH="$ACLOCAL_PATH $homebrew_aclocal" fi - gettext_aclocal="$(echo /usr/local/Cellar/gettext/*/share/aclocal)" - if [ -d $gettext_aclocal ]; then - ACLOCAL_ARGS="$ACLOCAL_ARGS -I $gettext_aclocal" + gettext_prefix=/usr/local/Cellar/gettext + if [ -d $gettext_prefix ]; then + gettext_aclocal=$(ls $gettext_prefix/*/share/aclocal | \ + gsort --version-sort | \ + tail -n 1) + if [ -d $gettext_aclocal ]; then + ACLOCAL_PATH="$ACLOCAL_PATH $gettext_aclocal" + fi fi ;; FreeBSD) - ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/" + ACLOCAL_PATH="$ACLOCAL_PATH /usr/local/share/aclocal/" ;; esac @@ -23,4 +28,6 @@ if [ ! -e vendor/mruby-source/.git ]; then fi git submodule update --init -${AUTORECONF:-autoreconf} --force --install +mkdir -p m4 + +${AUTORECONF:-autoreconf} --force --install "$@" diff --git a/storage/mroonga/vendor/groonga/base_version b/storage/mroonga/vendor/groonga/base_version index 25b08bbc78f..bf993904af8 100644 --- a/storage/mroonga/vendor/groonga/base_version +++ b/storage/mroonga/vendor/groonga/base_version @@ -1 +1 @@ -5.0.5 \ No newline at end of file +7.0.7 \ No newline at end of file diff --git a/storage/mroonga/vendor/groonga/benchmark/Makefile.am b/storage/mroonga/vendor/groonga/benchmark/Makefile.am index 310fb4585a3..a2a8b29ab79 100644 --- a/storage/mroonga/vendor/groonga/benchmark/Makefile.am +++ b/storage/mroonga/vendor/groonga/benchmark/Makefile.am @@ -5,17 +5,23 @@ SUBDIRS = \ NONEXISTENT_CXX_SOURCE = nonexistent.cpp if WITH_BENCHMARK -noinst_PROGRAMS = \ - bench-table-factory \ - bench-geo-distance \ - bench-geo-select \ - bench-ctx-create \ - bench-query-optimizer \ - bench-range-select +noinst_PROGRAMS = \ + bench-table-factory \ + bench-geo-distance \ + bench-geo-select \ + bench-ctx-create \ + bench-query-optimizer \ + bench-range-select \ + bench-result-set \ + bench-between-sequential \ + bench-nfkc \ + bench-cache endif EXTRA_DIST = \ - bench-query-optimizer-ddl.grn + bench-geo-select.sh \ + bench-query-optimizer-ddl.grn \ + geo-select-generate-grn.rb AM_CPPFLAGS = \ -I$(srcdir) \ @@ -50,33 +56,56 @@ nodist_EXTRA_bench_query_optimizer_SOURCES = $(NONEXISTENT_CXX_SOURCE) bench_range_select_SOURCES = bench-range-select.c nodist_EXTRA_bench_range_select_SOURCES = $(NONEXISTENT_CXX_SOURCE) +bench_result_set_SOURCES = bench-result-set.c +nodist_EXTRA_bench_result_set_SOURCES = $(NONEXISTENT_CXX_SOURCE) + +bench_between_sequential_SOURCES = bench-between-sequential.c +nodist_EXTRA_bench_between_sequential_SOURCES = $(NONEXISTENT_CXX_SOURCE) + +bench_nfkc_SOURCES = bench-nfkc.c +nodist_EXTRA_bench_nfkc_SOURCES = $(NONEXISTENT_CXX_SOURCE) + +bench_cache_SOURCES = bench-cache.c +nodist_EXTRA_bench_cache_SOURCES = $(NONEXISTENT_CXX_SOURCE) + benchmarks = \ run-bench-table-factory \ run-bench-geo-distance \ run-bench-geo-select \ run-bench-ctx-create \ run-bench-query-optimizer \ - run-bench-range-select + run-bench-range-select \ + run-bench-result-set \ + run-bench-between-sequential \ + run-bench-nfkc \ + run-bench-cache run-bench-table-factory: bench-table-factory @echo $@: - ./bench-table-factory + env \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + ./bench-table-factory run-bench-geo-distance: bench-geo-distance @echo $@: - ./bench-geo-distance + env \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + ./bench-geo-distance run-bench-geo-select: bench-geo-select @echo $@: - env \ - RUBY="$(RUBY)" \ - GROONGA="$(GROONGA)" \ - srcdir="$(srcdir)" \ + env \ + RUBY="$(RUBY)" \ + GROONGA="$(GROONGA)" \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + srcdir="$(srcdir)" \ $(srcdir)/bench-geo-select.sh run-bench-ctx-create: bench-ctx-create @echo $@: - ./bench-ctx-create + env \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + ./bench-ctx-create run-bench-query-optimizer: bench-query-optimizer @echo $@: @@ -99,4 +128,26 @@ run-bench-range-select: bench-range-select GRN_RUBY_SCRIPTS_DIR=$(top_srcdir)/lib/mrb/scripts \ ./bench-range-select +run-bench-result-set: bench-result-set + @echo $@: + env \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + ./bench-result-set + +run-bench-between-sequential: bench-between-sequential + @echo $@: + @[ ! -e tmp ] && ln -s /dev/shm tmp || : + @mkdir -p tmp/between-sequential + env \ + GRN_RUBY_SCRIPTS_DIR="$(top_srcdir)/lib/mrb/scripts" \ + ./bench-between-sequential + +run-bench-nfkc: bench-nfkc + @echo $@: + ./bench-nfkc + +run-bench-cache: bench-cache + @echo $@: + ./bench-cache + benchmark: $(benchmarks) diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-between-sequential.c b/storage/mroonga/vendor/groonga/benchmark/bench-between-sequential.c new file mode 100644 index 00000000000..53bc3af5388 --- /dev/null +++ b/storage/mroonga/vendor/groonga/benchmark/bench-between-sequential.c @@ -0,0 +1,276 @@ +/* -*- c-basic-offset: 2; coding: utf-8 -*- */ +/* + Copyright (C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz + + CFLAGS: -O2 -g + + Groonga: e2971d9a555a90724b76964cc8c8805373500b4a + % make --quiet -C benchmark run-bench-between-sequential + run-bench-between-sequential: + Process 10 times in each pattern + (total) (average) (median) + ( 500, 600] ( 1000): between: (0.0528s) (0.0053s) (0.0043s) + ( 500, 600] ( 1000): range: (0.0120s) (0.0012s) (0.2500ms) + ( 5000, 5100] ( 10000): between: (0.4052s) (0.0405s) (0.0395s) + ( 5000, 5100] ( 10000): range: (0.0197s) (0.0020s) (0.0010s) + ( 50000, 50100] ( 100000): between: (3.9343s) (0.3934s) (0.3900s) + ( 50000, 50100] ( 100000): range: (0.0969s) (0.0097s) (0.0088s) + (500000, 500100] (1000000): between: (38.2969s) (3.8297s) (3.7983s) + (500000, 500100] (1000000): range: (0.9158s) (0.0916s) (0.0900s) + + Groonga: 35e4e431bb7660b3170e98c329f7219bd6723f05 + % make --quiet -C benchmark run-bench-between-sequential + run-bench-between-sequential: + Process 10 times in each pattern + (total) (average) (median) + ( 500, 600] ( 1000): between: (0.0130s) (0.0013s) (0.2590ms) + ( 500, 600] ( 1000): range: (0.0124s) (0.0012s) (0.2530ms) + ( 5000, 5100] ( 10000): between: (0.0163s) (0.0016s) (0.6440ms) + ( 5000, 5100] ( 10000): range: (0.0205s) (0.0021s) (0.0011s) + ( 50000, 50100] ( 100000): between: (0.0611s) (0.0061s) (0.0051s) + ( 50000, 50100] ( 100000): range: (0.1004s) (0.0100s) (0.0091s) + (500000, 500100] (1000000): between: (0.4518s) (0.0452s) (0.0442s) + (500000, 500100] (1000000): range: (0.8866s) (0.0887s) (0.0878s) +*/ + +#include +#include + +#include +#include + +#include "lib/benchmark.h" + +#define GET(context, name) (grn_ctx_get(context, name, strlen(name))) + +typedef struct _BenchmarkData +{ + grn_ctx context; + grn_obj *database; + guint n_records; + const gchar *command; +} BenchmarkData; + +static void +run_command(grn_ctx *context, const gchar *command) +{ + gchar *response; + unsigned int response_length; + int flags; + + grn_ctx_send(context, command, strlen(command), 0); + grn_ctx_recv(context, &response, &response_length, &flags); +} + +static void +bench(gpointer user_data) +{ + BenchmarkData *data = user_data; + grn_ctx *context = &(data->context); + + run_command(context, data->command); +} + +static gchar * +get_tmp_dir(void) +{ + gchar *current_dir; + gchar *tmp_dir; + + current_dir = g_get_current_dir(); + tmp_dir = g_build_filename(current_dir, "tmp", NULL); + g_free(current_dir); + + return tmp_dir; +} + +static void +setup_database(BenchmarkData *data) +{ + grn_ctx *context = &(data->context); + gchar *tmp_dir; + gchar *database_last_component_name; + gchar *database_path; + guint i; + + tmp_dir = get_tmp_dir(); + database_last_component_name = g_strdup_printf("db-%d", data->n_records); + database_path = g_build_filename(tmp_dir, + "between-sequential", + database_last_component_name, + NULL); + g_free(database_last_component_name); + + if (g_file_test(database_path, G_FILE_TEST_EXISTS)) { + data->database = grn_db_open(context, database_path); + run_command(context, "dump"); + } else { + data->database = grn_db_create(context, database_path, NULL); + + run_command(context, "table_create Entries TABLE_NO_KEY"); + run_command(context, "column_create Entries rank COLUMN_SCALAR Int32"); + + run_command(context, "load --table Entries"); + run_command(context, "["); + for (i = 0; i < data->n_records; i++) { +#define BUFFER_SIZE 4096 + gchar buffer[BUFFER_SIZE]; + const gchar *separator; + if (i == (data->n_records - 1)) { + separator = ""; + } else { + separator = ","; + } + snprintf(buffer, BUFFER_SIZE, "{\"rank\": %u}%s", i, separator); + run_command(context, buffer); +#undef BUFFER_SIZE + } + run_command(context, "]"); + } + + g_free(database_path); +} + +static void +bench_startup(BenchmarkData *data) +{ + grn_ctx_init(&(data->context), 0); + setup_database(data); +} + +static void +bench_shutdown(BenchmarkData *data) +{ + grn_ctx *context = &(data->context); + + grn_obj_close(context, data->database); + grn_ctx_fin(context); +} + +int +main(int argc, gchar **argv) +{ + grn_rc rc; + BenchReporter *reporter; + gint n = 10; + + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } + + g_print("Process %d times in each pattern\n", n); + + bench_init(&argc, &argv); + reporter = bench_reporter_new(); + + { + BenchmarkData data_small_between; + BenchmarkData data_small_range; + BenchmarkData data_medium_between; + BenchmarkData data_medium_range; + BenchmarkData data_large_between; + BenchmarkData data_large_range; + BenchmarkData data_very_large_between; + BenchmarkData data_very_large_range; + +#define REGISTER(data, n_records_, min, max, is_between) \ + do { \ + gchar *label; \ + label = \ + g_strdup_printf("(%6d, %6d] (%7d): %7s", \ + min, max, n_records_, \ + is_between ? "between" : "range"); \ + data.n_records = n_records_; \ + if (is_between) { \ + data.command = \ + "select Entries --cache no " \ + "--filter " \ + "'between(rank, " #min ", \"exclude\"," \ + " " #max ", \"include\")'"; \ + } else { \ + data.command = \ + "select Entries --cache no " \ + "--filter 'rank > " #min " && rank <= " #max "'"; \ + } \ + bench_startup(&data); \ + bench_reporter_register(reporter, label, \ + n, \ + NULL, \ + bench, \ + NULL, \ + &data); \ + g_free(label); \ + } while(FALSE) + + REGISTER(data_small_between, + 1000, + 500, 600, + TRUE); + REGISTER(data_small_range, + 1000, + 500, 600, + FALSE); + REGISTER(data_medium_between, + 10000, + 5000, 5100, + TRUE); + REGISTER(data_medium_range, + 10000, + 5000, 5100, + FALSE); + REGISTER(data_large_between, + 100000, + 50000, 50100, + TRUE); + REGISTER(data_large_range, + 100000, + 50000, 50100, + FALSE); + REGISTER(data_very_large_between, + 1000000, + 500000, 500100, + TRUE); + REGISTER(data_very_large_range, + 1000000, + 500000, 500100, + FALSE); + +#undef REGISTER + + bench_reporter_run(reporter); + + bench_shutdown(&data_small_between); + bench_shutdown(&data_small_range); + bench_shutdown(&data_medium_between); + bench_shutdown(&data_medium_range); + bench_shutdown(&data_large_between); + bench_shutdown(&data_large_range); + bench_shutdown(&data_very_large_between); + bench_shutdown(&data_very_large_range); + } + g_object_unref(reporter); + + grn_fin(); + + return EXIT_SUCCESS; +} diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-cache.c b/storage/mroonga/vendor/groonga/benchmark/bench-cache.c new file mode 100644 index 00000000000..ee54209c7ab --- /dev/null +++ b/storage/mroonga/vendor/groonga/benchmark/bench-cache.c @@ -0,0 +1,155 @@ +/* -*- c-basic-offset: 2; coding: utf-8 -*- */ +/* + Copyright (C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + Groonga: eb65125330b3a8f920693ef3ad53011c7412f2c9 + CFLAGS: -O2 -g3 + CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz + + % make --silent -C benchmark run-bench-cache + run-bench-cache: + (total) (average) (median) + 1000: (0.0458s) (0.4576ms) (0.4170ms) + 10000: (0.3464s) (0.0035s) (0.0034s) + % GRN_CACHE_TYPE=persistent make --silent -C benchmark run-bench-cache + run-bench-cache: + (total) (average) (median) + 1000: (0.0480s) (0.4801ms) (0.4700ms) + 10000: (0.4033s) (0.0040s) (0.0040s) + */ + +#include +#include +#include + +#include + +#include "lib/benchmark.h" + +typedef struct _BenchmarkData +{ + grn_ctx *context; + grn_cache *cache; + grn_obj value; +} BenchmarkData; + +static void +bench_n(BenchmarkData *data, gint64 n) +{ + gint64 i; + grn_ctx *ctx; + grn_cache *cache; + grn_obj *value; + grn_obj fetch_buffer; + + ctx = data->context; + cache = data->cache; + value = &(data->value); + GRN_TEXT_INIT(&fetch_buffer, 0); + for (i = 0; i < n; i++) { + char key[GRN_TABLE_MAX_KEY_SIZE]; + grn_snprintf(key, + GRN_TABLE_MAX_KEY_SIZE, + GRN_TABLE_MAX_KEY_SIZE, + "key:%" GRN_FMT_INT64D, + i); + GRN_BULK_REWIND(&fetch_buffer); + grn_cache_fetch(ctx, cache, key, strlen(key), &fetch_buffer); + grn_cache_update(ctx, cache, key, strlen(key), value); + } + GRN_OBJ_FIN(ctx, &fetch_buffer); +} + +static void +bench_1000(gpointer user_data) +{ + BenchmarkData *data = user_data; + bench_n(data, 1000); +} + +static void +bench_10000(gpointer user_data) +{ + BenchmarkData *data = user_data; + bench_n(data, 10000); +} + +static void +bench_setup(gpointer user_data) +{ + BenchmarkData *data = user_data; + + data->cache = grn_cache_open(data->context); + GRN_TEXT_INIT(&(data->value), 0); + while (GRN_TEXT_LEN(&(data->value)) < 1024) { + GRN_TEXT_PUTS(data->context, &(data->value), "XXXXXXXXXXX"); + } +} + +static void +bench_teardown(gpointer user_data) +{ + BenchmarkData *data = user_data; + + grn_obj_close(data->context, &(data->value)); + grn_cache_close(data->context, data->cache); +} + +int +main(int argc, gchar **argv) +{ + grn_rc rc; + BenchmarkData data; + BenchReporter *reporter; + gchar *base_dir; + grn_ctx ctx; + gint n = 100; + + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } + bench_init(&argc, &argv); + + grn_ctx_init(&ctx, 0); + + data.context = &ctx; + + base_dir = g_build_filename(g_get_tmp_dir(), "groonga-bench", NULL); + bench_utils_remove_path_recursive_force(base_dir); + g_mkdir_with_parents(base_dir, 0755); + + reporter = bench_reporter_new(); + bench_reporter_register(reporter, "1000", n, + bench_setup, bench_1000, bench_teardown, &data); + bench_reporter_register(reporter, "10000", n, + bench_setup, bench_10000, bench_teardown, &data); + bench_reporter_run(reporter); + g_object_unref(reporter); + + grn_ctx_fin(&ctx); + + bench_utils_remove_path_recursive_force(base_dir); + + bench_quit(); + grn_fin(); + + return EXIT_SUCCESS; +} diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-ctx-create.c b/storage/mroonga/vendor/groonga/benchmark/bench-ctx-create.c index 3e43519071d..cd6a99a401f 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-ctx-create.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-ctx-create.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2013-2014 Kouhei Sutou + Copyright (C) 2013-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -153,12 +153,18 @@ teardown_database(grn_ctx *context, grn_obj *database) int main(int argc, gchar **argv) { + grn_rc rc; grn_ctx context; BenchmarkData data; BenchReporter *reporter; gint n = 1; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } bench_init(&argc, &argv); grn_ctx_init(&context, 0); @@ -188,5 +194,5 @@ main(int argc, gchar **argv) grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c b/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c index 72d1d79b73f..f77cfb1d3e7 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2009 Kouhei Sutou + Copyright (C) 2009-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -48,6 +48,7 @@ */ #include +#include #include #include @@ -421,11 +422,17 @@ bench_teardown(gpointer user_data) int main(int argc, gchar **argv) { + grn_rc rc; BenchmarkData data; BenchReporter *reporter; gint n = 1000; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } bench_init(&argc, &argv); data.report_result = g_getenv("GROONGA_BENCH_REPORT_RESULT") != NULL; @@ -495,5 +502,5 @@ main(int argc, gchar **argv) bench_quit(); grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c b/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c index 7b57eaaffdc..31be2c7ad17 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2011 Kouhei Sutou + Copyright (C) 2011-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -56,6 +56,7 @@ 2nd: select_in_rectangle (all): (4.61558) */ +#include #include #include @@ -212,11 +213,17 @@ teardown_database(BenchmarkData *data) int main(int argc, gchar **argv) { + grn_rc rc; BenchmarkData data; BenchReporter *reporter; gint n = 100; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } bench_init(&argc, &argv); data.report_result = g_getenv("GROONGA_BENCH_REPORT_RESULT") != NULL; @@ -265,5 +272,5 @@ main(int argc, gchar **argv) bench_quit(); grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-nfkc.c b/storage/mroonga/vendor/groonga/benchmark/bench-nfkc.c new file mode 100644 index 00000000000..96b1c9bc6e2 --- /dev/null +++ b/storage/mroonga/vendor/groonga/benchmark/bench-nfkc.c @@ -0,0 +1,275 @@ +/* -*- c-basic-offset: 2; coding: utf-8 -*- */ +/* + Copyright (C) 2015-2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + Groonga: ed300a833d44eaefa978b5ecf46a96ef91ae0891 + + CFLAGS: -O2 -g + % make --quiet -C benchmark run-bench-nfkc + run-bench-nfkc: + (total) (average) (median) + map1 - switch : (0.0060ms) (0.00060000ms) (0.00000000ms) + map1 - table : (0.00000000ms) (0.00000000ms) (0.00000000ms) + map2 - switch - no change: (0.0010ms) (0.00010000ms) (0.00000000ms) + map2 - table - no change: (0.00000000ms) (0.00000000ms) (0.00000000ms) + map2 - switch - change: (0.0010ms) (0.00010000ms) (0.00000000ms) + map2 - table - change: (0.0010ms) (0.00010000ms) (0.00000000ms) +*/ + +#include +#include + +#include + +#include + +#include "lib/benchmark.h" + +#include "../lib/nfkc50.c" + +#define MAX_UNICODE 0x110000 +#define BUFFER_SIZE 0x100 + +static inline int +ucs2utf8(unsigned int i, unsigned char *buf) +{ + unsigned char *p = buf; + if (i < 0x80) { + *p++ = i; + } else { + if (i < 0x800) { + *p++ = (i >> 6) | 0xc0; + } else { + if (i < 0x00010000) { + *p++ = (i >> 12) | 0xe0; + } else { + if (i < 0x00200000) { + *p++ = (i >> 18) | 0xf0; + } else { + if (i < 0x04000000) { + *p++ = (i >> 24) | 0xf8; + } else if (i < 0x80000000) { + *p++ = (i >> 30) | 0xfc; + *p++ = ((i >> 24) & 0x3f) | 0x80; + } + *p++ = ((i >> 18) & 0x3f) | 0x80; + } + *p++ = ((i >> 12) & 0x3f) | 0x80; + } + *p++ = ((i >> 6) & 0x3f) | 0x80; + } + *p++ = (0x3f & i) | 0x80; + } + *p = '\0'; + return (p - buf); +} + +static void +bench_char_type(gpointer user_data) +{ + uint64_t code_point; + char utf8[7]; + + for (code_point = 1; code_point < MAX_UNICODE; code_point++) { + ucs2utf8(code_point, (unsigned char *)utf8); + grn_nfkc50_char_type(utf8); + } +} + +static void +bench_decompose(gpointer user_data) +{ + uint64_t code_point; + char utf8[7]; + + for (code_point = 1; code_point < MAX_UNICODE; code_point++) { + ucs2utf8(code_point, (unsigned char *)utf8); + grn_nfkc50_decompose(utf8); + } +} + +static void +bench_compose_no_change(gpointer user_data) +{ + uint64_t prefix_code_point; + uint64_t suffix_code_point = 0x61; /* a */ + char prefix_utf8[7]; + char suffix_utf8[7]; + + ucs2utf8(suffix_code_point, (unsigned char *)suffix_utf8); + for (prefix_code_point = 1; + prefix_code_point < MAX_UNICODE; + prefix_code_point++) { + ucs2utf8(prefix_code_point, (unsigned char *)prefix_utf8); + grn_nfkc50_compose(prefix_utf8, suffix_utf8); + } +} + +static void +bench_compose_change(gpointer user_data) +{ + uint64_t prefix_code_point; + uint64_t suffix_code_point = 0x11ba; + char prefix_utf8[7]; + char suffix_utf8[7]; + + ucs2utf8(suffix_code_point, (unsigned char *)suffix_utf8); + for (prefix_code_point = 1; + prefix_code_point < MAX_UNICODE; + prefix_code_point++) { + ucs2utf8(prefix_code_point, (unsigned char *)prefix_utf8); + grn_nfkc50_compose(prefix_utf8, suffix_utf8); + } +} + +/* +static void +check_char_type(gpointer user_data) +{ + uint64_t code_point; + char utf8[7]; + + for (code_point = 1; code_point < MAX_UNICODE; code_point++) { + grn_char_type a; + grn_char_type b; + + ucs2utf8(code_point, (unsigned char *)utf8); + a = grn_nfkc_char_type(utf8); + b = grn_nfkc50_char_type(utf8); + if (a == b) { + continue; + } + printf("%lx: %s: %d != %d\n", code_point, utf8, a, b); + } +} + +static void +check_decompose(gpointer user_data) +{ + uint64_t code_point; + char utf8[7]; + + for (code_point = 1; code_point < MAX_UNICODE; code_point++) { + const char *a; + const char *b; + + ucs2utf8(code_point, (unsigned char *)utf8); + a = grn_nfkc_decompose(utf8); + b = grn_nfkc50_decompose(utf8); + if (a == b) { + continue; + } + if (!a || !b) { + printf("%lx: %s: %s != %s\n", code_point, utf8, a, b); + continue; + } + if (strcmp(a, b) != 0) { + printf("%lx: %s: %s != %s\n", code_point, utf8, a, b); + } + } +} + +static void +check_compose(gpointer user_data) +{ + uint64_t prefix_code_point; + uint64_t suffix_code_point; + char prefix_utf8[7]; + char suffix_utf8[7]; + + for (prefix_code_point = 1; + prefix_code_point < MAX_UNICODE; + prefix_code_point++) { + ucs2utf8(prefix_code_point, (unsigned char *)prefix_utf8); + for (suffix_code_point = 1; + suffix_code_point < MAX_UNICODE; + suffix_code_point++) { + const char *a; + const char *b; + + ucs2utf8(suffix_code_point, (unsigned char *)suffix_utf8); + a = grn_nfkc_compose(prefix_utf8, suffix_utf8); + b = grn_nfkc50_compose(prefix_utf8, suffix_utf8); + if (a == b) { + continue; + } + if (!a || !b) { + printf("%lx-%lx: %s-%s: %s != %s\n", + prefix_code_point, suffix_code_point, + prefix_utf8, suffix_utf8, + a, b); + continue; + } + if (strcmp(a, b) != 0) { + printf("%lx-%lx: %s-%s: %s != %s\n", + prefix_code_point, suffix_code_point, + prefix_utf8, suffix_utf8, + a, b); + } + } + if ((prefix_code_point % 10000) == 0) { + printf("%" G_GUINT64_FORMAT "\n", prefix_code_point); + } + } +} +*/ + +int +main(int argc, gchar **argv) +{ + grn_rc rc; + BenchReporter *reporter; + gint n = 10; + + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } + bench_init(&argc, &argv); + + reporter = bench_reporter_new(); + + if (g_getenv("N")) { + n = atoi(g_getenv("N")); + } + +#define REGISTER(label, bench_function) \ + bench_reporter_register(reporter, label, n, \ + NULL, \ + bench_function, \ + NULL, \ + NULL) + REGISTER("char_type ", bench_char_type); + REGISTER("decompose ", bench_decompose); + REGISTER("compose - no change", bench_compose_no_change); + REGISTER("compose - change", bench_compose_change); + + /* + REGISTER("check - char_type", check_char_type); + REGISTER("check - decompose", check_decompose); + REGISTER("check - compose ", check_compose); + */ +#undef REGISTER + + bench_reporter_run(reporter); + g_object_unref(reporter); + + return EXIT_SUCCESS; +} diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer.c b/storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer.c index d7ed91d0c56..4ce55c55b6a 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2014 Kouhei Sutou + Copyright (C) 2014-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -135,12 +135,18 @@ teardown_database(grn_ctx *context, grn_obj *database) int main(int argc, gchar **argv) { + grn_rc rc; grn_ctx context; grn_obj *database; BenchReporter *reporter; gint n = 100; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } bench_init(&argc, &argv); grn_ctx_init(&context, 0); @@ -204,5 +210,5 @@ main(int argc, gchar **argv) grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c b/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c index d45d453cba6..a0664d58270 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-range-select.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2014 Kouhei Sutou + Copyright (C) 2014-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -179,10 +179,16 @@ bench_shutdown(BenchmarkData *data) int main(int argc, gchar **argv) { + grn_rc rc; BenchReporter *reporter; gint n = 10; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } g_print("Process %d times in each pattern\n", n); @@ -270,5 +276,5 @@ main(int argc, gchar **argv) grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-result-set.c b/storage/mroonga/vendor/groonga/benchmark/bench-result-set.c new file mode 100644 index 00000000000..cd4866e5033 --- /dev/null +++ b/storage/mroonga/vendor/groonga/benchmark/bench-result-set.c @@ -0,0 +1,151 @@ +/* -*- c-basic-offset: 2; coding: utf-8 -*- */ +/* + Copyright (C) 2015-2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include + +#include + +#include "lib/benchmark.h" + +typedef struct _BenchmarkData +{ + gchar *base_dir; + grn_ctx *context; + grn_obj *source_table; + grn_obj *result_set; +} BenchmarkData; + +static void +bench_n(BenchmarkData *data, gint64 n) +{ + gint64 i; + grn_ctx *ctx; + grn_hash *result_set; + + ctx = data->context; + result_set = (grn_hash *)data->result_set; + for (i = 0; i < n; i++) { + grn_id id = i; + grn_hash_add(ctx, result_set, &id, sizeof(grn_id), NULL, NULL); + } +} + +static void +bench_1000(gpointer user_data) +{ + BenchmarkData *data = user_data; + bench_n(data, 1000); +} + +static void +bench_10000(gpointer user_data) +{ + BenchmarkData *data = user_data; + bench_n(data, 10000); +} + +static void +bench_100000(gpointer user_data) +{ + BenchmarkData *data = user_data; + bench_n(data, 100000); +} + +static void +bench_setup(gpointer user_data) +{ + BenchmarkData *data = user_data; + + data->result_set = grn_table_create(data->context, + NULL, 0, NULL, + GRN_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + data->source_table, + NULL); + +} + +static void +bench_teardown(gpointer user_data) +{ + BenchmarkData *data = user_data; + + grn_obj_close(data->context, data->result_set); +} + +int +main(int argc, gchar **argv) +{ + grn_rc rc; + BenchmarkData data; + BenchReporter *reporter; + gchar *base_dir; + grn_ctx ctx; + gint n = 100; + + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } + bench_init(&argc, &argv); + + data.context = &ctx; + + base_dir = g_build_filename(g_get_tmp_dir(), "groonga-bench", NULL); + bench_utils_remove_path_recursive_force(base_dir); + g_mkdir_with_parents(base_dir, 0755); + + { + gchar *database_path; + const gchar *source_table_name = "Sources"; + + grn_ctx_init(&ctx, 0); + database_path = g_build_filename(base_dir, "db", NULL); + grn_db_create(&ctx, database_path, NULL); + g_free(database_path); + + data.source_table = grn_table_create(&ctx, + source_table_name, + strlen(source_table_name), + NULL, + GRN_TABLE_PAT_KEY | GRN_OBJ_PERSISTENT, + grn_ctx_at(&ctx, GRN_DB_SHORT_TEXT), + NULL); + } + + reporter = bench_reporter_new(); + bench_reporter_register(reporter, "1000", n, + bench_setup, bench_1000, bench_teardown, &data); + bench_reporter_register(reporter, "10000", n, + bench_setup, bench_10000, bench_teardown, &data); + bench_reporter_register(reporter, "100000", n, + bench_setup, bench_100000, bench_teardown, &data); + bench_reporter_run(reporter); + g_object_unref(reporter); + + grn_ctx_fin(&ctx); + + bench_utils_remove_path_recursive_force(data.base_dir); + + bench_quit(); + grn_fin(); + + return EXIT_SUCCESS; +} diff --git a/storage/mroonga/vendor/groonga/benchmark/bench-table-factory.c b/storage/mroonga/vendor/groonga/benchmark/bench-table-factory.c index 7e06874dffd..9e378f5530b 100644 --- a/storage/mroonga/vendor/groonga/benchmark/bench-table-factory.c +++ b/storage/mroonga/vendor/groonga/benchmark/bench-table-factory.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008 Kouhei Sutou + Copyright (C) 2008-2016 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,7 @@ */ #include +#include #include @@ -226,11 +227,17 @@ bench_teardown(gpointer user_data) int main(int argc, gchar **argv) { + grn_rc rc; BenchmarkData data; BenchReporter *reporter; gint n = 100; - grn_init(); + rc = grn_init(); + if (rc != GRN_SUCCESS) { + g_print("failed to initialize Groonga: <%d>: %s\n", + rc, grn_get_global_error_message()); + return EXIT_FAILURE; + } bench_init(&argc, &argv); data.context = g_new(grn_ctx, 1); @@ -266,5 +273,5 @@ main(int argc, gchar **argv) bench_quit(); grn_fin(); - return 0; + return EXIT_SUCCESS; } diff --git a/storage/mroonga/vendor/groonga/benchmark/lib/Makefile.am b/storage/mroonga/vendor/groonga/benchmark/lib/Makefile.am index 55d113f92e9..2031b9aad8c 100644 --- a/storage/mroonga/vendor/groonga/benchmark/lib/Makefile.am +++ b/storage/mroonga/vendor/groonga/benchmark/lib/Makefile.am @@ -9,6 +9,9 @@ AM_CPPFLAGS = \ AM_CFLAGS = \ $(GLIB_CFLAGS) +CFLAGS += \ + $(NO_BAD_FUNCTION_CAST_CFLAGS) + LIBS = \ $(GLIB_LIBS) diff --git a/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 b/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 index 02eb52f30a6..a0b424b3111 100644 --- a/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 +++ b/storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 @@ -2,8 +2,6 @@ AC_CHECK_FUNCS(_gmtime64_s) AC_CHECK_FUNCS(_localtime64_s) -AC_CHECK_FUNCS(_stricmp) -AC_CHECK_FUNCS(_strnicmp) AC_CHECK_FUNCS(_strtoui64) AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(localtime_r) diff --git a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 index 9a30ca8fc9c..fca8465123c 100644 --- a/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 +++ b/storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 @@ -7,10 +7,6 @@ AC_CHECK_HEADERS(execinfo.h) AC_CHECK_HEADERS(inttypes.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(signal.h) -AC_CHECK_HEADERS(stdarg.h) -AC_CHECK_HEADERS(stdint.h) -AC_CHECK_HEADERS(string.h) -AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(sys/mman.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/resource.h) diff --git a/storage/mroonga/vendor/groonga/build/makefiles/gettext.am b/storage/mroonga/vendor/groonga/build/makefiles/gettext.am index 9cea8ce63c1..c6e57c7b47b 100644 --- a/storage/mroonga/vendor/groonga/build/makefiles/gettext.am +++ b/storage/mroonga/vendor/groonga/build/makefiles/gettext.am @@ -59,8 +59,6 @@ build: endif html: build -man: build -pdf: build gettext: rm *.pot || true diff --git a/storage/mroonga/vendor/groonga/build/makefiles/sphinx-build.am b/storage/mroonga/vendor/groonga/build/makefiles/sphinx-build.am index e237377ba80..047823b6ed7 100644 --- a/storage/mroonga/vendor/groonga/build/makefiles/sphinx-build.am +++ b/storage/mroonga/vendor/groonga/build/makefiles/sphinx-build.am @@ -2,18 +2,13 @@ DOCTREES_BASE = doctrees SPHINXOPTS = -PAPER = # Internal variables. SOURCE_DIR = $(abs_top_srcdir)/doc/source -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR) +ALLSPHINXOPTS = -E $(SPHINXOPTS) $(SOURCE_DIR) -SPHINX_DIR = $(abs_top_builddir)/doc/sphinx -SPHINX_BUILD_COMMAND = \ - DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \ +SPHINX_BUILD_COMMAND = \ + DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \ DOCUMENT_VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \ - LOCALE="$(LOCALE)" \ - PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" \ + LOCALE="$(LOCALE)" \ $(SPHINX_BUILD) diff --git a/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am b/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am index c68f62e26ec..161abe06757 100644 --- a/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am +++ b/storage/mroonga/vendor/groonga/build/makefiles/sphinx.am @@ -3,7 +3,6 @@ include $(top_srcdir)/build/makefiles/sphinx-build.am $(html_files): html-build-stamp $(html_files_relative_from_locale_dir): html-build-stamp -$(man_files): man-build-stamp am__nobase_dist_doc_locale_DATA_DIST = if DOCUMENT_AVAILABLE @@ -22,41 +21,16 @@ document_source_files = \ required_build_stamps = \ html-build-stamp \ - man-build-stamp \ mo-build-stamp if DOCUMENT_BUILDABLE EXTRA_DIST += $(required_build_stamps) endif -man_files = \ - man/$(PACKAGE_NAME).1 - generated_files = \ $(DOCTREES_BASE) \ - man \ - man-build-stamp \ html \ - html-build-stamp \ - pdf \ - pdf-build-stamp \ - dirhtml \ - dirhtml-build-stamp \ - pickle \ - pikcle-build-stamp \ - json \ - json-build-stamp \ - htmlhelp \ - htmlhelp-build-stamp \ - qthelp \ - qthelp-build-stamp \ - latex \ - latex-build-stamp \ - changes \ - changes-build-stamp \ - linkcheck \ - linkcheck-build-stamp \ - doctest + html-build-stamp $(mo_files_relative_from_locale_dir): mo-build-stamp @@ -75,83 +49,24 @@ maintainer-clean-local: endif .PHONY: help -.PHONY: man clean-man .PHONY: html clean-html -.PHONY: pdf -.PHONY: dirhtml -.PHONY: pickle -.PHONY: json -.PHONY: htmlhelp -.PHONY: qthelp -.PHONY: latex -.PHONY: changes -.PHONY: linkcheck -.PHONY: doctest if DOCUMENT_BUILDABLE help: @echo "Please use \`make ' where is one of" - @echo " man to make man files" @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " rdoc to make RDoc files" - @echo " textile to make Textile files" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" -man: man-build-stamp html: html-recursive html-build-stamp -dirhtml: dirhtml-build-stamp -pickle: pickle-build-stamp -json: json-build-stamp -htmlhelp: htmlhelp-build-stamp -qthelp: qthelp-build-stamp -latex: latex-build-stamp -rdoc: rdoc-build-stamp -textile: textile-build-stamp -changes: changes-build-stamp -linkcheck: linkcheck-build-stamp -doctest: doctest-build-stamp clean_targets = \ - clean-man \ - clean-html \ - clean-dirhtml \ - clean-pickle \ - clean-json \ - clean-htmlhelp \ - clean-qthelp \ - clean-latex \ - clean-rdoc \ - clean-textile \ - clean-changes \ - clean-linkcheck \ - clean-doctest + clean-html $(clean_targets): target=`echo $@ | sed -e 's/^clean-//'`; \ rm -rf $${target}-build-stamp $${target} build_stamps = \ - man-build-stamp \ - html-build-stamp \ - dirhtml-build-stamp \ - pickle-build-stamp \ - json-build-stamp \ - htmlhelp-build-stamp \ - qthelp-build-stamp \ - latex-build-stamp \ - rdoc-build-stamp \ - textile-build-stamp \ - changes-build-stamp \ - linkcheck-build-stamp \ - doctest-build-stamp + html-build-stamp $(build_stamps): $(document_source_files) target=`echo $@ | sed -e 's/-build-stamp$$//'`; \ @@ -162,18 +77,4 @@ $(build_stamps): $(document_source_files) $(ALLSPHINXOPTS) \ $${target} @touch $@ - -qthelp: qthelp-message -qthelp-message: qthelp-build-stamp - @echo "Build finished; now you can run 'qcollectiongenerator' with the" \ - ".qhcp project file in qthelp/*, like this:" - @echo "# qcollectiongenerator qthelp/groonga.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile qthelp/groonga.qhc" - -latex: latex-message -latex-message: latex-build-stamp - @echo "Build finished; the LaTeX files are in latex/*." - @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ - "run these through (pdf)latex." endif diff --git a/storage/mroonga/vendor/groonga/bundled_lz4_version b/storage/mroonga/vendor/groonga/bundled_lz4_version new file mode 100644 index 00000000000..6a126f402d5 --- /dev/null +++ b/storage/mroonga/vendor/groonga/bundled_lz4_version @@ -0,0 +1 @@ +1.7.5 diff --git a/storage/mroonga/vendor/groonga/bundled_mecab_naist_jdic_version b/storage/mroonga/vendor/groonga/bundled_mecab_naist_jdic_version new file mode 100644 index 00000000000..495c21efd6d --- /dev/null +++ b/storage/mroonga/vendor/groonga/bundled_mecab_naist_jdic_version @@ -0,0 +1 @@ +0.6.3b-20111013 diff --git a/storage/mroonga/vendor/groonga/bundled_mecab_version b/storage/mroonga/vendor/groonga/bundled_mecab_version new file mode 100644 index 00000000000..00445f812df --- /dev/null +++ b/storage/mroonga/vendor/groonga/bundled_mecab_version @@ -0,0 +1 @@ +0.996 diff --git a/storage/mroonga/vendor/groonga/bundled_message_pack_version b/storage/mroonga/vendor/groonga/bundled_message_pack_version new file mode 100644 index 00000000000..3e3c2f1e5ed --- /dev/null +++ b/storage/mroonga/vendor/groonga/bundled_message_pack_version @@ -0,0 +1 @@ +2.1.1 diff --git a/storage/mroonga/vendor/groonga/config.h.cmake b/storage/mroonga/vendor/groonga/config.h.cmake index 8e3bdaf216b..bfd0cbdc012 100644 --- a/storage/mroonga/vendor/groonga/config.h.cmake +++ b/storage/mroonga/vendor/groonga/config.h.cmake @@ -3,12 +3,13 @@ /* general constants */ #define CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS}" -#define HOST_CPU "${CMAKE_HOST_SYSTEM_PROCESSOR}" -#define HOST_OS "${CMAKE_HOST_SYSTEM_NAME}" +#define HOST_CPU "${CMAKE_SYSTEM_PROCESSOR}" +#define HOST_OS "${CMAKE_SYSTEM_NAME}" #define VERSION "${VERSION}" #define PACKAGE "${PROJECT_NAME}" #define PACKAGE_NAME "${PROJECT_NAME}" +#define PACKAGE_LABEL "${GRN_PROJECT_LABEL}" #define PACKAGE_STRING "${PROJECT_NAME} ${VERSION}" #define PACKAGE_TARNAME "${PROJECT_NAME}" #define PACKAGE_URL "${PACKAGE_URL}" @@ -84,6 +85,7 @@ #cmakedefine GRN_WITH_CUTTER #cmakedefine GRN_WITH_KYTEA #cmakedefine GRN_WITH_LZ4 +#cmakedefine GRN_WITH_ZSTD #cmakedefine GRN_WITH_MECAB #cmakedefine GRN_WITH_MESSAGE_PACK #cmakedefine GRN_WITH_MRUBY @@ -103,10 +105,6 @@ #cmakedefine HAVE_NETDB_H #cmakedefine HAVE_PTHREAD_H #cmakedefine HAVE_SIGNAL_H -#cmakedefine HAVE_STDARG_H -#cmakedefine HAVE_STDINT_H -#cmakedefine HAVE_STRINGS_H -#cmakedefine HAVE_STRING_H #cmakedefine HAVE_SYS_MMAN_H #cmakedefine HAVE_SYS_PARAM_H #cmakedefine HAVE_SYS_RESOURCE_H @@ -133,8 +131,6 @@ /* functions */ #cmakedefine HAVE__GMTIME64_S #cmakedefine HAVE__LOCALTIME64_S -#cmakedefine HAVE__STRICMP -#cmakedefine HAVE__STRNICMP #cmakedefine HAVE__STRTOUI64 #cmakedefine HAVE_BACKTRACE #cmakedefine HAVE_CLOCK diff --git a/storage/mroonga/vendor/groonga/configure.ac b/storage/mroonga/vendor/groonga/configure.ac index dad29c78f4c..414876c6a26 100644 --- a/storage/mroonga/vendor/groonga/configure.ac +++ b/storage/mroonga/vendor/groonga/configure.ac @@ -1,13 +1,18 @@ AC_PREREQ(2.59) m4_define([groonga_version], m4_include(base_version)) AC_INIT([groonga], groonga_version, [groonga@razil.jp]) +AC_CONFIG_MACRO_DIR([m4]) AM_CONFIG_HEADER(config.h) +GRN_VERSION_RC=`echo groonga_version | sed -e 's/\./,/g'` +AC_SUBST(GRN_VERSION_RC) + AM_INIT_AUTOMAKE([foreign tar-pax subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -PACKAGE_TITLE=Groonga -AC_SUBST(PACKAGE_TITLE) +PACKAGE_LABEL=Groonga +AC_SUBST(PACKAGE_LABEL) +AC_DEFINE_UNQUOTED(PACKAGE_LABEL, ["$PACKAGE_LABEL"], [Label of package]) # for Autoconf 2.60 or earlier. if test -z "${datarootdir}"; then @@ -74,6 +79,8 @@ AC_MSG_RESULT([$solaris]) AC_C_BIGENDIAN AC_PROG_CXX +m4_ifdef([AX_CXX_COMPILE_STDCXX_11], + [AX_CXX_COMPILE_STDCXX_11([ext], [optional])]) AC_PROG_CC m4_ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99]) @@ -142,19 +149,17 @@ TEST_CFLAGS="" TEST_CXXFLAGS="" NO_STRICT_ALIASING_CFLAGS="" NO_FLOAT_EQUAL_CFLAGS="" +NO_BAD_FUNCTION_CAST_CFLAGS="" if test "$GCC" = "yes"; then CHECK_BUILD_FLAG([-Wall]) - CHECK_BUILD_FLAG([-Wextra]) if test "x$check_cflag" = "xno"; then CHECK_BUILD_FLAG([-W]) fi CHECK_BUILD_FLAG([-Wno-unused-but-set-variable]) # FIXME: enable it. - CHECK_BUILD_FLAG([-Wno-unused-parameter]) - CHECK_BUILD_FLAG([-Wno-sign-compare]) CHECK_CFLAG([-Wno-pointer-sign]) - CHECK_BUILD_FLAG([-Wno-missing-field-initializers]) + CHECK_CFLAG([-Wno-declaration-after-statement]) - CHECK_BUILD_FLAG([-Wformat=2]) + CHECK_BUILD_FLAG([-Wformat]) CHECK_BUILD_FLAG([-Wstrict-aliasing=2]) if test "x$check_cflag" = "xyes"; then NO_STRICT_ALIASING_CFLAGS="-fno-strict-aliasing" @@ -166,6 +171,9 @@ if test "$GCC" = "yes"; then fi CHECK_BUILD_FLAG([-Wpointer-arith]) CHECK_CFLAG([-Wbad-function-cast]) + if test "x$check_cflag" = "xyes"; then + NO_BAD_FUNCTION_CAST_CFLAGS="-Wno-bad-function-cast" + fi if test "$CLANG" = "no"; then CHECK_BUILD_FLAG([-Wcast-align]) fi @@ -180,27 +188,16 @@ if test "$GCC" = "yes"; then CHECK_CXXFLAG([-fexceptions]) CHECK_CXXFLAG([-fimplicit-templates]) - - CFLAGS_for_source="$CFLAGS" - CXXFLAGS_for_source="$CXXFLAGS" - CHECK_BUILD_FLAG([-Wno-clobbered]) - if test "x$check_cflag" = "xyes"; then - TEST_CFLAGS="-Wno-clobbered" - fi - if test "x$check_cxxflag" = "xyes"; then - TEST_CXXFLAGS="-Wno-clobbered" - fi - CFLAGS="$CFLAGS_for_source" - CXXFLAGS="$CXXFLAGS_for_source" fi AC_SUBST(TEST_CFLAGS) AC_SUBST(TEST_CXXFLAGS) AC_SUBST(NO_STRICT_ALIASING_CFLAGS) AC_SUBST(NO_FLOAT_EQUAL_CFLAGS) +AC_SUBST(NO_BAD_FUNCTION_CAST_CFLAGS) -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL -m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) +LT_INIT([dlopen win32-dll]) +LT_LANG([Windows Resource]) +LT_OUTPUT LT_CURRENT=0 LT_REVISION=0 @@ -233,19 +230,23 @@ AC_CONFIG_FILES([ lib/mrb/scripts/Makefile lib/mrb/scripts/command_line/Makefile lib/mrb/scripts/context/Makefile + lib/mrb/scripts/expression_tree/Makefile lib/mrb/scripts/initialize/Makefile lib/mrb/scripts/logger/Makefile + lib/mrb/scripts/query_logger/Makefile + lib/proc/Makefile + lib/ts/Makefile include/Makefile include/groonga/Makefile plugins/Makefile plugins/tokenizers/Makefile plugins/suggest/Makefile - plugins/table/Makefile plugins/query_expanders/Makefile plugins/ruby/Makefile plugins/token_filters/Makefile plugins/sharding/Makefile plugins/functions/Makefile + plugins/expression_rewriters/Makefile examples/Makefile examples/dictionary/Makefile examples/dictionary/edict/Makefile @@ -264,19 +265,18 @@ AC_CONFIG_FILES([ packages/windows/language-files/Makefile packages/windows/setup-x64.nsi data/Makefile - data/images/Makefile - data/images/logo/Makefile data/html/Makefile data/munin/Makefile data/init.d/Makefile - data/init.d/redhat/Makefile - data/init.d/redhat/sysconfig/Makefile + data/init.d/centos/Makefile + data/init.d/centos/sysconfig/Makefile data/logrotate.d/Makefile - data/logrotate.d/redhat/Makefile + data/logrotate.d/centos/Makefile data/systemd/Makefile - data/systemd/fedora/Makefile - data/systemd/fedora/sysconfig/Makefile + data/systemd/centos/Makefile + data/systemd/centos/sysconfig/Makefile data/scripts/Makefile + data/tmpfiles.d/Makefile tools/Makefile doc/Makefile doc/locale/Makefile @@ -304,7 +304,10 @@ AC_CONFIG_FILES([ benchmark/fixtures/geo-select/Makefile benchmark/lib/Makefile vendor/Makefile + vendor/lz4/Makefile vendor/onigmo/Makefile + vendor/mecab/Makefile + vendor/message_pack/Makefile vendor/mruby/Makefile ]) @@ -355,14 +358,14 @@ AC_LINK_IFELSE( [ AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [#define _ISOC99_SOURCE + [#define _ISOC99_SOURCE #include ], - [if (fpclassify(0.0)) {return 0;}] + [if (fpclassify(0.0)) {return 0;}] )], [ AC_DEFINE(_ISOC99_SOURCE, [1], [Define to 1 for fpclassify]) - AC_DEFINE(HAVE_FPCLASSIFY, [1], [use fpclassify with _ISOC99_SOURCE]) - AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_FPCLASSIFY, [1], [use fpclassify with _ISOC99_SOURCE]) + AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) @@ -454,7 +457,7 @@ AC_ARG_WITH(stack_size, AC_DEFINE_UNQUOTED(GRN_STACK_SIZE, [$GRN_STACK_SIZE], [stack size]) # lock timeout -GRN_LOCK_TIMEOUT=10000000 +GRN_LOCK_TIMEOUT=900000 AC_ARG_WITH(lock_timeout, [AS_HELP_STRING([--with-lock-timeout=N], [This option specifies how many times Groonga tries to acquire a lock. @@ -609,7 +612,7 @@ if test "x$have_epoll" != "xyes"; then ]) ]) if test "x$have_kqueue" != "xyes"; then - AC_CHECK_HEADER(sys/poll.h, [ + AC_CHECK_HEADER(poll.h, [ AC_CHECK_FUNC(poll, [ have_poll="yes" AC_DEFINE(USE_POLL, [1], [use poll]) @@ -617,7 +620,7 @@ if test "x$have_epoll" != "xyes"; then ]) if test "x$have_poll" != "xyes"; then if test "$os_win32" = "yes"; then - AC_CHECK_HEADER(winsock2.h, [have_select="yes"]) + AC_CHECK_HEADER(winsock2.h, [have_select="yes"]) else AC_CHECK_FUNC(select, [ have_select="yes" @@ -750,18 +753,23 @@ if test "x$RUBY" = "xno"; then else if test "x$RUBY" = "xyes"; then AC_PATH_PROGS(RUBY, - [ruby2.1 ruby21 ruby2.0 ruby20 ruby1.9 ruby19 ruby1.9.1 ruby], + [ dnl + ruby2.3 ruby23 dnl + ruby2.2 ruby22 dnl + ruby2.1 ruby21 dnl + ruby dnl + ], ruby-not-found) if test "$RUBY" != "ruby-not-found"; then ruby_version="`$RUBY --version`" - if echo "$ruby_version" | grep -q -- 'ruby \(1\.9\|2\.\)'; then + if echo "$ruby_version" | grep -q -- 'ruby \(2\.\)'; then ac_cv_ruby_available="yes" else - AC_MSG_WARN([$RUBY isn't Ruby 1.9 or later ($ruby_version)]) + AC_MSG_WARN([$RUBY isn't Ruby 2.0 or later ($ruby_version)]) fi fi else - ruby_not_found_warning_message="$RUBY is not found. Disable HTTP test." + ruby_not_found_warning_message="$RUBY is not found." case "$RUBY" in /*) AC_CHECK_FILE([$RUBY], @@ -791,39 +799,13 @@ AM_CONDITIONAL([WITH_UNIT_TEST], AM_CONDITIONAL([WITH_COMMAND_TEST], [test "$ac_cv_ruby_available" = "yes"]) -# check Inkscape for generating PNG images -inkscape_available="no" -AC_ARG_WITH([inkscape], - AS_HELP_STRING([--with-inkscape=PATH], - [Inkscape path (default: auto)]), - [INKSCAPE="$withval"], - [INKSCAPE="yes"]) - -if test "x$INKSCAPE" = "xno"; then - INKSCAPE= -else - if test "x$INKSCAPE" = "xyes"; then - AC_PATH_PROGS(INKSCAPE, [inkscape], none) - if test "$INKSCAPE" != "none"; then - inkscape_available="yes" - fi - else - AC_CHECK_FILE([$INKSCAPE], - [inkscape_available="yes"], - [AC_MSG_WARN([$INKSCAPE is not found. - Disable PNG image generation.])]) - fi -fi -AC_SUBST(INKSCAPE) -AM_CONDITIONAL([WITH_INKSCAPE], [test "$inkscape_available" = "yes"]) - # check Lemon for generating .c and .h files from .y file lemon_available="no" AC_ARG_WITH([lemon], AS_HELP_STRING([--with-lemon=PATH], [Lemon path (default: auto)]), [LEMON="$withval"], - [: ${LEMON:=auto}]) + [: ${LEMON:=auto}]) if test "$LEMON" = "no"; then LEMON= @@ -842,8 +824,8 @@ else fi else AC_CHECK_FILE([$LEMON], - [lemon_available="yes"], - [AC_MSG_WARN([$LEMON is not found. Disable .y compilation.])]) + [lemon_available="yes"], + [AC_MSG_WARN([$LEMON is not found. Disable .y compilation.])]) fi fi AC_SUBST(LEMON) @@ -925,6 +907,30 @@ if test "x$with_lz4" != "xno"; then fi fi +# Zstandard +AC_ARG_WITH(zstd, + [AS_HELP_STRING([--with-zstd], + [Support data compression by Zstandard. [default=auto]])], + [with_zstd="$withval"], + [with_zstd="auto"]) +if test "x$with_zstd" != "xno"; then + m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([LIBZSTD], + [libzstd], + [GRN_WITH_ZSTD=yes], + [GRN_WITH_ZSTD=no]) + ], + [GRN_WITH_ZSTD=no]) + if test "$GRN_WITH_ZSTD" = "yes"; then + AC_DEFINE(GRN_WITH_ZSTD, [1], + [Support data compression by Zstandard.]) + else + if test "x$with_zstd" != "xauto"; then + AC_MSG_ERROR("No libzstd found") + fi + fi +fi + # jemalloc AC_ARG_WITH(jemalloc, [AS_HELP_STRING([--with-jemalloc], @@ -941,8 +947,38 @@ if test "x$with_jemalloc" != "xno"; then [AC_MSG_ERROR("No libjemalloc found")]) fi +# Apache Arrow +AC_ARG_ENABLE(arrow, + [AS_HELP_STRING([--disable-arrow], + [enable Apache Arrow support. [default=auto-detect]])], + [enable_arrow="$enableval"], + [enable_arrow="auto"]) +if test "x$enable_arrow" != "xno"; then + m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([ARROW], + [arrow >= 0.5.0], + [arrow_available=yes], + [arrow_available=no]) + ], + [arrow_available=no]) + if test "x$arrow_available" = "xyes"; then + AC_DEFINE(GRN_WITH_ARROW, [1], [Enable Apache Arrow support.]) + else + if test "x$enable_arrow" = "xyes"; then + AC_MSG_ERROR("No Apache Arrow found") + fi + fi +fi +AM_CONDITIONAL([GRN_WITH_ARROW], [test "$arrow_available" = "yes"]) + # MeCab # NOTE: MUST be checked last + +BUNDLED_MECAB_VERSION=m4_include([bundled_mecab_version]) +AC_SUBST(BUNDLED_MECAB_VERSION) +BUNDLED_MECAB_NAIST_JDIC_VERSION=m4_include([bundled_mecab_naist_jdic_version]) +AC_SUBST(BUNDLED_MECAB_NAIST_JDIC_VERSION) + AC_ARG_WITH(mecab, [AS_HELP_STRING([--with-mecab], [use MeCab for morphological analysis. [default=yes]])], @@ -1170,6 +1206,9 @@ AC_SUBST(LIBEVENT_CFLAGS) AC_SUBST(LIBEVENT_LIBS) # MessagePack +BUNDLED_MESSAGE_PACK_VERSION=m4_include([bundled_message_pack_version]) +AC_SUBST(BUNDLED_MESSAGE_PACK_VERSION) + AC_ARG_ENABLE(message-pack, [AS_HELP_STRING([--disable-message-pack], [Disable MessagePack support. [default=auto-detect]])], @@ -1203,7 +1242,7 @@ if test "x$enable_message_pack" != "xno"; then if test "x$message_pack_available" = "xyes"; then MESSAGE_PACK_CFLAGS="-I$with_message_pack/include" - MESSAGE_PACK_LIBS="-L$with_message_pack/lib -lmsgpack" + MESSAGE_PACK_LIBS="-L$with_message_pack/lib -lmsgpackc" fi fi @@ -1224,6 +1263,17 @@ AM_CONDITIONAL([ENABLE_SUGGEST_LEARNER], "$libevent_available" = "yes" -a \ "$message_pack_available" = "yes"]) +# Check built-in atomic +case "$host" in + i*86*|x86_64*) + ;; + *) + AC_MSG_CHECKING([for platform which requires libatomic]) + AC_CHECK_LIB(atomic, __atomic_store_8, [ATOMIC_LIBS="-latomic"]) + AC_SUBST(ATOMIC_LIBS) + ;; +esac + # Document AC_MSG_CHECKING([whether enable document]) AC_ARG_ENABLE(document, @@ -1246,10 +1296,10 @@ if test x"$enable_document" != x"no"; then AC_PATH_PROG(SPHINX_BUILD, sphinx-build, []) if test -n "$SPHINX_BUILD"; then sphinx_build_version=`"$SPHINX_BUILD" --version` - if ! echo "$sphinx_build_version" | grep -q ' 1\.[[23]]'; then - AC_MSG_ERROR([ + if ! echo "$sphinx_build_version" | grep -q ' 1\.[[3-6]]'; then + AC_MSG_ERROR([ sphinx-build is old: $sphinx_build_version -Sphinx 1.2 or later is required.]) +Sphinx 1.3 or later is required.]) fi document_available=yes document_buildable=yes @@ -1281,8 +1331,8 @@ fi AC_ARG_WITH([cutter-source-path], AS_HELP_STRING([--with-cutter-source-path=PATH], [Specify Cutter source path for - groonga's release manager.]), - [CUTTER_SOURCE_PATH="$withval"]) + groonga's release manager.]), + [CUTTER_SOURCE_PATH="$withval"]) case "$CUTTER_SOURCE_PATH" in ""|/*) : # do nothing @@ -1330,15 +1380,29 @@ AC_MSG_CHECKING([whether package platform]) AC_ARG_WITH(package-platform, [AS_HELP_STRING([--with-package-platform=PLATFORM], [install package platform related files. [default=no] - (supported package platforms: redhat, fedora)])], + (supported package platforms: centos, centos5, centos6, centos7, fedora)])], [package_platform="$withval"], [package_platform="no"]) +if test "$package_platform" = "centos"; then + distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z") + if grep -q Linux /etc/redhat-release; then + distribution_version=$(cut -d " " -f 4 /etc/redhat-release) + else + distribution_version=$(cut -d " " -f 3 /etc/redhat-release) + fi + distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g') + package_platform="${package_platform}${distribution_version}" +fi AC_MSG_RESULT($package_platform) -AM_CONDITIONAL([REDHAT_PLATFORM], - [test "${package_platform}" = "redhat"]) -AM_CONDITIONAL([FEDORA_PLATFORM], - [test "${package_platform}" = "fedora"]) +AM_CONDITIONAL([CENTOS_PLATFORM], + [test "${package_platform}" != "no"]) +AM_CONDITIONAL([CENTOS_INIT_PLATFORM], + [test "${package_platform}" = "centos5" || + test "${package_platform}" = "centos6"]) +AM_CONDITIONAL([CENTOS_SYSTEMD_PLATFORM], + [test "${package_platform}" = "centos7" || + test "${package_platform}" = "fedora"]) # plugins check relative_pluginsdir_base="\$(PACKAGE)/plugins" @@ -1354,18 +1418,15 @@ AC_SUBST(pluginsdir) expanded_pluginsdir="\${libdir}/${expanded_relative_pluginsdir_base}" AC_SUBST(expanded_pluginsdir) -tokenizers_pluginsdir="\${pluginsdir}/tokenizers" -AC_SUBST(tokenizers_pluginsdir) +tokenizer_pluginsdir="\${pluginsdir}/tokenizers" +AC_SUBST(tokenizer_pluginsdir) -query_expanders_pluginsdir="\${pluginsdir}/query_expanders" -AC_SUBST(query_expanders_pluginsdir) +query_expander_pluginsdir="\${pluginsdir}/query_expanders" +AC_SUBST(query_expander_pluginsdir) suggest_pluginsdir="\${pluginsdir}/suggest" AC_SUBST(suggest_pluginsdir) -table_pluginsdir="\${pluginsdir}/table" -AC_SUBST(table_pluginsdir) - ruby_pluginsdir="\${pluginsdir}/ruby" AC_SUBST(ruby_pluginsdir) @@ -1378,6 +1439,9 @@ AC_SUBST(sharding_pluginsdir) function_pluginsdir="\${pluginsdir}/functions" AC_SUBST(function_pluginsdir) +expression_rewriter_pluginsdir="\${pluginsdir}/expression_rewriters" +AC_SUBST(expression_rewriter_pluginsdir) + AC_MSG_CHECKING(for the suffix of plugin shared libraries) shrext_cmds=$(./libtool --config | grep '^shrext_cmds=') eval $shrext_cmds @@ -1389,12 +1453,13 @@ fi AC_DEFINE_UNQUOTED(GRN_PLUGIN_SUFFIX, ["$suffix"], "plugin suffix") # for query expanders -GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE="synonyms.tsv" +GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE_BASE="synonyms.tsv" +GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE="etc/${PACKAGE}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE_BASE}" AC_DEFINE_UNQUOTED(GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE, ["$GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE"], "The relative synonyms file for TSV query expander") GRN_QUERY_EXPANDER_TSV_SYNONYMS_PATH="` - eval echo ${sysconfdir}/${PACKAGE}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE} + eval echo ${sysconfdir}/${PACKAGE}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE_BASE} `" AC_DEFINE_UNQUOTED(GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE, ["$GRN_QUERY_EXPANDER_TSV_SYNONYMS_PATH"], @@ -1451,8 +1516,7 @@ AC_ARG_WITH(groonga-org-path, AC_SUBST(GROONGA_ORG_PATH) # groonga-httpd -m4_define([nginx_version], m4_include(nginx_version)) -NGINX_VERSION=nginx_version +NGINX_VERSION=m4_include([nginx_version]) AC_SUBST(NGINX_VERSION) # groonga-httpd binary path @@ -1472,6 +1536,12 @@ else fi AM_CONDITIONAL(WITH_GROONGA_HTTPD, test "$enable_groonga_httpd" = "yes") +GROONGA_HTTPD_PID_PATH="` + test \"$prefix\" = NONE && prefix=/usr/local + eval echo ${localstatedir}/run/groonga/groonga-httpd.pid +`" +AC_SUBST(GROONGA_HTTPD_PID_PATH) + # mruby AC_ARG_ENABLE(mruby, [AS_HELP_STRING([--enable-mruby], @@ -1492,12 +1562,17 @@ if test "$enable_mruby" = "yes"; then fi AC_DEFINE(GRN_WITH_MRUBY, [1], [Define to 1 if mruby is enabled.]) MRUBY_CFLAGS="-I\$(top_srcdir)/vendor/mruby-source/include" + GRN_WITH_MRUBY="yes" else MRUBY_CFLAGS="" fi +AC_SUBST(GRN_WITH_MRUBY) AC_SUBST(MRUBY_CFLAGS) AM_CONDITIONAL(WITH_MRUBY, test "$enable_mruby" = "yes") +MRUBY_CPPFLAGS="-DMRB_INT64" +AC_SUBST(MRUBY_CPPFLAGS) + # This option is used in vendor/onigmo/configure AC_ARG_ENABLE(shared-onigmo, [AS_HELP_STRING([--enable-shared-onigmo], @@ -1506,16 +1581,37 @@ AC_ARG_ENABLE(shared-onigmo, [enable_shared_onigmo="no"]) AM_CONDITIONAL(WITH_SHARED_ONIGMO, test "$enable_shared_onigmo" = "yes") -# TODO: Support using system Onigmo instead of bundled Onigmo. -AC_DEFINE(GRN_WITH_ONIGMO, [1], [Use Onigmo.]) -GRN_WITH_ONIGMO="yes" +AC_ARG_WITH(onigmo, + [AS_HELP_STRING([--without-onigmo], + [Don't Use Onigmo. [default=bundled]])], + [with_onigmo="$withval"], + [with_onigmo="bundled"]) +if test "x$with_onigmo" != "xno"; then + GRN_WITH_ONIGMO="yes" + if test "x$with_onigmo" != "xbundled"; then + m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([ONIGMO], [onigmo], + [have_onigmo=yes], + [have_onigmo=no]) + ], + [have_onigmo=no]) + fi + if test "x$with_onigmo" = "xsystem" -a "$have_onigmo" = "no"; then + AC_MSG_ERROR("No Onigmo found") + fi + if test "x$with_onigmo" = "xbundled" -o "$have_onigmo" = "no"; then + AC_CONFIG_SUBDIRS([vendor/onigmo]) + ONIGMO_CFLAGS="-I\$(top_srcdir)/vendor/onigmo-source" + ONIGMO_LIBS="\$(top_builddir)/vendor/onigmo-source/libonigmo.la" + fi + AC_DEFINE(GRN_WITH_ONIGMO, [1], [Use Onigmo.]) +else + GRN_WITH_ONIGMO="no" +fi AC_SUBST(GRN_WITH_ONIGMO) -AC_CONFIG_SUBDIRS([vendor/onigmo]) - -ONIGMO_CFLAGS="-I\$(top_srcdir)/vendor/onigmo-source" -ONIGMO_LIBS="\$(top_builddir)/vendor/onigmo-source/libonig.la" AC_SUBST(ONIGMO_CFLAGS) AC_SUBST(ONIGMO_LIBS) +AM_CONDITIONAL(WITH_BUNDLED_ONIGMO, test "$with_onigmo" != "no" -a "x$have_onigmo" != "xyes") # PCRE GRN_WITH_PCRE=no @@ -1541,6 +1637,30 @@ AC_SUBST(GRN_WITH_PCRE) AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_LIBS_ONLY_L) +# SSL +GRN_WITH_SSL=no +AC_ARG_WITH(ssl, + [AS_HELP_STRING([--without-ssl], + [Don't use SSL module for groonga-httpd. [default=auto-detect]])], + [with_ssl="$withval"], + [with_ssl="auto"]) +if test "x$with_ssl" != "xno"; then + m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([SSL], [libssl], + [_PKG_CONFIG(SSL_LIBS_ONLY_L, [libs-only-L], [libssl]) + SSL_LIBS_ONLY_L="$pkg_cv_SSL_LIBS_ONLY_L" + GRN_WITH_SSL=yes], + [GRN_WITH_SSL=no]) + ], + [GRN_WITH_SSL=no]) + if test "x$with_ssl" = "xyes" -a "$GRN_WITH_SSL" != "yes"; then + AC_MSG_ERROR("No SSL found") + fi +fi +AC_SUBST(GRN_WITH_SSL) +AC_SUBST(SSL_CFLAGS) +AC_SUBST(SSL_LIBS_ONLY_L) + # For package AC_ARG_WITH(rsync-path, [AS_HELP_STRING([--with-rsync-path=PATH], @@ -1549,6 +1669,13 @@ AC_ARG_WITH(rsync-path, [RSYNC_PATH="packages@packages.groonga.org:public"]) AC_SUBST(RSYNC_PATH) +AC_ARG_WITH(launchpad-ppa, + [AS_HELP_STRING([--with-launchpad-ppa=PPA], + [specify Launchpad Personal Package Archive. [default=groonga-ppa]])], + [LAUNCHPAD_PPA="$withval"], + [LAUNCHPAD_PPA="groonga-ppa"]) +AC_SUBST(LAUNCHPAD_PPA) + AC_ARG_WITH(launchpad-uploader-pgp-key, [AS_HELP_STRING([--with-launchpad-uploader-pgp-key=KEY], [specify PGP key UID to upload Groonga packages to Launchpad.])], @@ -1582,15 +1709,19 @@ GROONGA_HTTPD_DEFAULT_DATABASE_PATH="` AC_SUBST(GROONGA_HTTPD_DEFAULT_DATABASE_PATH) AC_OUTPUT([ + lib/metadata.rc packages/rpm/centos/groonga.spec packages/apt/debian/groonga-keyring.postrm packages/apt/env.sh packages/yum/env.sh groonga.pc + groonga-arrow.pc config.sh groonga-httpd-conf.sh data/groonga-httpd.conf + data/logrotate.d/centos/groonga-httpd data/scripts/groonga-httpd-restart + data/systemd/centos/groonga-httpd.service ]) echo "$PACKAGE_NAME $PACKAGE_VERSION configuration:" @@ -1657,11 +1788,16 @@ echo "groonga-httpd:" echo " enable: $enable_groonga_httpd" if test "$enable_groonga_httpd" = "yes"; then echo " default database path: $GROONGA_HTTPD_DEFAULT_DATABASE_PATH" - echo " PCRE: $WITH_PCRE" - if test "$WITH_PCRE" = "yes"; then + echo " PCRE: $GRN_WITH_PCRE" + if test "$GRN_WITH_PCRE" = "yes"; then echo " CFLAGS: $PCRE_CFLAGS" echo " LIBS only -L: $PCRE_LIBS_ONLY_L" fi + echo " SSL: $GRN_WITH_SSL" + if test "$GRN_WITH_SSL" = "yes"; then + echo " CFLAGS: $SSL_CFLAGS" + echo " LIBS only -L: $SSL_LIBS_ONLY_L" + fi fi echo diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh index b98397be05a..e48700af07b 100755 --- a/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh +++ b/storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh @@ -16,6 +16,12 @@ else edict_gz=$2 fi -if zcat $edict_gz | ${base_dir}/edict2grn.rb | groonga $1 > /dev/null; then +if type gzcat > /dev/null 2>&1; then + zcat="gzcat" +else + zcat="zcat" +fi + +if $zcat $edict_gz | ${base_dir}/edict2grn.rb | groonga $1 > /dev/null; then echo "edict data loaded." fi diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html b/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html index aaad128a290..47e81754094 100644 --- a/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html +++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/index.html @@ -16,7 +16,7 @@ - +