diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 30d00706a9f29..cca3fba5325cc 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 3edcdc4c1c559..d7ab0f31991a9 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/wsrep.cmake b/cmake/wsrep.cmake index e6d1379aea3dd..b5dc8b9f15731 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/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 0b501970efad5..5c18098355f61 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 4070168213905..e8881b9604ecf 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 a430a6cb0af09..46bb3a7bcb5f4 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/crc/crc_glue.c b/extra/mariabackup/crc/crc_glue.c index c301cb01e2e04..11d2c21886b0e 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/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 6e6c61e74ccd9..627ef7a4b7228 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 254ecdb740d2c..382a31f859fdc 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 bcab263f1dd2b..69655db5b0b77 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 af00173a4de97..c41fa569f064b 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) { @@ -2683,10 +2661,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 +2782,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)) { @@ -4311,12 +4289,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 +4396,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 045294a2f9e47..8eabf8f0e7e49 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/libmariadb b/libmariadb index 7e53ab3698155..63f841f78f520 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 7e53ab369815590ff92913b581d43eb7786f2fe2 +Subproject commit 63f841f78f520d7f3bcff1fe8cecec9d8c47829d diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc index 5df3080a6ed59..a035031e49a5e 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 5571c345850bf..c0da490dde002 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 5447d935f3c50..69ffdb5b28449 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/not_embedded.inc b/mysql-test/include/not_embedded.inc index 88185af3b15a2..4c168f71979fa 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 9240271077a53..08373095438c9 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_gtid_list.inc b/mysql-test/include/show_gtid_list.inc new file mode 100644 index 0000000000000..96f813f180cbe --- /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 9f83d6c9d6eef..7902c8770a818 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2791,7 +2791,7 @@ ($) # 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); } diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 3c9cbb18bcb8d..ca3145735810a 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 ade8a4f7549de..e57d2ef1dcf0a 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 79e0bdf5e200a..c880df7b39f88 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_view.result b/mysql-test/r/create_drop_view.result index d23b9b713ad1e..8dc10297bdb78 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 1282a98fdef4d..2ee31be3435dd 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/drop.result b/mysql-test/r/drop.result index 3fd5370f47036..37005fb017eab 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/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index fe45338b36f30..1bf8231f4dddd 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 15e4fbec6053a..25d47574b59e4 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/get_diagnostics.result b/mysql-test/r/get_diagnostics.result index a75b775297c9b..63ed6867096a3 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 d888b08351de2..1d6e2193fc97a 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 fe67da8001f1a..3f2e6d39db8aa 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 5b239f0917280..d2118fb56fe7f 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1428,7 +1428,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/intersect.result b/mysql-test/r/intersect.result index 7a0301a23e64d..05adaf160ed65 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/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 5ee31bbe22761..bac33753d4c7b 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/not_windows.require b/mysql-test/r/not_windows.require deleted file mode 100644 index 09aae1ed1d03d..0000000000000 --- 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 f43e6ce18af77..5a9f2fae1e06c 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -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 4f59a2f8c20ea..3ff1f92e94ac1 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/profiling.result b/mysql-test/r/profiling.result index 9644a8afe8d15..bc8dd162481dc 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 ba52176e3bd7e..e10a859cbf9ba 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3388,7 +3388,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' @@ -3478,7 +3478,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 @@ -3550,7 +3550,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) @@ -3568,7 +3568,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) @@ -3586,7 +3586,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) @@ -3604,7 +3604,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) @@ -3622,7 +3622,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) @@ -3640,7 +3640,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) @@ -3766,7 +3766,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' @@ -3784,7 +3784,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' @@ -4407,7 +4407,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; @@ -4614,10 +4614,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 @@ -4626,7 +4626,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 @@ -4992,3 +4992,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/signal.result b/mysql-test/r/signal.result index 671df4b7f172f..09493f0da3088 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 a98d587937ca1..1d597aaf71cb5 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 ddb2901b8a463..3a4dc9db6f85e 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 d068c19b22b34..1f8cb7f063559 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-error.result b/mysql-test/r/sp-error.result index f0bc187485004..40643a97765b8 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -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 0000000000000..0da09586df50a --- /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 535e67046d846..800d83f1f74ef 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 b66faec260f6b..2b15bd09cc455 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' @@ -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/trigger.result b/mysql-test/r/trigger.result index 2b843f68499f4..091cbec4c73b2 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 1258de317ecaf..ae72619b5aeaa 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/view.result b/mysql-test/r/view.result index 635323a5867f1..2d442fe90a9fc 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -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/warnings.result b/mysql-test/r/warnings.result index 5d805ac572a3c..d808479e8ef41 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/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 0000000000000..99f2a57835f97 --- /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 0000000000000..b4627caceb236 --- /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_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 0b7491e436407..75f6450087876 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/t/binlog_flush_binlogs_delete_domain.test b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test new file mode 100644 index 0000000000000..0faafa35a1b1f --- /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 0000000000000..5de549c45bb06 --- /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_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test index e6e54985f6f08..b83991b13565f 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/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result index ed7cb4c51d56c..158d15e9f905a 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 3030a3dc6581f..a46daf30a8f63 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 53411e80251eb..2bf4f50e6d553 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 08bb957c33f84..357b50e0eab86 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 19a50eacca195..fd148d1f26187 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 61a374594833c..e7adbb5403a2e 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/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index 5a27cb65b3d21..93fd45dc9f916 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/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index a2af9082c7223..1b167b611dfb1 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 3290b3dd36ab5..ff7d0a595ab62 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 b36f995d32fee..c86a73618df4c 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -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; 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 0000000000000..17d347a11fb70 --- /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 8b208ff82d5cd..c175a0a0e7a2a 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/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test new file mode 100644 index 0000000000000..209695dca80f8 --- /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 de8310e52d257..739255609ee78 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 dcc4a8d14c3d9..aa4543cf81caf 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 615bc4c30afd7..9f8f7c8448659 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/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc new file mode 100644 index 0000000000000..3c10517933f0e --- /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 0000000000000..48de3a1962db3 --- /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/innodb-on-duplicate-update.result b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result new file mode 100644 index 0000000000000..474ebf33bbda9 --- /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 0000000000000..84bc9dc97692d --- /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 0000000000000..ec7ce044cb794 --- /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 0000000000000..cd5a3c340daf3 --- /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 0000000000000..d2b812642f6a0 --- /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 0000000000000..ae050170b4f86 --- /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 0000000000000..b48207d4497a1 --- /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/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result new file mode 100644 index 0000000000000..169a56a004ebb --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_restart.result @@ -0,0 +1,13 @@ +call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +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 0000000000000..ab3eeb08dc7c2 --- /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/t/innodb-on-duplicate-update.test b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test new file mode 100644 index 0000000000000..cc80198d24aad --- /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 0000000000000..5cec9e1febfc7 --- /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 0000000000000..534b4de87f7b9 --- /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 0000000000000..83a1243180223 --- /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 0000000000000..cffca0cc7735a --- /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 0000000000000..5b4eaae755746 --- /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 0000000000000..d04dd59f7e734 --- /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/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test new file mode 100644 index 0000000000000..92f09ac89b113 --- /dev/null +++ b/mysql-test/suite/innodb/t/truncate_restart.test @@ -0,0 +1,18 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); + +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +--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 0000000000000..9f283a9503fab --- /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 0000000000000..e2213c5d9b738 --- /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/mdev-14447.opt b/mysql-test/suite/mariabackup/mdev-14447.opt new file mode 100644 index 0000000000000..5ac67e950c46d --- /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 0000000000000..3bca7eb570106 --- /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 0000000000000..48f376462314a --- /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/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result index ebbe9efc9df17..436aa7bc23643 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 0000000000000..75a22b78a323f --- /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_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 2849e5b7ae3b6..fbd81cb7146b0 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -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 @@ -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/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test new file mode 100644 index 0000000000000..622e66c5263fd --- /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 0400843c98a47..a1789f027180b 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 0a44dfe89317d..b9394da6fcd20 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/t/cast.test b/mysql-test/t/cast.test index 17e8be839a81d..b514dbb5b2dd8 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 44fd4a0bc6ebc..c6627c05829d1 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/func_json.test b/mysql-test/t/func_json.test index 47ed0c3ca7537..5a5d06d456d6f 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 5e695fbca9c4d..b91ef235fd06f 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/intersect.test b/mysql-test/t/intersect.test index 99a5460629166..98b6d1eb1c6a4 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 e5bc36f685102..6988b2a8e9b06 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/order_by.test b/mysql-test/t/order_by.test index 8722401ccae0f..914911648b2bb 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 097eddd24f17c..0debb777749c9 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/ps.test b/mysql-test/t/ps.test index ec55b9c9d2121..2a16a807542c5 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 29b6764ebc627..1f2f5191f0a5f 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 394dc56556aec..2e7a72cf8d0c9 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-for-loop.test b/mysql-test/t/sp-for-loop.test new file mode 100644 index 0000000000000..6350e9fb9d33b --- /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 3b615d291669e..174419220e7c9 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -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 aeab884670d43..1557ef200e5ef 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 8c26d5a4366a7..637ad40c3168e 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/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 9b09935abbf71..3cd2d0e205301 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 3c33f06d6cf34..b762773b11edf 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/item.cc b/sql/item.cc index b344a9068dbbb..3ed43de573994 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; @@ -3714,20 +3712,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 +3729,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 +3771,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 +3785,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 +3813,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 +3830,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 +3846,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 +3857,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 +3880,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 +3899,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 +3939,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 +3950,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 +3960,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 +4023,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 +4052,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 +4090,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 +4112,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 +4143,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 +4159,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 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 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; } - 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 +4281,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 +4331,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 +4376,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 +4398,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 +4447,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 +4462,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 +4494,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 +4557,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 +4609,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; - } - - 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; + return false; } - - set_handler_by_result_type(arg->result_type()); - return FALSE; + return null_value= false; } @@ -8253,7 +8241,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 8aec1b34b9414..6f6a2060f90c5 100644 --- a/sql/item.h +++ b/sql/item.h @@ -389,6 +389,8 @@ class Settable_routine_parameter virtual const Send_field *get_out_param_info() const { return NULL; } + + virtual Item_param *get_item_param() { return 0; } }; @@ -699,9 +701,6 @@ class Item: public Value_source, 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); /* @@ -1869,9 +1868,10 @@ class Item: public Value_source, 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); @@ -1949,6 +1949,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; @@ -2171,7 +2186,8 @@ class Item_basic_value :public Item 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 @@ -2180,13 +2196,13 @@ class Item_basic_value :public Item 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) {} /* @@ -3062,12 +3078,27 @@ class Item_null_result :public Item_null 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 { /* @@ -3113,9 +3144,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; @@ -3128,7 +3158,6 @@ class Item_param :public Item_basic_value, void fix_temporal(uint32 max_length_arg, uint decimals_arg); -public: struct CONVERSION_INFO { /* @@ -3170,31 +3199,71 @@ class Item_param :public Item_basic_value, } }; + 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(); } @@ -3213,10 +3282,22 @@ class Item_param :public Item_basic_value, 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); @@ -3227,20 +3308,64 @@ class Item_param :public Item_basic_value, 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); @@ -3266,7 +3391,8 @@ class Item_param :public Item_basic_value, } 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 @@ -3307,6 +3433,8 @@ class Item_param :public Item_basic_value, 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: @@ -3519,7 +3647,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; } @@ -4229,7 +4357,8 @@ class Used_tables_and_const_cache */ 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, @@ -4312,6 +4441,7 @@ class Item_func_or_sum: public Item_result_field, 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)) @@ -4526,9 +4656,9 @@ class Item_ref :public Item_ident /** 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); } @@ -4645,7 +4775,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 */ @@ -4672,6 +4803,7 @@ class Item_cache_wrapper :public Item_result_field 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); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index fed7243a8c2f6..191616365fde3 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1365,7 +1365,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]); @@ -4623,7 +4623,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; } @@ -5485,7 +5485,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"; @@ -6627,7 +6627,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 0a3339e7ffe25..1561a78a12a03 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -356,7 +356,7 @@ class Item_in_optimizer: public Item_bool_func 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 659ec29e452be..67269e4dd0edc 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(); } diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a060ed221bffc..aee44a7a01f5b 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 54ffa5a2e6335..7afb94ba332e0 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 eae88cd2e6e32..64794093bec26 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 a66ae7fb5dcc3..064c1f267b40b 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 @@ class Item_row: public Item, 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 3a7d858291301..e47fa17896d0e 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 e48b45fb11e80..55c9d759ddf53 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -182,6 +182,7 @@ class Item_subselect :public Item_result_field, 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 269190ef3df75..8c624b3684aa5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1126,7 +1126,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; @@ -1157,7 +1157,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) if ((!item->fixed && item->fix_fields(thd, args)) || (item= args[0])->check_cols(1)) return TRUE; - with_subselect= args[0]->with_subselect; + m_with_subquery= args[0]->with_subquery(); with_window_func|= args[0]->with_window_func; fix_length_and_dec(); @@ -3447,7 +3447,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; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 3a7684fe7b448..fd170a707c9b7 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 bf744cc24cd40..adc7b2535a9bc 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 8432ab43ad81f..cd0fb5058a661 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 63b0567c5d0ce..a006806966057 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 24da00844bc56..704450aa5475e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6674,6 +6674,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 +6797,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 +7218,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 +9527,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 +9612,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 +10388,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 30829bdb33cf0..dffb6a80d544d 100644 --- a/sql/log.h +++ b/sql/log.h @@ -759,7 +759,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG 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 fd794bfe02b3f..439a8b3404723 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5942,9 +5942,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 } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 72da68816ad15..9cd2eedb55d7f 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/partition_info.cc b/sql/partition_info.cc index 6fdbdfce893b9..0dc9a2638eba6 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -42,13 +42,12 @@ partition_info *partition_info::get_clone(THD *thd) List_iterator part_it(partitions); partition_element *part; - partition_info *clone= new (mem_root) partition_info(); + partition_info *clone= new (mem_root) partition_info(*this); if (!clone) { mem_alloc_error(sizeof(partition_info)); DBUG_RETURN(NULL); } - memcpy(clone, this, sizeof(partition_info)); memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions)); memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions)); clone->bitmaps_are_initialized= FALSE; diff --git a/sql/protocol.cc b/sql/protocol.cc index dbaa8ae6a1e60..fae399e66e2a7 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 d58a2ea4d3e2a..369b072ab4794 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 @@ rpl_binlog_state::append_state(String *str) 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 c473ff40ee925..d30bfa64b87a7 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/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index e7afe7a679ab3..20610117d1427 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 diff --git a/sql/sp_head.cc b/sql/sp_head.cc index f402b4919b93f..829e4cc641420 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1022,6 +1022,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)); @@ -1361,6 +1374,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); } @@ -2065,26 +2088,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) @@ -4177,7 +4181,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); @@ -4777,7 +4781,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 734c0dea3e3d8..8d836732a10cd 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -1795,8 +1795,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,6 +1817,7 @@ class sp_instr_cfetch : public sp_instr uint m_cursor; List m_varlist; + bool m_error_on_no_data; }; // class sp_instr_cfetch : public sp_instr diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 6716aa5417011..b6f9e733af173 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -800,7 +800,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 +835,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 +872,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 658972ece40e9..9b70b1d4c6ba6 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -455,7 +455,7 @@ class sp_cursor : public Sql_alloc 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 19035a4e882cb..2a07ef2ecbe4a 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 78e850dc2d794..901544b691634 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -256,6 +256,7 @@ class Geometry 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 a5265b5a74274..9d3299a63d462 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -7596,6 +7596,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 a37d96934ea9a..25e377be8de3e 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -387,13 +387,15 @@ class Sql_cmd_alter_table : public Sql_cmd_common_alter_table /** 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_class.cc b/sql/sql_class.cc index 02f49b6d645ad..9181e3c96d654 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5029,17 +5029,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 306c13e9b5b76..038e1648596b2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5198,10 +5198,11 @@ class select_unit :public select_result_interceptor 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 @@ -5225,6 +5226,14 @@ class select_unit :public select_result_interceptor 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 487c2b3a0bb0a..ff80e198023d7 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_get_diagnostics.cc b/sql/sql_get_diagnostics.cc index 76973b4daa2ed..e7ab6cc3c75b3 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_lex.cc b/sql/sql_lex.cc index 26ca5a3ad1754..6cb065c3985e5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -827,6 +827,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; } @@ -3032,6 +3033,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); } @@ -5594,6 +5599,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, @@ -5805,7 +5839,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); @@ -6452,6 +6486,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)); @@ -7278,7 +7317,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 6233417bb8081..2ec287e786b4b 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2949,6 +2949,13 @@ struct LEX: public Query_tables_list */ 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) @@ -3473,6 +3480,9 @@ struct LEX: public Query_tables_list 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_parse.cc b/sql/sql_parse.cc index b3a9ad144d5c9..346d1c0f18f29 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3729,6 +3729,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, @@ -6279,6 +6287,24 @@ mysql_execute_command(THD *thd) 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_prepare.cc b/sql/sql_prepare.cc index 775717fe62bcd..243d9d524c2e2 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); -} +#undef get_param_length -/* - 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) +void Item_param::setup_conversion(THD *thd, uchar param_type) { - set_param_str_or_null(param, pos, len, true); + 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); } -#undef get_param_length - -static void setup_one_conversion_function(THD *thd, Item_param *param, - uchar param_type) +void Item_param::setup_conversion_blob(THD *thd) { - 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; + 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->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; - - 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 057d1a9f46c51..93db089b24a10 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 839b98dc785bb..d978a2d58ee8d 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 4105bdddf4e07..8d9a127bca789 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 ff9af8a33b9a8..1a29dcb62ab60 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12857,7 +12857,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 @@ -12895,8 +12895,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) { diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index e2d3f225e475c..de4cd3522a522 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -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 2df84b473b81e..c88991f779504 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5201,12 +5201,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_type.cc b/sql/sql_type.cc index 62dcff33f1dcf..e84bdb1455d2c 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -4376,7 +4376,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; } @@ -4389,6 +4389,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 { @@ -5044,7 +5052,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; } @@ -5056,8 +5063,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; } @@ -5070,7 +5076,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; } @@ -5082,13 +5087,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); } @@ -5100,7 +5106,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; } @@ -5113,10 +5118,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 @@ -5502,3 +5507,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 7c6d1a69f231d..427d59718f66e 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -804,6 +804,9 @@ class Type_handler 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 @@ class Type_handler_decimal_result: public Type_handler_numeric 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 @@ class Type_handler_string_result: public Type_handler } 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 @@ class Type_handler_string_result: public Type_handler 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 @@ class Type_handler_tiny: public Type_handler_general_purpose_int 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 @@ class Type_handler_short: public Type_handler_general_purpose_int 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 @@ class Type_handler_long: public Type_handler_general_purpose_int 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 @@ class Type_handler_longlong: public Type_handler_general_purpose_int 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; }; @@ -1994,6 +2011,8 @@ class Type_handler_float: public Type_handler_real_result 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; }; @@ -2024,6 +2043,8 @@ class Type_handler_double: public Type_handler_real_result 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; }; @@ -2068,6 +2089,8 @@ class Type_handler_time_common: public Type_handler_temporal_result 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; }; @@ -2151,6 +2174,8 @@ class Type_handler_date_common: public Type_handler_temporal_with_date 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 @@ -2225,6 +2250,8 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date 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; }; @@ -2305,6 +2332,8 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date 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; }; @@ -2573,6 +2602,7 @@ class Type_handler_blob_common: public Type_handler_longstr Type_handler_hybrid_field_type *, Type_all_attributes *atrr, Item **items, uint nitems) const; + void Item_param_setup_conversion(THD *thd, Item_param *) const; }; @@ -2674,6 +2704,8 @@ class Type_handler_geometry: public Type_handler_string_result { 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, @@ -2753,6 +2785,8 @@ class Type_handler_typelib: public Type_handler_general_purpose_string const handler *file, const Schema_specification_st *schema) const; + void Item_param_set_param_func(Item_param *param, + uchar **pos, ulong len) const; }; @@ -2819,6 +2853,10 @@ class Type_handler_hybrid_field_type Type_handler_hybrid_field_type(const Type_handler_hybrid_field_type *other) :m_type_handler(other->m_type_handler) { } + 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 40f4f984e0ab5..d987636a2ac58 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_yacc.yy b/sql/sql_yacc.yy index 6ee99a9b29a18..a6f34e12f72ed 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -867,10 +867,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %parse-param { THD *thd } %lex-param { THD *thd } /* - Currently there are 102 shift/reduce conflicts. + Currently there are 104 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 102 +%expect 104 /* Comments for TOKENS. @@ -1028,6 +1028,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 */ @@ -1622,11 +1623,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 + sp_opt_label BIN_NUM TEXT_STRING_filesystem ident_or_empty opt_constraint constraint opt_ident sp_decl_ident sp_block_label opt_place opt_db +%type + label_ident + sp_label + %type TEXT_STRING NCHAR_STRING @@ -1767,6 +1772,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 @@ -1918,7 +1924,9 @@ 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 + explainable_command + opt_lock_wait_timeout + opt_delete_gtid_domain END_OF_INPUT %type call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt @@ -1943,6 +1951,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 @@ -3938,6 +3949,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 { @@ -4237,13 +4264,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; @@ -4297,6 +4328,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 { @@ -4356,14 +4424,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; @@ -4371,7 +4439,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; @@ -4400,6 +4494,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)) @@ -7346,7 +7466,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; @@ -7369,7 +7489,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; } @@ -13628,7 +13748,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 { @@ -13685,6 +13805,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; } diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 0c5c0f85f9b81..fb14acac9024d 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 */ @@ -1030,13 +1031,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 @@ -4090,25 +4095,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)) - MYSQL_YYABORT; - if (!($$.m_index= new (thd->mem_root) sp_assignment_lex(thd, thd->lex))) + if (Lex->sp_for_loop_implicit_cursor_statement(thd, &$$, $4)) 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; } ; @@ -7318,7 +7306,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; @@ -7341,7 +7329,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; } diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 3fdaff0504fd6..4ff6d5f2cfb32 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 50ecacd9960ac..35a0020ef44e9 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 fd759717aaf43..53a8f84fcffd5 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; diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 8107ab12c6b97..188fa3e292beb 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 2cf6c0528c0c5..88bdcfca56512 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 de7a9fb3c0317..e4b00786efa79 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 51fcf87470c3c..a4677f47d10d9 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 0ce0eb9fa0d6a..96ae0a67a6bdd 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 a79fd0a712460..91917b48a2306 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); - - free(g->Sarea); + FreeSarea(g); - 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 5602861df5956..8c2842f8e4113 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 0367aacd05020..57215b2f745a3 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 031fdebe65026..0fb24baa7856e 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 36436931d5915..ad7c21a6b4028 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/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 53f92927b28f7..df47a49152c44 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 @@ buf_page_get_gen( 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 945a1543b72ce..6cd8111e902cf 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 12b148d70f32b..a7f31d90e3ad2 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -3875,16 +3875,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 9d0d9627d26d9..2681441803374 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 @@ buf_flush_or_remove_pages( 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 @@ buf_flush_or_remove_pages( 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 @@ buf_flush_or_remove_pages( /* 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 (err == DB_INTERRUPTED && observer != NULL) { - ut_a(flush); - - flush = false; - err = DB_FAIL; + if (freed) { + break; } - /* 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/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b07140b8dd779..5096a5003a047 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 e7a1d9c9b7723..d0aa841b25a9f 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -1076,7 +1076,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 e3d0effb5ace0..09bbf8b9bc2dc 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -293,7 +293,10 @@ dict_stats_exec_sql( 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)) { + extern bool dict_stats_start_shutdown; + + if (dict_stats_start_shutdown + || !dict_stats_persistent_storage_check(true)) { pars_info_free(pinfo); return(DB_STATS_DO_NOT_EXIST); } @@ -2586,21 +2589,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( @@ -3469,23 +3471,23 @@ dict_stats_drop_index( } 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); + 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); @@ -3615,26 +3617,26 @@ dict_stats_drop_table( if (ret != DB_SUCCESS) { - ut_snprintf(errstr, errstr_sz, - "Unable to delete statistics for table %s.%s: %s." - " They can be deleted later using" + 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';" - " 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), + db_utf8, table_utf8, + ut_strerr(ret), - INDEX_STATS_NAME_PRINT, - db_utf8, table_utf8, + 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); @@ -3798,26 +3800,26 @@ dict_stats_rename_table( && 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" - - " 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); + 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); @@ -3857,26 +3859,26 @@ dict_stats_rename_table( rw_lock_x_unlock(dict_operation_lock); 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, - INDEX_STATS_NAME_PRINT, - ut_strerr(ret), - - INDEX_STATS_NAME_PRINT, - new_db_utf8, new_table_utf8, - old_db_utf8, old_table_utf8); + 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, + INDEX_STATS_NAME_PRINT, + ut_strerr(ret), + + INDEX_STATS_NAME_PRINT, + new_db_utf8, new_table_utf8, + old_db_utf8, old_table_utf8); } return(ret); @@ -3979,7 +3981,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/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 90a3baa6f8347..3b496e3959f2c 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 4d41df1abf99b..7ad7459ea6a03 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 8e9c897274b80..32cd56e78ebd5 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 2eb46001e92af..6a70735936a26 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14547,9 +14547,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); @@ -16400,13 +16400,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), @@ -16493,7 +16493,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); @@ -16501,7 +16501,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); @@ -16521,7 +16521,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); @@ -16529,7 +16529,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); @@ -17282,7 +17282,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); @@ -17909,7 +17909,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."); @@ -21824,7 +21824,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. */ @@ -21833,7 +21833,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 517f2ee7631e3..36e3f6dfceb02 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8972,7 +8972,7 @@ alter_stats_rebuild( # 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 @@ -9254,7 +9254,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++); diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index b597b9224faa8..8f03620b55646 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 44cd5b5f7721b..81a1fb757c724 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -369,6 +369,12 @@ class FlushObserver { || 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 @@ class FlushObserver { /** 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 @@ class FlushObserver { 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 54c001ce478a9..7b739fc033212 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 a68f48295618b..0af2dcf9fa1ac 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/os0file.h b/storage/innobase/include/os0file.h index 064430cbf4bc9..13de798280a2f 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/ut0ut.h b/storage/innobase/include/ut0ut.h index 150fd102a9c9a..7cca4fe875b12 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -391,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 b3e52fa10b1e6..bedfc6fb6f5c6 100644 --- a/storage/innobase/innodb.cmake +++ b/storage/innobase/innodb.cmake @@ -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/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 21450767689ef..8124813f917e3 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -622,6 +622,8 @@ log_group_read_log_seg( lsn_t source_offset; 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); @@ -2962,7 +2964,8 @@ recv_group_scan_log_recs( recv_apply_hashed_log_recs(false); } - start_lsn = end_lsn; + start_lsn = ut_uint64_align_down(end_lsn, + OS_FILE_LOG_BLOCK_SIZE); end_lsn = log_group_read_log_seg( log_sys->buf, group, start_lsn, start_lsn + RECV_SCAN_SIZE); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index e556f6bef6d99..3c0013e600a00 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 9e3119bfd3a30..ba392bb2aa1d9 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 9ea0bdd949c3c..4c412bf763c58 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); - - if (trx_is_interrupted(trx)) { - ib::info() << "Phase III - Flush interrupted"; - return(row_import_error(prebuilt, trx, DB_INTERRUPTED)); + { + FlushObserver observer(prebuilt->table->space, trx, NULL); + buf_LRU_flush_or_remove_pages(prebuilt->table->space, + &observer); + + 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 2200a2092bd36..51b299e1215c1 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); @@ -3652,6 +3652,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)); @@ -3668,7 +3673,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/row0merge.cc b/storage/innobase/row/row0merge.cc index 6a6c65cd70ca9..6f0d7ccdb6148 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -5034,7 +5034,7 @@ row_merge_build_indexes( 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/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index ccf58b9e73f72..dd6289c91e68a 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 c9bd4533fd8f5..93b84bdb20962 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 8d371f67e72a8..232bc855c2f5a 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -293,13 +293,13 @@ class TruncateLogger : public Callback { 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); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 988ddf1a759cc..6982754d79569 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/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 327ebf79211f0..f0dc2fb78bd4e 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 738f713298b26..f35e7884b28e4 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -569,10 +569,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/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc index 48f6b820b8e53..284ea8590136e 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 555c54e91de3b..91c1934f065ab 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -523,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 a9f9d7cc8b2d2..5d8e8c1eeb83b 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 d783ec883f9d7..69349ea6a8d9b 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 038d590054ead..3cf8ff8d3318a 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 7a1d38635d498..f795ad000ec2f 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 e237377ba8033..57bbcd614e15d 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 e86973bdf8812..32e88fd5c3dc0 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 f60b481e0ea23..b1e66904f75f2 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 b0c930c8144e4..d7d5f3c4ad6e0 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 b79e6c03d1802..5713e07422432 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 96fe2b05ee705..abdbfda693905 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 @@ -542,6 +560,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 +617,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 +625,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 +647,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 +770,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 +803,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 +829,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 +839,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 +944,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 +1049,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 +1111,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 +1124,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,19 +1144,51 @@ static my_bool grn_check_lz4_support() return is_lz4_support; } -static MYSQL_SYSVAR_BOOL(libgroonga_support_zlib, mrn_libgroonga_support_zlib, +static MYSQL_SYSVAR_BOOL(libgroonga_support_lz4, mrn_libgroonga_support_lz4, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "The status of libgroonga supports zlib", + "The status of libgroonga supports LZ4", NULL, NULL, - grn_check_zlib_support()); + grn_check_lz4_support()); -static MYSQL_SYSVAR_BOOL(libgroonga_support_lz4, mrn_libgroonga_support_lz4, +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 LZ4", + "The status of libgroonga supports Zstandard", NULL, NULL, - grn_check_lz4_support()); + 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, @@ -1063,7 +1200,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 +1242,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 +1287,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 +1332,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 +1343,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 +1562,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 +1617,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 +1648,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 +1675,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 +1794,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 +1849,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 +1857,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 +1885,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 +1922,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 +1954,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 +1963,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 +1985,11 @@ static int mrn_init(void *p) 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 +2002,8 @@ static int mrn_init(void *p) 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 +2048,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 +2063,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 +2550,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 +2570,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 +2837,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 +2872,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 +2943,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 +2967,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 +3084,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 +3136,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 +3200,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 +3247,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 +3337,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 +3537,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 +3554,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 +3576,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 +3720,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 +3739,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 +3752,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 +3767,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 +3781,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 +3957,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 +3987,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 +4041,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 +4086,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 +4100,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 +4166,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 +4205,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 +4217,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 +4256,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 +4305,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 +4332,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 +4424,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 +4491,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 +4515,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,44 +4536,144 @@ 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); - if (error) - DBUG_RETURN(error); - - error = open_table(name); - if (error) - DBUG_RETURN(error); + uint n_keys = table_share->keys; + KEY *key_info = table->key_info; - error = storage_open_columns(); - if (error) { - grn_obj_unlink(ctx, grn_table); - grn_table = NULL; - DBUG_RETURN(error); - } + 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; - if (!(ha_thd()->open_options & HA_OPEN_FOR_REPAIR)) { - error = storage_open_indexes(name); - if (error) { - 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); + 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; + } } - storage_set_keys_in_use(); - } - - ref_length = sizeof(grn_id); - DBUG_RETURN(0); -} + 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); + + error = open_table(name); + if (error) + DBUG_RETURN(error); + + error = storage_open_columns(); + if (error) { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + + 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; + 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); + DBUG_RETURN(0); +} int ha_mroonga::open_table(const char *name) { @@ -4300,18 +4735,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,25 +4771,31 @@ 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); - } + storage_close_columns(); + } - grn_obj *range = grn_column_ranges[i]; - if (range) { - grn_obj_unlink(ctx, range); - } + 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); } - free(grn_columns); - grn_columns = NULL; - free(grn_column_ranges); - grn_column_ranges = NULL; + grn_obj *range = grn_column_ranges[i]; + if (range) { + grn_obj_unlink(ctx, range); + } } - DBUG_RETURN(error); + free(grn_columns); + grn_columns = NULL; + free(grn_column_ranges); + grn_column_ranges = NULL; } int ha_mroonga::storage_open_indexes(const char *name) @@ -4407,6 +4856,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 +4919,14 @@ int ha_mroonga::storage_open_indexes(const char *name) 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 +4944,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 +5014,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 +5076,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 +5119,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 +5169,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 +5543,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 +5848,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 +5971,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 +5989,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 +6083,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 +6111,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 +6489,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 +6634,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 +6648,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 +6673,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 +6728,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 +6750,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 +7045,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 +7140,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 +7573,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 +7741,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 +7757,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 +7791,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 +7814,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 +7956,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 +8393,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(); @@ -7760,257 +8417,63 @@ int ha_mroonga::generic_ft_init() if (sorted_result) { if (grn_table->header.type == GRN_TABLE_NO_KEY) { mrn_ft_info->id_accessor = grn_obj_column(ctx, sorted_result, - MRN_COLUMN_NAME_ID, - strlen(MRN_COLUMN_NAME_ID)); - } else { - mrn_ft_info->key_accessor = grn_obj_column(ctx, sorted_result, - MRN_COLUMN_NAME_KEY, - strlen(MRN_COLUMN_NAME_KEY)); - } - } else { - mrn_ft_info->key_accessor = grn_obj_column(ctx, mrn_ft_info->result, - MRN_COLUMN_NAME_KEY, - strlen(MRN_COLUMN_NAME_KEY)); - } - } - DBUG_RETURN(error); -} - -int ha_mroonga::wrapper_ft_init() -{ - MRN_DBUG_ENTER_METHOD(); - int error = generic_ft_init(); - DBUG_RETURN(error); -} - -int ha_mroonga::storage_ft_init() -{ - MRN_DBUG_ENTER_METHOD(); - int error = generic_ft_init(); - record_id = GRN_ID_NIL; - DBUG_RETURN(error); -} - -int ha_mroonga::ft_init() -{ - MRN_DBUG_ENTER_METHOD(); - int error = 0; - if (share->wrapper_mode) - { - error = wrapper_ft_init(); - } else { - error = storage_ft_init(); - } - DBUG_RETURN(error); -} - -void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit( - struct st_mrn_ft_info *info, grn_obj *expression) -{ - MRN_DBUG_ENTER_METHOD(); - - Item *where = - MRN_SELECT_LEX_GET_WHERE_COND(table->pos_in_table_list->select_lex); - - bool is_storage_mode = !(share->wrapper_mode); - mrn::ConditionConverter converter(info->ctx, grn_table, is_storage_mode); - converter.convert(where, expression); - - 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; + MRN_COLUMN_NAME_ID, + strlen(MRN_COLUMN_NAME_ID)); + } else { + mrn_ft_info->key_accessor = grn_obj_column(ctx, sorted_result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); } - 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; + mrn_ft_info->key_accessor = grn_obj_column(ctx, mrn_ft_info->result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); } - - n_weights++; - - generic_ft_init_ext_parse_pragma_w_append_section(info, - index_column, - match_columns, - section, - §ion_value_buffer, - weight, - n_weights); } + DBUG_RETURN(error); +} - for (uint section = 0; section < n_sections; ++section) { - if (specified_sections[section]) { - continue; - } +int ha_mroonga::wrapper_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + DBUG_RETURN(error); +} - ++n_weights; +int ha_mroonga::storage_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + record_id = GRN_ID_NIL; + DBUG_RETURN(error); +} - 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); +int ha_mroonga::ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_ft_init(); + } else { + error = storage_ft_init(); } - MRN_FREE_VARIABLE_LENGTH_ARRAYS(specified_sections); - - GRN_OBJ_FIN(info->ctx, §ion_value_buffer); - - DBUG_RETURN(n_weights > 0); + DBUG_RETURN(error); } -grn_expr_flags ha_mroonga::expr_flags_in_boolean_mode() +void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit( + struct st_mrn_ft_info *info, grn_obj *expression) { 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; - } - } + Item *where = + MRN_SELECT_LEX_GET_WHERE_COND(table->pos_in_table_list->select_lex); + + bool is_storage_mode = !(share->wrapper_mode); + mrn::ConditionConverter converter(info->ctx, grn_table, is_storage_mode); + converter.convert(where, expression); - DBUG_RETURN(expression_flags); + DBUG_VOID_RETURN; } grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode( @@ -8018,107 +8481,17 @@ grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_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(); - 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 +8501,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 +8535,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 +8572,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 +8579,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 +8601,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 +8608,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 +8616,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 +8633,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 +8650,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 +8691,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 +8864,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 +8978,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 +9198,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 +9259,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 +9411,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 +9421,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 +9510,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 +9642,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 +9708,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 +10089,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; } - 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; - } + 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; + } - 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 (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; + } - 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")); - } + st_select_lex *select_lex = table->pos_in_table_list->select_lex; + 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 +10243,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; + } + 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")); fast_order_limit = false; DBUG_VOID_RETURN; } - match_against = converter.find_match_against(where); - if (!match_against) { + if (n_match_againsts > 1) { DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " - "groonga layer condition but not fulltext search")); + "MATCH AGAINST must be only one")); fast_order_limit = false; DBUG_VOID_RETURN; } @@ -9901,8 +10279,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 +10294,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 +10754,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 +10858,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 +11223,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 +11321,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 +11334,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 +11473,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 +12096,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 +12111,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 +12126,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 +12823,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 +13009,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 +13093,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 +13124,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 +13279,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 +13354,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 +13412,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 +13620,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 +13641,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 +13690,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 +13744,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 +13817,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 +13835,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 +13949,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 +14108,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 +14166,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 +14514,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 +14627,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 +14836,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 +14899,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 +14950,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 +14963,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 +14991,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 +15004,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 +15034,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 +15114,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 +15146,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); + break; } - 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 +15385,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 +15416,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 +16531,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 +16556,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 +16738,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 +16780,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 +16997,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 +17031,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 +17161,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 5770cde72e74f..7f8394fe4ca33 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 6416513f0eb3f..15497e70c5953 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 @@ class ha_mroonga: public handler // 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler #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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 @@ class ha_mroonga: public handler 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 575f38adbd1af..e8c03c63a92c5 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 0000000000000..e2e8f6d8f6310 --- /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 0000000000000..e68e0182f5ee6 --- /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 d1f0fe216151e..579292a7f8900 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 3a7fbd048dc51..f8a48b6209abd 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 0000000000000..d297ee9a33893 --- /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 ((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 0000000000000..4c64933ac81b6 --- /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 0000000000000..07852d9dda671 --- /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 0000000000000..b813ecdcc08f2 --- /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 0000000000000..367057fce66c9 --- /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 0000000000000..52e315e1b77f4 --- /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 0000000000000..c2c7e460b581f --- /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 753d1551ff475..d52d2639d7daa 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 76c76dab6d5d8..877b7ca889ac4 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 f04c027f8bbfe..47badbd8b93af 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(result.is_crashed); + } + + bool DatabaseRepairer::is_corrupt(void) { + MRN_DBUG_ENTER_METHOD(); + + CheckResult result; + each_database(&DatabaseRepairer::check_body, &result); - DBUG_RETURN(is_crashed); + 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 12e2bbc9c798e..d46ae83807254 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 a4a687c7996b1..1cc510ad7dbae 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 c4f1622861056..abaccfae220cb 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 d189a31c5de4b..b2e0e0444b8f7 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 2b3f935d4e414..14003cda9f58f 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 0000000000000..2dab41108a72d --- /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 0000000000000..899c92e950863 --- /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 0000000000000..572907cdc5536 --- /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 0000000000000..762a5ee9d434c --- /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 7a595986f01a5..43f276f4e82a0 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 607bfe4cdce4c..9849d5e28efeb 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 0000000000000..4e05069a3a9ec --- /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 0000000000000..8b3c4084c8d0b --- /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 0000000000000..9dc91ff29d5e5 --- /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 0000000000000..dfb569560242f --- /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 0000000000000..7f1dae266c7e4 --- /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 0000000000000..a8d12be19eddf --- /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 d109f87bb4890..95b1b047c7963 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 8a42637a8e49e..60f535f791fbf 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 660c72b4d256c..d33a8c88d879b 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 8984db3bfbf71..bb7c8fdb7ba76 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 6bc948a1cacbc..0866403e54caa 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 1b3cf9c0942f3..06b5361f3bd85 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 39503a9c68d44..7449724b5defa 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 b2212fd94a8ba..7063c1d1b3d22 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 6f89f05b869f3..f608f5f220f08 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 076be2582ba3a..a61058b92ffdf 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 5d4862957ae19..8f79d05af295a 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 0000000000000..1038fe9eea625 --- /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 0ef2199b70433..50ee66d64c65e 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 a664a9c51f421..2808e107bc8e6 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 350f51616ba15..cad909d022a4d 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 0000000000000..88dfd6602e96b --- /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 cfa7c008e5127..aaf4f8dacc875 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 b258225fa9fb3..179e0329600fc 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 ae44649df9e70..0000000000000 --- 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 90a203c91ef0d..88f8594c352a0 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 fc6cddc5b14c4..3daf0e7c37919 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 dfd3ae12c93da..19b52287cc1f4 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 7f76ef05021fc..5f38c66c2c55d 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 0000000000000..e11c15ec7963e --- /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 7bb3ca8b371c1..b88839e55fe68 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 bd5e4cf7f9fea..bd5242c8d348b 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 f0bad1a490d33..0d93ce03bd713 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 e2a791aff5e33..f3c2129203e9c 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 0000000000000..cf638a9c73a96 --- /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 0000000000000..90eca856e5e66 --- /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 0000000000000..fc89e733f0ecd --- /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 0000000000000..678ba6ab46047 --- /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 0000000000000..356b2295743fb --- /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 09e5acc018796..1a8883f0478c0 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 fbb4152fc4a7b..b1708abe195b5 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 a08d789d6f2f8..cfa3c7ac60d4a 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 b48d4e9d1bbe9..b9481afdee825 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 ca2d06ae617b1..4b65def946367 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 0000000000000..1b18b5749ca63 --- /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 6e563721fc72d..9ca1b0d116841 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 0000000000000..d5f8c1293d5c1 --- /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 ed13b737fb504..bf0bed98480b1 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 0000000000000..5fd84f1b2a8fd --- /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 93eead8791eb4..b954d1c75f742 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 0000000000000..2af6f2adb0d73 --- /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 0000000000000..5f67748a17978 --- /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 9fbfd222df4e9..0695b96fa23ec 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 e29fae84d46bd..633450e9c0da9 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 39ee22834e794..e984d60f76094 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 0000000000000..075e60441970d --- /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 45a70d34ad748..c29795892114a 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 0000000000000..1ba1d09be60db --- /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 0000000000000..6bf7422492350 --- /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 7cee5c38c5314..0000000000000 --- 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 0000000000000..fc0d665b3022c --- /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 5e21a446f1b29..249c6b59b17de 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 d04826aa7dd7b..fd8b9e998a038 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 0000000000000..0e7ca4460205c --- /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 8d0d13f91256f..cbe345a7e045f 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 dcc049078f8b5..210058edc3c29 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 7533f786f22ef..cb00da15a8790 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 0000000000000..037e66a9e7c40 --- /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 16077d2315599..15cd3499d4ca2 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 2e1e87ab722e5..8b3de1bf7de40 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 e441df32c922f..de0482e626c4c 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 6f2a1870ac771..b3c9875faeb1c 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 0bd8985f2e870..8a1c18b731d9e 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 fe48437299911..85330471c443d 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 0000000000000..6fb1a1071f87f --- /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 0000000000000..70c9ea0c546ec --- /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 2222334060c60..6c6024e47731b 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 a7bb15d5c84d5..5a5d3715621e3 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 b4c3044c7d5de..5136282687cb3 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 65e608dddeba5..373c70e81be6a 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 974cb125626dc..a9b192e999e37 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 5baf7cdb12509..4faf39ad1adbe 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 c8360f2fbfadc..f640e8de23b37 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 de6f0e3abc0be..d49acc5261166 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 cf4fc866335c5..dc2ae02533665 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 fb1cb9b5a93d7..706764a5105ec 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 60d302cc6a5da..9fc3b408474d7 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 ba6cf6c24ed16..7416481e3902f 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 26c429846ead6..a8b8edf2f6356 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 c911eecda3a47..569bba2f557a2 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 452caa574f945..7b3b2863e5f54 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 5910f28ddb382..cf6840a989741 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 2893f417f4103..9b7040bd5c887 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 a26249a81e776..f6b3df92c67e4 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 6d3f4b83f37c6..e156a7fda0329 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 b96bf53ee1cad..6ee8f8bafc196 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 043ef2db43061..84861ea7162ef 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 0ec5b2cebe89e..ac1a096de4a6a 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 0000000000000..4926a72a77af4 --- /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 0000000000000..def3368ecac18 --- /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 ab03fe9708345..9aec8dd6e7916 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 be5aba2020a21..4d2166eca0a4c 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 c5764cc110cf9..712d87ca25169 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 a85d60af383ba..85f091cca86e1 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 71dfa08c76202..9d9e2f610fa56 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 6044e24ad61a9..99611268724f5 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 f2bc6332be6f7..f0f03a82c9851 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 778ecf29dca79..8a775960ef78a 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 1477f32ce6776..44d20d972f201 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 0000000000000..2d5e5e64147d0 --- /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 733217fda85f7..21e715e1f638d 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 db22d3d4c7c2e..3500d6517656f 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 db44acf133c0b..e7094fd4e55ca 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 21d18bcfe7d29..028fb2577a2c2 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 10824d7c28ddd..a48be4da873c7 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 c4d73e2f57de0..ffd6a70760547 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 0000000000000..61d2ed8dfd31e --- /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 0000000000000..0ca19e548f36f --- /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 0000000000000..94479c2307d6b --- /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 849d7d833b465..510fa2dc061c1 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 9c460234261c3..6f79b31fe2483 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 b6c2b882c8f1a..8a45ece7813f1 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 4e05f0a2c52fb..659c574202a63 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 0000000000000..03633a50b7a3e --- /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 8dc2d847acce5..196e4b80f6057 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 0b3fd4c53e115..b67846bb29c8f 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 97eda9f237acb..620e9b6906c7f 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 b635f4db2b796..1ba47b3494a04 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 0000000000000..20213f0cbf834 --- /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 0000000000000..1ee7d8f6570b8 --- /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 0000000000000..5b51851660e7a --- /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 0000000000000..ff22175ec06cb --- /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 0000000000000..fac8246771260 --- /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 0000000000000..71fc442dd6fdd --- /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 0000000000000..27c9effc2ba57 --- /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 0000000000000..260c774e200f5 --- /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 0000000000000..bc9339ab0745d --- /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 0000000000000..92463c9459508 --- /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 0000000000000..1a502edf29bc8 --- /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 0000000000000..16acc89bf09aa --- /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 0000000000000..93046e39ba5a6 --- /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 0000000000000..c4e46d0d4f334 --- /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 724d20edd623d..f9fc836627062 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 aa7735ef78049..0f57885cdb9bb 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 0000000000000..a9c917f8c8fe2 --- /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 0000000000000..b2bb3b89c1318 --- /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 515dad1da2e1d..a6afe72faffc5 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 0000000000000..e6a3aa5ea89ec --- /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 0000000000000..eb1a08f2cd3d3 --- /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 0000000000000..6f63b5b385614 --- /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 fa631bc8471e8..35434a00160f4 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 3f0b664d4feca..a0b0350a8e3a1 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 cd75598a7eee1..7ccb1fa234b9b 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 3f93ce03ca6c8..4c221d9ecb636 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 1fc8e146c17c1..be97d4fc9cb52 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 c55bc4c6df597..a56271bccf152 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 0000000000000..ab6be3a7b77e0 --- /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 54a9a27483555..d2a00b777ec15 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 af3c19e9bb086..e4c4ea059e7f6 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 63bf6f666e768..9923b91f477f6 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 5e5980ac62bd3..7dede8671367a 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 24941f043c78a..89e28aea6cf6c 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 dc3f39d286e88..357adfdfbd431 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 9302037b7e107..0c33fac1deb94 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 828de3ebbadc4..8d39cac4ee87d 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 0000000000000..e9d90b0bd4808 --- /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 0000000000000..38a83b899a37f --- /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 b5368b433e641..e90fd833d1705 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 7e0d29a1e1f8a..8fbbd197f6c9b 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 c9283db72bb60..3d31400fbbebd 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 853845d5c1599..8f0c499534333 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 0000000000000..b6da79c72c929 --- /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 0000000000000..2a05ccdc62ca7 --- /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 5b593ef0383c9..29f27d156f1bc 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 284ecdb618485..7f9ddd50e9231 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 c3791d1039942..320fb9a5635b3 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 c730bafc8e315..ad68ca010cca9 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 e0809eb0f4b8f..2cbb5a6b2e772 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 df529282a9168..333cf3d5d1f00 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 7c02b18d6a2e9..a390421684a3d 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 b55a2ae52ee31..34545ecc30a3e 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 d332795199fa9..91a5b96d184d6 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 0edc0a1b18eb3..c827abe2cf49d 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 6308b33d4cf09..8934be78d4761 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 2f4a90d40865c..e3df285093b7a 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 0000000000000..ebc7db1cf37b5 --- /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 0000000000000..e2e712af4b640 --- /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 0000000000000..fc3cda004993a --- /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 fc550d97f87f0..c17780c0441f1 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,134 +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) -); -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; -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 -rename table comments to comments2; -rename table articles to articles2; -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, '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; +SHOW CREATE TABLE articles; Table Create Table articles CREATE TABLE `articles` ( `content` text NOT NULL, @@ -136,12 +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 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 0000000000000..e16157b439f8a --- /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 0000000000000..edaba25fad84a --- /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 0000000000000..ddc54cb3f9e3f --- /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 0000000000000..c220bb8970ba0 --- /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 0000000000000..5ea0ae3e3acda --- /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 0000000000000..9db892d5d2d5f --- /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 0000000000000..615c3a0903ad4 --- /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 a48eb25dece33..5beda03ceb695 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 6452fe4398c37..758f969feb8a8 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 0000000000000..deb4bd85385c1 --- /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 0000000000000..43b21bc1cd85a --- /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 5746ce89cb75b..46dd3290565a8 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 1811994b67efe..d782357eef44b 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 6a4759963a3db..fd5b8d1e0ea60 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 384d677c4276b..a485e1cad6972 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 cc6c0131854bd..136585c38eb02 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 ebaa41fcfb7f5..25da7011aa458 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 faed6cffe54aa..e38913a63c1b0 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 f05ee7dccd9a2..5c48cadf5684f 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 14984ed623a1d..6475f9ec7e960 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 cc8881bf99a58..4244af26901c9 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 a3936cea11f79..8d18efaa57103 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 2706ff665d903..0e85b45ae5931 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 450687fb3b791..37d7597b1f3b8 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 bb3831ea6d98e..db4afff0e9115 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 0000000000000..e07eae11ecdf4 --- /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 0000000000000..e588408e9e2dd --- /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 c17624581991d..bb68bbff1f519 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 0000000000000..ec765b118ef4b --- /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 0000000000000..8b92ec4137e1a --- /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 0000000000000..c6c39fccb10b2 --- /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 0000000000000..246f280005c8b --- /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 0000000000000..902bbd31730cb --- /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 0000000000000..178ff312332bd --- /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 0000000000000..6f5e9b2a2c428 --- /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 0000000000000..96df65061d6fc --- /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 0000000000000..ca7d796845d7a --- /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 0000000000000..9f4a3dffb5fef --- /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 0000000000000..bf280dba0ace9 --- /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 0000000000000..b2d0f509f8bc8 --- /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 0000000000000..bd11a908bed7f --- /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 0000000000000..fce13d9cd88b3 --- /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 0000000000000..fe5cc8859227d --- /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 0000000000000..3d675fb0e275f --- /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 0000000000000..7d4192f620b63 --- /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 0000000000000..9160633c8fbe5 --- /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 0000000000000..6a2b5d7a95aff --- /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 0000000000000..5f7b0f73c5791 --- /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 0000000000000..4690cd013a5f8 --- /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 0000000000000..24665fbfcfd58 --- /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 0000000000000..f1efa42ccbde2 --- /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 0000000000000..013ad5b199699 --- /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 0000000000000..d3f790b3cff38 --- /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 0000000000000..d05c2323b680e --- /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 0000000000000..02ce9098543d2 --- /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 0000000000000..469defbcb71df --- /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 e694166b93096..5095232dfb282 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 271cf922fd584..73573355c0018 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 0000000000000..2f432fc8e6677 --- /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 b27c0ee028cc1..b0bbaf09e4c43 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 0000000000000..8fb46156fb708 --- /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 0000000000000..055ca69f884d9 --- /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 0000000000000..0d7faddcaa803 --- /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 0000000000000..b390ca7a8cfe2 --- /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 ff2f975f94f56..a58a487a178c6 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 0000000000000..8e5f4329a51f7 --- /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 0000000000000..1a3021e28151e --- /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 0000000000000..6adaa9870dc21 --- /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 0000000000000..dfc7ef6fe43bd --- /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 0000000000000..502c0c1044741 --- /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 0000000000000..60ffa88b4b558 --- /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 0000000000000..2cdb3de3fb8e2 --- /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 0000000000000..3443bbc3ed188 --- /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 0000000000000..b60917848054f --- /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 0000000000000..0792751ad0260 --- /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 869ced05d25ab..21168547286d8 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 8e480d4844ad2..93e34d88c2ade 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 92e7f51ff6e2b..c2a94a848a97d 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 ddd694c38631d..2d1001560106c 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 1aa710882cb4d..a8546c4bcbf9c 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 d18f18589326b..5cffb71d6446a 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 c159aeab4ce39..4429f787b76a8 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 d833fb44024f8..92e95d9276c4a 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 1e4ee102c9ed5..35bc4123d65a8 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 23a5522320a3c..fbf88cf3d0a3c 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 3f3277f5e64cc..b799cc278e1ba 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 d6ce9873606df..b1eafd2d04841 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 2cf83ae6aa589..0ae41c513dc71 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 f605346130b98..f5e743dc9e773 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 4e8386251e77a..6a529b50692ba 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 c7d9f4db5c0fd..d36688bb13c54 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 705f311a5d817..5437c78979144 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 d8807f3425733..e59dee4c68896 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 bdffb91739b51..0fba3da7533d1 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 6ad90fb410773..8116bda2d601f 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 9bdf87dffcd07..78c56f258f88f 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 0000000000000..f2a0b28b0b637 --- /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 91850d9d8719d..3600c92082d22 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 00466f19bb560..f8d41bb784e38 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 595b3da00cd95..94421a5c200df 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 ff6925067e57f..1ef6f1f2c37ef 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 0000000000000..624ac00d3fcef --- /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 b66801094bd0c..0000000000000 --- 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 412ae45589800..c09ec340ccbe8 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 fd5f856d64c58..8d29e0425cf04 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 0000000000000..26ca6de7b28fe --- /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 0000000000000..9af4a4fedcca9 --- /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 0000000000000..2bbcfe7549ca7 --- /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 0000000000000..6ec4d774b2835 --- /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 0000000000000..36a1958955aba --- /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 0000000000000..d5c033083cc15 --- /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 0000000000000..59b812d1484cc --- /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 0000000000000..b5e4fc1c3de6f --- /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 0000000000000..f062fe0092ba8 --- /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 0000000000000..a1a123e7d5f0a --- /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 0000000000000..39a0f0bd785fc --- /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 0000000000000..68a0575ab9747 --- /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 0000000000000..713a19dd184bf --- /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 0000000000000..3ae04a0246f8a --- /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 0000000000000..0f0643110f04a --- /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 0000000000000..05afd7e8d58c7 --- /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 0000000000000..200f89d3eb64e --- /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 0000000000000..64761c9565dc1 --- /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 e2391c03e06b9..dcf0f3eec669d 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 0000000000000..124a7750f5b7e --- /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 10d30798c892b..5a0ea86cc930e 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 0000000000000..d58c3cf223a92 --- /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 4ea3856d363e1..f1cc14b496363 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 067e8bc7f61ab..0374f50030e75 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 41129e1945fcd..4bc3f9d5c738d 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 3a99051643df8..56629777889d5 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 b6db34d113da8..b03fe20f397bb 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 042e42ff36ba5..c25f2a56e9053 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 1c06397c7ea84..ef93bf8b87937 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 0000000000000..f20089f0074c0 --- /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 0000000000000..88ec9dd81dbd3 --- /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 be68e8771b293..5c18e22d1afba 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 7e3c4293c50fe..634fe89cdd4bf 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 54bfcbc2b5c98..22305c7045a8b 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 c4644584b0d61..439f453d1849c 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 a4af585cd577b..51ec2fde5e648 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 a11e9fc6e4041..3c4f3973f84ff 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 86f783b81f4e6..03364eb10174b 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 acbb6af0be39b..a284f4dd28084 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 6b12587a14d2b..270d263966d3d 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 30f4a08d1c961..eb19384eb6377 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 abc2dbf06ce69..80bd895a6e449 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 52134fde18054..b3ed4bf6b4d58 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 5b3ca0194e090..793423f5bc5fb 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 98b92f3c0214a..f50417d1f29c9 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 5a37d62785bd3..26da350050f32 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 702f125c2b5c6..342947cc77ec7 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 df3ab96880324..adc4ec6316e29 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 da774b47b10d9..2881cc7724aeb 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 0895545a96d5d..d1a9fc2787a71 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 51a9c1d4f6e3c..bff0d993ef870 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 0ebb303a96f27..cc3173ecff234 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 54515edbd0e13..24d427ed2ab72 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 f7187258ddc9c..c70ce337447d6 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 090ea9b84d67c..fd2cb655eaa9e 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 400156cec7b12..a111880a90475 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 04f63d0e779f5..93d29c2d439a9 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 cd702ab7a027b..87c9f4ef2b9e9 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 ff24e1b610236..0a18d817312b5 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 c59fc05ae2cf0..3525e2354d2b0 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 0000000000000..72a913b402e19 --- /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 11e6ee21949b1..e823e128c4389 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 0000000000000..1f457eb5e96cd --- /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 0000000000000..9ad80e9a85a1a --- /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 deac880d2654d..4238cb6320ed5 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 13db5ec65f750..429398f6b84eb 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 7ba0c120a2ca8..9cd6f5c9b1db8 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 0000000000000..5a19ab6fb4432 --- /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 8abd41cece353..19abff382bfdf 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 37c2eeeb379e1..30e9262b5fc7a 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 9968abaf18c73..0181fe02d8483 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 0181fe02d8483..ff574f7bcce84 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 0000000000000..5ecf89694e4f2 --- /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 0000000000000..b28eac5a2743e --- /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 0000000000000..e2d8a8de493f7 --- /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 0000000000000..3d7f36d1846b4 --- /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 0000000000000..aed9d91a9d5f1 --- /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 0000000000000..22ac271e552a0 --- /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 0000000000000..3921fb1625933 --- /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 0000000000000..7b1be1365b7a1 --- /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 0000000000000..adf3d1bfbe887 --- /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 38d4f034daa12..4e486b83cc09c 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 0e82b3dd4b0a5..5912ed3fcf04a 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 1071faf0b812f..18fa2f3ef1eec 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 70fb61cc044aa..f84c931c01072 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 8a64fe00af0df..d49e84cd5fa3e 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 f34cbcdcbf71d..cc208a20872f2 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 0000000000000..18836127238a7 --- /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 0000000000000..88ef12498a731 --- /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 568deea9e29f6..1f4fa4663b15b 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 8c4d76a5868e1..fac1f045db15a 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 037e81c790696..c198358146b8c 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 83b8aef1c5aa6..1440c0b78aabb 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 4476decec780f..53d4b21ff5380 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 424ae89b4a60a..7bb65327f791e 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 94db5d40b6037..7e584131b3d55 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 5bc12edadc45d..7ae72d672f6a2 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 98d26966bd097..119099c435099 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 575d65e44a25b..c01f7a95754dc 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 295bb91e0a912..e680e6e200859 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 01682688a741f..20624ad953700 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 b30486d080a64..20f7853fb7ca6 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 88a69111f65ac..2394be8633374 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 71e0fda38252a..e8e0bd416f9b7 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 a477d09194644..f8c4dfa3400ca 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 92380fdb8ec1c..c1bf17ba439dc 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 1f6980cc04b32..d1f8308268a71 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 5cba17d207223..17b86b47389f6 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 d7f7f44645947..028fb33f1e36f 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 626a1bc80a8be..00015dcfacadf 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 ea424df2e572d..5760887e7823d 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 186e1f5095cb9..69dbe23cc24d7 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 4348efeb0667a..dce2ea51397a5 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 49d9f0b8da273..00f6d30a5725a 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 58e53cb06f2eb..020579106e146 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 fc3acad9000bb..32da1b3a547a7 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 6b790e5d6217f..ec5735f067232 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 956f397b9654a..eb80d3036d346 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 95f683f1df5d4..da06f680d68ce 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 62bbe4a4dc2a0..08d84f7b552b0 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 d87078e7e9cf0..3309f60a3d9cb 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 cb6ade7a41854..2f3b61efcf366 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 62bbe4a4dc2a0..08d84f7b552b0 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 13afdcfe0e61b..1d073dc641fae 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 bf2cc8bd6e2f6..870b1bb60981f 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 3d9523ab53777..34ee3fcd2757b 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 193680296dca6..b349411849fef 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 bf7e750174198..6316eac4fe170 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 c719318d847d4..f4facdcb72f80 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 11799a51a652e..165b71a86c9bf 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 8bdfd10024eb8..ce1e52efa31c3 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 a4dd52d9faccf..22c6b59e0220f 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 45f4748e98d68..eed22d0669036 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 c44937b3f8459..77d0bc741e2b6 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 91898b5bb447f..6c15161ed2296 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 e696d12f128a7..09e0ea8a11891 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 db018023af0c3..f452e402d817a 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 169260cc80812..2d0840ce990db 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 ee4db71722cba..2d854ec35b4bd 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 c67aff0667408..eff9259a7bad6 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 0000000000000..77271b4f16987 --- /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 0000000000000..1460732b29a14 --- /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 d0df707162bfd..101c16e9675cc 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 f9e9a817a0819..2c28edb332794 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 4beec67b468f0..1d9998eeed3a2 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 045c9ef2a4ea9..f69e5594ebd6c 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 199e2904d9453..5d48a1a6201a0 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 4c63dedfc6087..42c5e1d22845f 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 0fcc806883d15..6761869d4ff55 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 cc713a80e5ac3..8645a2d7e5fcf 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 d5587876c3c18..21dcf156e43cc 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 762b78ec0fccc..6bd99b8691572 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 8cbf930953895..0c21508031368 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 df656eca7976a..b93af8ffa25cd 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 12c2a312afec3..c1cf1a341de9e 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 337e5baa95526..43439de0e89b0 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 3abf611a8390a..af04133ef2c12 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 586367147cc51..a3e355cc1ea2c 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 6599a554efdf4..3f4bb7b1e2398 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 94c9cab1373b5..47266e017d720 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 bdc21cccf5210..23ddc373ab273 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 0000000000000..55457c167fa3f --- /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 efa54b1e09419..94eb237f1a282 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 f0f51fba53e05..5dc033f1c531d 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 e75539d4ae24b..d66ed5617b83e 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 808313da9304c..3382a1c1e68b7 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 0000000000000..f95b0947fc24e --- /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 0000000000000..2b6a05915d744 --- /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 0000000000000..4419231a93ebe --- /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 8c30509037f94..fcea5431330fd 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 b49897800a09b..bf415b177f859 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 b1168f6333033..c6c9edec5de70 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 66ba81d79e576..c5107e6c88515 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 0000000000000..12b5862412e54 --- /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 9213379336fe8..03cb6b64d2f60 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 91e4b789aeade..ca59d052e782a 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 46d9ea37470d0..14303454af28c 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 acda07ab9541f..ef8609a78adb5 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 2b7fd7de81876..6a7a5bcc37ba6 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 f4b3175764c44..92eabc11d61db 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 0000000000000..8561688db3a37 --- /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 0000000000000..a54ee0e26a923 --- /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 0000000000000..0bd963874699d --- /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 0000000000000..841c2f4445298 --- /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 0000000000000..725c32384dfa2 --- /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 0000000000000..08969fa571678 --- /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 0000000000000..80437aa0e296c --- /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 0000000000000..c36913cecca08 --- /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 0000000000000..0946b1f30ece7 --- /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 0000000000000..90cb52476932e --- /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 0000000000000..340c5e70fcd33 --- /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 0000000000000..480cc1f7b94ae --- /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 0000000000000..7c953d30d14fc --- /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 0000000000000..68d97f990dc69 --- /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 ca4f154d4024d..39031cabf1508 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 c1c16d3affcbb..6b4c637a3598b 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 9c83c94b417f3..4d4a0f5a67328 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 5143f06a21a15..b96fa9b03b3e5 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 9be02c2a1a213..d3caeba70bf49 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 b7e8590939999..59471f7e97bec 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 432aab8862938..e0ab1ad4c1b3a 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 0f21e37c20184..7d5665b04f5c0 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 0000000000000..99ac2cdbb6bb6 --- /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 d057e0bcfbdc1..4d0a80ad5d59d 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 1066270e48db3..bbaaa51be406d 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 0000000000000..6b5eb5cd86f0d --- /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 b168716ed9428..e18f17b7c9514 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 2098e878ecb33..3675db38c486e 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 995fafefeeb2e..9b6c8d3016f61 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 d8d181228bb89..038d29c9e66e9 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 0000000000000..9bba55b0b92cc --- /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 0000000000000..f7eae384dcfde --- /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 0000000000000..6d6c44ceba1c1 --- /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 ede3a07f54286..a4e229dd17a53 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 c43f5c70e1341..5d7b8c4dff8f3 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 ccddec38fa018..3391fb7b740b7 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 c041a3f9ea91c..219bb085c84cd 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 d8a6a0ac36c6d..79d56f4e8e6ce 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 0a2f9d3074901..a031cab8767a4 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 b64d97fd24e47..287d0407bdf1b 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 f2252055c1031..704cc4d41e3b3 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 ff2eeef6a7b68..2200efc71c49f 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 50824bb2cba82..33f07c4747008 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 54d127c734db5..c8e6dddf4bdc7 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 cfa760bcae597..e950411cba62f 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 c2407cb1b0b82..19dadc2c285df 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 f398fb9b9e2a6..cc063faa67498 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 9cf9cb631ec95..de0cbedf0ab5b 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 2da118e27a560..b7cb86943016a 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 dea569704146e..912f86fb71cd0 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 a2eb99b1dce96..f20348bee6cf8 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 e219fc0757bb7..44fb656a93b3e 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 e9dcd7e1e06b2..c98569d197402 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 d90c71df98885..9414eee1f025c 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 e7cb3f696104d..82004e1971df1 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 8b798a71837f7..e7530cec03475 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 0000000000000..f57d40fd57b3f --- /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 28262bb4b7d17..1913469353faa 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 f02e4ddcb25d7..1f7bbf12bde74 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 c01d80a209b11..908a2fcbdbb83 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 cb86cddcbe765..fc66ae12fa0f8 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 d7514512b5ce5..b39da499d5e3b 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 10d00bfcbb052..0350a299b08f6 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 4b820f7b88eb3..d208e62e8395e 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 18cfbb33da53b..77965a70c9976 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 1c3b89be67f44..46becfdc2cc96 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 18a68fb1f9406..aecfab1f6c3dd 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 054d311bd44b7..c5fa91c5c9c9a 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 9a22c1b09ead5..568c9ac78cf2e 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 0000000000000..df509ed0dcd72 --- /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 0000000000000..fc37e28eb7669 --- /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 470283e94d84b..cc54ab34ad767 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 77a7683bc35c3..0c87494e3c70f 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 e3680ad3471d9..7005643546f4e 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 7add6db7831b9..4700c280d803e 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 42a91ecfc15ce..5251bf9842a38 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 0000000000000..2815b28509657 --- /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 0000000000000..5270372e33260 --- /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 c35c7dc15ce2c..2d7ff664335f6 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 fe9037843bf99..15045b5466c4e 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 5739e118ae346..16b76e0ec09b3 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 7048ab6e76444..c712c2ed018e3 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 e163201e85907..e247e3d17f0f8 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 69a48eb785172..a2484a90a6ebf 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 a58a408cf5932..b91819e994041 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 0d5605821845c..4fe85314d1ccb 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 956044c76180b..ba5f9a969ef96 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 688783b97430f..1066ffebbff8f 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 c7acf23cb3114..e7902c7b214fe 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 e9c1fdf473c05..1fc724f5117cb 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 222cc59e4020a..7ffedeaea5bb9 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 c161c50626ddd..1eaf8fa615f57 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 22b3061ced205..626172020aade 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 0c0fb1394cc49..2120efe0f9601 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 74d40a1adc3b7..317730f205f31 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 62cc9ed172f27..2639f32517cbd 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 89e6c347c8cc2..6c2c628224f5a 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 aa38839f9ca7d..36f9848378942 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 44f6bba6adc7f..00f9336c16014 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 7c562842a953c..be309e71b8f68 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 513c56f074d3d..3598a17f72e7a 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 0199dd14a5d76..1bd21b6588184 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 3d8430703a233..383ada185e56b 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 0000000000000..764db3d6fe99d --- /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 39aff4e4b23a9..b27fda75e95c7 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 887b204c7ae70..44d6438bbaf8a 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 0000000000000..57947bb39b870 --- /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 0000000000000..9be7cc7d2ea6a --- /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 7f02c81dbcd46..e8c8540be03f0 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 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; - -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 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, '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; +SHOW CREATE TABLE articles; -select content, comment from articles; +SELECT * FROM information_schema.referential_constraints; -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 0000000000000..29453f6916c0b --- /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 0000000000000..e2635efc56c83 --- /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 0000000000000..0b859c8342fa8 --- /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 0000000000000..0ed29655d382a --- /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 0000000000000..e93958bab83f0 --- /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 0000000000000..9b5ee9b9e63e6 --- /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 0000000000000..3e0f074828e03 --- /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 6a97baa362e96..4bd9ff2db9c3d 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 6fedec6810c94..89507f0901d26 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 3e3c517bee604..a39cfebd285c4 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 f927b45fbc6e6..b8d1c0b9cdb21 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 1ead74d035443..c59bc9d7b1f97 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 ba8f1c1eda170..bcbc4963a56ef 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 655bf1e8fa084..de10774d83d59 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 9c4e92ce55d86..d99628494deeb 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 5f1efdb796dee..bbebb5b5fe5dd 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 b720dcf6f712e..f4d2112b35a63 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 82d0718d1e8e5..e6f2a7ce6b626 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 c2efa7a85750d..d2258a399d106 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 29107188c3595..03a2ff8744a5b 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 c5b5f2f795b1d..97cc2623ebcbd 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 0000000000000..00bd029dee3fe --- /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 0000000000000..e6034ac2af564 --- /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 e8ad55ab4c664..bee227664cb81 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 5cc8f4154c40a..b84eb91129c9e 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 b85580dba01b2..2edac1599f179 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 642b438ebf6f4..583ede590e89f 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 5ea8c21797fcb..8c4cdb79e201b 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 b9beffa2ef7a3..a972cc6f4745f 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 c4195f2a541c4..4703fa7df1090 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 9a45d479d306c..86803c7245106 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 cf2cd503b28b9..0080632324f43 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 4032ca9e66945..d080d70d4d8e3 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 b6ac95da23283..db8fa2b4ccb0c 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 c990b28855204..39c89dbd7a3a2 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 2e457aa768cde..0de940534f18d 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 8fc9782156390..503b96106c3dc 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 619363f0fed17..d97e75fef512d 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 41d1ab9166059..38fbc8bb302e8 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 e346fb1d3bc9b..e1fea8b07e71e 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 0ac152703c918..5aa812fcb0487 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 4f932d5ac2a1e..2bad02c0991e2 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 ef610b983df74..5c1ec53c5737c 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 ab9522f6fa2b5..718d78732c607 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 2881d3cf16070..7a4bd9b8cb7d2 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 353e19804e56e..174374711b966 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 949cc61a4429c..8ccef3d68e335 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 97319b711768e..72b617812e95a 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 419224d4fc036..3487f704d909e 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 3f7377d9c6e54..416b61b7cc97c 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 5c94603c07f49..995f92aa4135f 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 06afa3ce9cd41..dc5901ef7776b 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 c90fdf6f88ab5..73424524fc4ad 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 a230111ba16f6..0d2963af7fe29 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 601ffcb73bb41..0d13720a54eb3 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 7c0156ffd3372..aaef394ebdac4 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 c422a6a6750ba..aa1a1a2c160ba 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 cdb4b9f27aee3..fd9ea74d86aa1 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 54206e43843b2..c690f92e2ac5e 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 1e84064b122ce..2919ad86288dd 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 a5040dd80a63e..485e2d84cfbe9 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 17957ab828479..bad8e8bc9c3d4 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 7dbc8fca2b764..c1d2c6c4cef3f 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 da9de22217ce6..7c00c29bc4761 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 cf4c9b60230b4..a102b4acc7217 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 0000000000000..091abbc911a5c --- /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 892b24c5a7ade..501c2ac86aba0 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 0000000000000..a74acf89ed854 --- /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 2712aab22189a..7eb3bba1f3f64 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 862e98c5a8cd4..ca18a93e15cad 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 39f99a7c2d4e4..13adc1956d183 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 1dca7076512c0..993d0b1a4135a 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 e70bb3f367de5..5b99a0ebeb69e 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 0000000000000..63cb2b320d5a7 --- /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 0000000000000..3f93ab1828260 --- /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 0000000000000..cdd431cfad0b3 --- /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 503e2000b1031..f98c4303ef650 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 0000000000000..10041ef8360a1 --- /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 0000000000000..141def4f8798b --- /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 0000000000000..663fa69aba9a0 --- /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 0000000000000..864cef6070396 --- /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 0000000000000..09bdde1c38233 --- /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 0000000000000..10f44e44618d9 --- /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 0000000000000..185842e77e5d5 --- /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 0000000000000..19c1ae826e722 --- /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 0000000000000..089a1d4eba906 --- /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 0000000000000..3ba38c0b8d09b --- /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 0000000000000..db5b06ecd85db --- /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 5d80d5230ef2c..da116a4a508e2 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 98e8d9dab2f7f..1ba332c4d8628 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 41f9d3684bff4..1fdd0a605115b 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 0000000000000..d5159b88ce1a9 --- /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 0000000000000..9631313d79be8 --- /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 0000000000000..88ee40fc6ca88 --- /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 0000000000000..ee80cd8b91487 --- /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 0000000000000..1a2c9d84404f1 --- /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 0000000000000..50e4fc558bc42 --- /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 0000000000000..2a8aad83d29c5 --- /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 0cb551dbc6910..028bdb750ea40 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 338417021c8cf..2d85633ab947d 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 fa8dbb20e9398..525c14a30043e 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 0000000000000..5faed51889167 --- /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 0000000000000..c01d298853f22 --- /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 0000000000000..60d206d2b40d4 --- /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 0000000000000..b4dfd0c5f5f7c --- /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 0000000000000..998a080c7f814 --- /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 0000000000000..b01dcbcd54c0f --- /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 0000000000000..59163fe45979a --- /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 a4e24ce030ee8..2547000aa95fb 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 4df02c14e7b7b..e8805b492d6b9 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 3d41de6a93e1e..1678a3ed29d25 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 f0ce4e81ddba0..6f779f610f3a1 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 4aed7b2472935..94d8024071f87 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 00efe1e4ac73a..2fd4fad68e795 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 0000000000000..605e03833da88 --- /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 0354e9b7e4b0c..ccc51b79e684c 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 a1429859a337e..478ae97ba9fdc 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 0f63eed4b52b6..a1c43cc417e39 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 dcf029593fdfc..f342c049fd59e 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 a28a912e23da0..bfb3f45636033 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 d622aade72d5f..7925f4ffc1679 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 8f1e6b889bb47..bf665e83bc567 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 acb298ef81283..e9f20387651f6 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 0000000000000..b2629c80675b7 --- /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 ebf331d2f1525..5cb0eed102f11 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 5afdd36b5b8f6..c5d97a2978580 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 314dbd85d952d..be7b7eefd0f7c 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 82372d63527ce..23e75a58073c1 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 a221c40dcc1d5..eef9de2d0954d 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 b765bab6769a1..8d2d6c92adebd 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 0000000000000..521061cdf610b --- /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 0000000000000..d48c0e56b17ec --- /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 40b39fe853834..92a830880864c 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 52cee4c7b33c9..8978ee2af49dc 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 0000000000000..6abe39795fd8a --- /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 d71d1917df5cc..64292cf18d182 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 431f123497bbc..0cfbea6708090 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 bc739fdfb5279..e5543a66b453d 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 a3c3b7663409b..e326aca2678db 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 3cbac1c1ff9c9..d2e09033f0366 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 0000000000000..49d0d7798d6c1 --- /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 0000000000000..d8e90a15df9ca --- /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 0000000000000..317517f4ca9b6 --- /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 0000000000000..310cc4764191e --- /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 0000000000000..7449e21ef3cc8 --- /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 0000000000000..3ea5db1493a7c --- /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 0000000000000..50e9ca0d76f0d --- /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 0000000000000..125143d71bae8 --- /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 430b3bb94a237..c674388e18197 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 18db29cc85fbc..4bffa8c396a55 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 07ab3d38028d0..01139dc631d72 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 567d32e0ffd56..902750ba265b9 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 0658bbcedf327..4172666fafd60 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 0000000000000..2077b91442827 --- /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 0000000000000..8541aaddae0b0 --- /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 a79567bde7ff6..936a57bc2d81f 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 7c9af9aa998d3..4778da9afa030 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 0c949ab25b1cc..bbb03e0229ce1 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 c842ff428c3bf..1323b4ce4a860 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 708ba0b44dccc..666b9566efa2e 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 ce28c45aac697..071113a6ca1bf 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 9e68d6278901b..630ae74b25e2c 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 92bd9915a2216..89108b7270d34 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 a25cd4d87c362..3cb5bcae3bf1f 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 6a04c4a9df54a..182f185a0d67a 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 0807e78c0aaf7..d33d2c1f84eb7 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 776e05a2ffea8..8d4f348c4c344 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 3fcc92f7acfb1..b4b5f500c56d6 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 4d25f29cfdcbe..a2c4564253ae8 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 eb6df3af8ad07..bd360544ee1c1 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 faf590d84b60f..38265a6ed99ea 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 52e4113dc09da..fa4780d541bff 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 a8e36f2ff265f..af3394b1f6140 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 c13ed51cf7f5f..bc8a7e723a04b 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 497010df03242..63f708afbb2db 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 2ee8ae466ac7e..7e7357108a579 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 efb7ab70ae2c1..3f337d05523da 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 1b1e62951e448..6dbc49388742c 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 74bd0eb133a41..7a1bd6bc74fe8 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 e116e7a251e46..67ae21224d13a 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 7a17092d5996d..ac77089ac7340 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 2505b47b1bcc4..21a3b936afe34 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 b475b857fd427..fa91ca3177d3f 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 4317cc1e9746f..1db76c68e4658 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 b7e910f082965..503322a5470b1 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 5a4525fe7a562..226a51b43332b 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 8865c3610ff37..0f1830ff6d622 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 e7ac3a8a941fe..b80986c393866 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 d1c23dfbc7312..0d303496afbdb 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 19fc2c36dfb23..e250885d058fe 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 37cd919eb77dd..a954ffd4ee39e 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 9cdee6b1efbf6..19cedaffcd448 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 1e1029d0d86cd..9228b1ffb9192 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 9b94d315836fc..dc9db9652f617 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 44a9fcaca692a..7ddd48617084d 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 82b6632672c23..aba0d8755f0e9 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 c9134275c4513..4e2bd44d2d1e6 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 f9cdd093ff40e..a5073a6334a87 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 7b8f48e185a9c..bf61a4fbd0f3f 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 d71dd6485d2ad..6e5c369ffa0f0 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 f59ee6273010b..1eb103b76c7ef 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 7d8c1778331bf..341dfd21c097c 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 9c8e4e46c280e..a610944d835cf 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 6236b2d961d67..a390eba41f7a5 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 9358c7c0e47aa..97e8efc73cbed 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 9fe7698974509..a3e040b554bc1 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 24967c9d14bc1..454326ea21282 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 7f4bc666fe198..1a9a06f8b40d8 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 58604aa347d8d..d19cfcb226271 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 df89318fbe444..aa0761aa871cf 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 97dc161f191a8..068f53fea69d1 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 2e4451b9fb765..b903332396221 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 76729da279ec2..5b1e16538ad4f 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 692953f9332be..10446b115b57f 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 d5c73ac3d81eb..66d29dfb8f112 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 b8d2dac9cacc5..7dcbb6e902344 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 8f262237cde6c..8537caed403cb 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 994eff8b69a04..d7d48ea72becb 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 9e58d3cd8e483..216c5f4ef9926 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 14c97749c37f8..90f241ad285e0 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 318ccbfb82016..58e58f4dbdd14 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 ef89fbdd128bb..2b81524aef25d 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 e35baa1303791..7ad385098ead2 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 aca93729e3b6b..0baa5d4b311ba 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 f9563018beaca..15e539b552441 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 b95dca5fe0793..a3e1d35647bae 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 a817dfc285ce6..c63a8a867a8f9 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 f9f42e48ac59c..81d6df92ffabf 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 977629729129c..c64bd185b21bd 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 bba35ebbdeb49..82ea8949d869e 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 04344db0034d1..685570228569a 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 27ef9af3a8030..c513983d886af 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 518eabe1cb023..51ed0a3bb8bdf 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 08b9c5b56481c..9d9d02c4b023a 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 84f2adce7c8cf..04584d2f71f55 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 995dd9d77a628..7b8a6fecbab0f 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 106a5bdd9f2bb..c2307642392b8 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 4a0b2ff34929d..c4004e4207ad0 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 0000000000000..f4d468b71b394 --- /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 27c094acec9ad..3b3743b8b37f5 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 4acdfc0f1bfd9..70c6ec8576fcb 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 7642ee733f398..27fb6eea83438 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 8bcdb56ccfd64..fe222c377ec74 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 fbf776d9e39b3..b1a37b5acc9bd 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 557ce195ae310..3d47500544f2e 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 43988b71a9a6d..fb462fd76851b 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 f6d2d8fb5dbc7..2dcf6716e2e6c 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 3135ad9fa34d4..f1aac9c1c33e6 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 7b54e8d3ac599..445bcfabe39dc 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 6e3ce140eba5f..95c21513d5709 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 d58d432674257..e52d11c5582e5 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 a53e672cbe4cd..e6c0cae164f56 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 c25e460635948..1b07775d68194 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 5542b0ece3b24..f5b6db7bab62d 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 0000000000000..3f3fd208aeff9 --- /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 48d50135b08d6..1f9c5fd3849d3 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 eeda3dac4a910..6c7627e7967ae 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 2355e5d4af49a..0000000000000 --- 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 6d07ab7b6067c..69713752f4f2a 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 26930d4750263..07bbc773973da 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 fedf31810c7e4..2014a8fa476bd 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 0000000000000..3c63ecc9c1279 --- /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 0000000000000..cccb0d3f48ff8 --- /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 0000000000000..f8ebad5d7bbf5 --- /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 0000000000000..9e3c6fd8a32c5 --- /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 0000000000000..634428c5c9594 --- /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 0000000000000..0feababfbf233 --- /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 0000000000000..5e69f1684ec5a --- /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 0000000000000..8aa1ba17621ae --- /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 0000000000000..a6e0f3a51ed9c --- /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 0000000000000..f07d1b9beae85 --- /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 378f4424da117..cc3de7c3ce693 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 0000000000000..1f49597bb2745 --- /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 0000000000000..1c9e7354c357b --- /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 0000000000000..23fb2152f9430 --- /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 0000000000000..9020dd11efa19 --- /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 0000000000000..f4c1e0687c567 --- /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 0000000000000..bcf5afa52de59 --- /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 0000000000000..ddfad77ceff00 --- /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 0000000000000..c49385ed849b1 --- /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 20b89f7246381..e65e44d1f6091 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 0000000000000..14f548db12499 --- /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 b1246ddfbdc27..eb9e7ef55bcbf 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 0000000000000..c14ee787f1abf --- /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 41d5facf6443c..04cd30ab337e3 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 f6440777ab516..cdc7b43353288 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 5b57d2980c63c..c7a5244042c58 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 4f878af84cc66..0f87b70186c6a 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 e8735fda41ccb..922e72e2bbb9b 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 4a748bc130bd8..78f8f19a14d1a 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 80fe51e1e8049..2b12fa6ccc141 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 b36a13f3727b7..1908ce34d8a66 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 0000000000000..834a39fe75c8b --- /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 0000000000000..703d79dc8e174 --- /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 bcc678360e264..9c44110bfd51d 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 e0a2df2e5873f..32345f6613918 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 c8f698cdbccca..508f85f3a7389 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 ee510ab752751..a2024e8dda52c 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 76f2de8146b35..4924cb374e992 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 caca6b56b8983..b81247ed2f93b 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 1c26bef936f15..d32d9f1128c9b 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 4df32d8a590fb..9289bee30688f 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 07907f1dfb7a2..23adb84f91c45 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 0e0b3f8e1ea14..1031427f9cea3 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 213605adca1bc..78b42e5d8d7b0 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 58505edf7a76e..f09a2a0e3b46a 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 92178a4515854..9a7585609136d 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 4ec5a8b15966b..e49a79a7db25f 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 eaedbbdc7dc0f..b563028c81db3 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 72d2890a12372..c11603c94f8be 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 eeb2e36ae29fc..71f93c6ee1b14 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 666887d334796..883f676e45e8e 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 feeae64b8d12c..a8af0bbb78185 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 4744add7881dd..a0795f8eba6d1 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 cb407d354503f..4087207c2a874 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 b9327e4251dd3..e423a4b937b85 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 7c460d1086a5c..60565dd7bab16 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 ffebd0a4bad14..dcde9373317b8 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 c4e86ac103900..4e7c117d65404 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 57b512ed88d58..d6e7b345c0583 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 729d8b03770bc..bac10448269e5 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 6bd955cc956ec..9ffae4a65281a 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 3e40e88585991..09015f9c2c380 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 44fb928774f1b..35adc29839f7d 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 f7d0865f30321..831ef4c3e6a18 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 25270f14def79..4e59a2ca3abfa 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 d601b4d4fe93c..eaf3304dac590 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 65989b60e8a09..22fade591b6d3 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 81dcbe318b36e..e9ba60c2c2882 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 0f8e90c0c0334..3ff23185741f5 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 bb134cd04e48f..4aba5eda25621 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 231e8b0976223..da3faa03053bc 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 2e06bf7e5f871..22cbf13889b43 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 fb8a6750fb99d..db5b90ab0b166 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 c3973cb916478..b607c314a8478 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 c624f8e0c36d9..52630fec0f077 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 59c358cc1b831..75d00e7a73789 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 4424cf283daa2..ad71ac7119b39 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 46c0e5aa70e65..710bea0dd5a0e 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 a0afe1198efe5..0bce1387b3f55 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 231e7c2703795..32bb5758a10a8 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 3f00049092cb3..95007d8032fee 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 c2df2522b9cd3..a7460343c266c 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 e71a2322bb23c..ef26b467dbc89 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 7e5bc2d010c50..840ff375489ef 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 0000000000000..c90a8cbf1cb35 --- /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 33ccec429896a..dbcfd66546481 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 5b5a47ad447aa..526d6f18c2055 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 f1c91bfd8d300..0f9ecdbf33797 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 7f40ba09b2e54..eb4af2c117ecc 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 65f0ce3b2535e..872f1673569b7 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 a50bfd6929e7a..e0cb953d51dc9 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 2cba585bc2a21..83dc25e498914 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 bdd4f915bbff8..21879480c7d63 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 c7f54925382b8..77c4c1db2b14d 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 b3265d9645b1b..b312b31ad393c 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 61613ef290668..6509eeee2bf24 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 ad934696171a6..b7a4b80b6f198 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 e71dcfe0dda1d..83138aee0ec30 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 4cfbe489b9012..41aac1a146fe8 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 0000000000000..4c518b28e9f9f --- /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 0000000000000..ebd08460b3c17 --- /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 de97096e5a490..767ce3f928652 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 b52385793d282..4ad242dd59df8 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 47c2442158616..66f82a5c05290 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 0000000000000..ad2b8167d814f --- /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 3e2c5bfe7bf11..a3720f2ef5b35 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 7358389bb5d2b..54c834d7e4c76 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 c25d1747b1de8..60e468bf0a6eb 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 523baa1b3e932..4b490b8a74da8 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 c96b021be7652..07a4afbe76e8a 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 d05cbd2349a5b..13c544b95a577 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 ead099e0cc16e..e2cda37b79b39 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 1f73f4f447f9d..2cf196f49ca03 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 8585c1c2f1177..fda1f8768f61f 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 8743c3faadb90..0a7d192f76f18 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 043d8d3340bed..9ce8cf8bae79f 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 0000000000000..757a7f9590dbd --- /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 0000000000000..df9f498632e9c --- /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 0000000000000..19b4b2836b165 --- /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 0000000000000..0b9357e06c052 --- /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 894e14f480235..5e31c8b0d63b8 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 0000000000000..fdd21cc0f4dee --- /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 0000000000000..b84fc3978ede9 --- /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 0000000000000..0cb1a8d243af8 --- /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 0000000000000..d1704a43d3ab4 --- /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 0000000000000..e298aaa43b120 --- /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 0000000000000..4c500f1e67414 --- /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 d2ae3fd871807..f1fe11864d91c 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 6c21f8d50d778..2bd4496a2de22 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 c47a5ccc35465..2be9834c61778 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 0000000000000..9628df686b307 --- /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 0000000000000..abd2271f05124 --- /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 3e270abe16d5b..7197d3a9dc051 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 9d225f46f2553..05bd0e4e1e0a1 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 c9fef8e4d8fa5..25cb53ded0bfb 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 5bf1bbf212462..37f03b4061632 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 8d161b424d1f7..bfbe96d14d71e 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 abb7769224c98..fa42d4a1fd39f 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 0000000000000..61122f7842fe4 --- /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 0000000000000..5b379d08e3aee --- /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 0000000000000..24c9275b5e70d --- /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 0000000000000..65a55204a32e6 --- /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 0000000000000..febfd34345be7 --- /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 0000000000000..c0d9452f15e2c --- /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 0000000000000..ae9c244d8807f --- /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 0000000000000..6daeb5e2f3180 --- /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 0000000000000..82a46e3fcfc63 --- /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 0000000000000..09cd18915f8ef --- /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 0000000000000..8c1ceaf13dd12 --- /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 0000000000000..7d3226175ea3f --- /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 0000000000000..5a0e63ed7c490 --- /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 0000000000000..2411f7a725ce5 --- /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 0000000000000..38185f5ec97ee --- /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 0000000000000..2d31307392f32 --- /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 0000000000000..7822d118733a4 --- /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 0000000000000..141117f608a42 --- /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 a6d2f7862af64..1ebd0ba870ea5 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 49e5e0a14661f..b3814331038a2 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 ce1b5470231f7..3610ab6f55659 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 fb03bfe8d8d26..6ff4c105384e4 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 4a7107146cec1..9048b677a2fdb 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 6e00526c7364d..1c701d0eb8f7a 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 08bdd72ee039c..e378ba3b7ba97 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 a5ac716d38e97..1367a3adbb903 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 0000000000000..5230963af7927 --- /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 d382e937cea1d..4d9d20dc8abcd 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 e1e32dccc37de..7f4885fb0dafb 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 11ee04e299828..2d7c67489e65a 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 f6d6be1b643c0..4626d1443f82c 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 45cdffb8cd3e9..34e3f88dbadfb 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 318be3f364ade..219d8e08deb3a 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 0000000000000..f7d5b439b6936 --- /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 de8e47dcd8265..8614eaa73f83b 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 0659c7c59df2f..1ecf18cb13160 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 13b2bcb4ff1f3..d3bdfca0def35 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 7391ee4ba8dd2..c25b47c6bde3a 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 11d40fc058938..f4719cbdd95f8 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 03cf96b55f845..9d1e838b8933a 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 81ce556e74574..39ab80edf3bfe 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 3c014b1b2b3f4..fbdf241b81e75 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 3b65bc1a2ba33..074d199150563 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 cc0fb391628ec..756a702171a79 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 863b95a305921..db869eaa697b8 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 9ccffb28be15f..7121e5109d39a 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 ab3c321959ebc..90376bdf156ad 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 ceff90c477c11..f79798cec6de0 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 1d8284e237093..3ee15c63bfd70 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 7f32fed3810e0..550554eac8ca3 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 92c70d223e931..615d185f79f0e 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 3594339c6854c..adfb53e10a202 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 c249b4995a08f..552cf58682b20 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 ab3e86baec3f8..f0ceb937a01c7 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 0a9709a1d31dc..97428b768a60d 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 0000000000000..bf1e67b9378d3 --- /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 1eeaec1efd82c..8258a03bf42c1 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 3813b320562b9..cca7aee95de8a 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 4e2ebf121e27d..d66b463d7ed37 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 61fbe239a35d8..54afac7a1a70a 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 8ea9ffb0e6793..9082032ff6e9e 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 a06a57371beba..0a424e77806d5 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 0285bb7f62e12..296f87ade66cb 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 674a66660812a..ccc28a0f4c715 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 46777cd877d58..a9bdd38fa222a 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 e9be95ab90eff..b2fe4607f8f90 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 c988a101095bc..9405879f4f54a 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 bedfb372e9323..fa2da48cc713e 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 bb4d538990901..a6d25d3f43826 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 0000000000000..49f65449a4d7f --- /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 0000000000000..bd5c7389bedf0 --- /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 a1d5c28baf1df..dc98dc9c531dc 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 e1b657b7ee817..d466b4466f1cb 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 645d3dad7b3c8..ff2b6b47ef1bf 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 68bf5c9bbe9cb..13344843ebeea 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 0cd02e1812ab5..7bfd5fe507091 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 217df7a1edb8e..f05945e1b761c 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 ea3ef4f14842e..f272698c1a836 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 107f4a9a7553d..e1de36d25d1f7 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 3c63d4a149683..2c994bdcc7699 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 cc4b79ebf3922..01fce22c3f0cf 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 e92a2e5c7f72d..bc451c354b199 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 f5f7e307d5dd3..66ee293bff11f 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 587102c3db4ff..f364ba3d70693 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 2f28eef1574d6..7b72b113c790f 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 aaff5f90b7400..25cdc13ac3599 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 62e56899aad83..671b961723194 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 c84e86594ca0a..288e5cdc0de61 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 34c8bc02a1d4e..bcc043485a023 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 b4ebd69a5e9ef..57af6f121cc86 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 224bdfa07c6f3..1c120f364577f 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 0000000000000..c6d4a92469164 --- /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 2adbae8afd85e..de195a5b9817b 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 0000000000000..e10ecfe9b56ae --- /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 0000000000000..784f419e24c82 --- /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 0000000000000..de2e40680df42 --- /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 0000000000000..a8fcf191e0818 --- /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 0000000000000..db4f0ed44603e --- /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 0000000000000..a59e5b6c4f104 --- /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 0000000000000..502fb1502ff6e --- /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 0000000000000..5103a91e909cc --- /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 0000000000000..3b3b67c9747bf --- /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 0000000000000..73848a3f2cb42 --- /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 0000000000000..cd5a9cb404b76 --- /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 0000000000000..a5180a973d51a --- /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 0000000000000..c266ffe6ec5ac --- /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 0000000000000..cea67376fa6d4 --- /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 0000000000000..f1e0f39411fe5 --- /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 2e9674c860e69..ba5786d05ab2e 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 0000000000000..b557a96518aa7 --- /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 0000000000000..b329d9a5ff61f --- /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 6fd0ff1971c3a..0a3a5c818650c 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 4eab593cfe77d..1c0d445013c28 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 f2d4cf80e3ab5..eaad5ed47cfc7 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 aa6b1f01f1042..6daa5acfd0f65 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 d116aa6cd34cc..22d28e941fd45 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 3c6bb52d143ce..c3b689580f6d8 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 b433e54e8859c..06cb7658c21c8 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 47cededee5529..84dc9d8526a76 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 0d26c751c2278..8846821cfc18c 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 0000000000000..5454b17631349 --- /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 141d15c3c459a..287d594b7f54c 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 151d15a9870b2..54d63fbe49c9a 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 d5487a3b82868..c79744993e9bf 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 0d863c9f99f90..80bb5cf8701f2 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 0532c19dbde75..99343ec60cffd 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 0a55dd6ae6976..e3e6d671ac6d7 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 a2087ca8a9f64..3eadb51a73ad3 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 dae9bf033ca8d..b06a60671440c 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 b25fc596813fc..ca33da8c30972 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 0000000000000..c0f492d1920ad --- /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 d835a20746c61..0234f831fb13b 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 9882883e597d8..73de4d5e70e38 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 1e57b56d6b00e..14fba8d22754c 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 3fdad5365fee2..9cfd841b753bd 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 53251eb2af70e..b28caa87e2fd1 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 f46f732203be4..1dfdc49695b11 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 8f8130b7b45f2..66f7aaf880e4b 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 6fa65d395eeb5..54278e9768142 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 9d7f887c98dee..459fd91355289 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 7feca394fa5bc..3245501d6b731 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 ade88c9c60dee..0e69941134e4f 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 ecc1e0d0bad5b..3191ff6c44c7f 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 384b951f5628a..90216c0a438e3 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 f259fc8538803..4a5512791a13f 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 4cec44d01a24b..27af7f5d8801b 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 169069fb67d07..912b3c9eec177 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 cda39ce2ad63f..56309998b426f 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 93e78d6b46d86..589b4d79dcf76 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 27af190ed7a20..6b07647625d5f 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 083384b04d17b..d4364af2da780 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 f4b76888b76a2..ea76dd055dbac 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 0775041634217..38e1770026952 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 52700ad01fe1c..61ef72370f046 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 b362acd4565fd..1cc2f6c297af3 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 fa8fb79634d79..673ed5619d9b3 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 d6defc1fca2f0..2d2ffe7b01484 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 ebf5c37ad9412..81047e78302c2 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 8ae0dd8892ba3..037784e42511e 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 a6c12aa1714fa..72662d7809398 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 58c0ea3faf70d..8ecb8eeec65cf 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 305f51d4a0247..818624392a4e9 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 7fcffefd23440..d65fdefd647fc 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 cba565b02539b..55813bd3fdcc5 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 825cf36154672..bcab5307e18b7 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 2cfd00b2172ee..f08337af9d1b6 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 b5f7dd80c31b7..d1be7ae64da19 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 88fa88427cf7e..8c669052d2ecd 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 655a8416725f2..3a4d399beec21 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 6a73495815895..db7aa344e0af3 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 b7a4dd4c36bbc..1c73f30b60c47 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 87947f1ea6c71..021d3f8e95d5e 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 a5edb8bae4a9b..b21dcc5b89388 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 d16527644e3cd..3006bac6d21b5 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 d97823f77a2b9..ae993b76b09d5 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 dbe11f03bec29..ce9cf85e7dc13 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 0000000000000..fb6529ef782cd --- /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 078e0b6e28ef3..9aeeef0e8421b 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 07a497d78713f..4a2338714e413 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 a74db4417b2c1..8b8e4754dc29f 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 25a02398a669e..f1b6ad62c88a6 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 7d663bef626f8..5ea33c4e150ce 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 d11a3efe90060..31b4371226136 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 6d09479e55440..f2b1f63a8e034 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 7d98ca0bfa753..143270dcf202f 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 9055715486b0a..7c848641626d5 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 dd08d93cd47e2..f11ca4a98393d 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 ae9099a7ab9c2..36bc09be73bfd 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 1920237fdadc6..b021b26b5e375 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 7afeee05ffdee..9052c434c317c 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 db1e2da9a181d..ffa26994efea1 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 2757c94b4c5ed..c6f2a2a14da5c 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 5e9585282758e..b80f60fcba553 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 8e9a9e3308ada..ab75babfbac94 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 ead26bca2c14e..71d44ab57043f 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 5f5ae169890a2..91196faf6121a 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 ca0e1dcb19d53..0ebc7f67d04d8 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 2829da879dd14..ee4a6aebc232a 100644 --- a/storage/mroonga/packages/apt/Vagrantfile +++ b/storage/mroonga/packages/apt/Vagrantfile @@ -7,30 +7,43 @@ 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-jessie-i386", + :box => "bento/debian-8.9-i386", }, { - :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-amd64", + :box => "bento/debian-8.9", }, { - :id => "debian-jessie-i386", - :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0-i386_chef-provisionerless.box", + :id => "debian-stretch-i386", + :box => "bento/debian-9.1-i386", }, { - :id => "debian-jessie-amd64", - :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0_chef-provisionerless.box", + :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 510886cb24fab..e0e03d8ec1541 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 a44d6b36871cf..51109aee4f728 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 11a4aea26dbf4..57c985f38f60a 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 fb0de850d6fd2..e0d963ffb5fcb 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 da1f8cd121caf..a95ad117ccc34 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 211e231a473ab..0000000000000 --- 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 259f8d1dc0c22..0000000000000 --- 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 366edca7b4ef9..0000000000000 --- 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 ec635144f6004..0000000000000 --- 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 d6d03fa9a4ec7..0000000000000 --- 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 bb41984e8e414..0000000000000 --- 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 ad2e27ef7dd32..0000000000000 --- 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 03f64cfedb40d..0000000000000 --- 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 9a3db8784a24e..0000000000000 --- 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 84d7f1ef4abf1..0000000000000 --- 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 7fad990d75f9a..0000000000000 --- 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 2a397b333e112..0000000000000 --- 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 e7b22cfa02502..72d860a90f2c9 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 04d1c41f2cc62..d23c499fd4491 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 e20e1b321627f..8bd2ba540d393 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 f3233d17afe5a..dea7cebc7d95c 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 cf1947e267643..abf3bfdee9eaa 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 143f5d0387e52..efd09777addbc 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 2297a50bfc932..7241391bcbf1c 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 8743520b5ac7f..1fedb2ecbe644 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 @@ class Uploader def initialize @dput_configuration_name = "groonga-ppa" + @use_pbuilder = false end def run @@ -36,7 +37,22 @@ def run @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 @@ def ensure_dput_configuration 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 @@ def parse_command_line! "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 192709fac6d72..240c3873a8928 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 f220634b1e7a8..8737f26232acf 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 22b29972885b4..0000000000000 --- 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 c83a376cdb93e..0000000000000 --- 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 d3e0e4f8b8ef6..0000000000000 --- 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 6ca288b6a8b42..0000000000000 --- 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 99d7e4042c5bb..0000000000000 --- 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 4c92b5c02cc58..69d803e84febd 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 82bc2a148ec64..a3d6681bf3b43 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 5cef259afe5c9..8247fd542f3ab 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 caabca179e75b..b56d80eb15159 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 f9ac176579222..729f181dbe38f 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 8321619868fae..9d1bd6061c67e 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 da41350eed31e..af14bc9a76b08 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 cf9ef581fd0e4..fc84e45024c71 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 8661e659390bb..6ba943ae74d32 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 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 -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-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 8c6d05baf5c16..3d327a17efb81 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 630b6c87422d3..59eeafa55aa07 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 48c32b26a12f0..120096f1f8f0a 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 a1ef0cae18334..024b4b9b53aba 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 f1679dc70fa2e..d3aaf6aecf709 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}" - 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" + 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 - ;; + 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 [ -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 + 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 + + 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 a5d0d81c3404c..54a9f35b03f53 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 76eed24a04242..71e12f0e3cab5 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 @@ def insert_facebook_html(html, language) 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 2b4591a60a44b..e3e22c8768aea 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 c723eb69f3573..7596c1ccc3230 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 d14f3ffd49dce..b4d0f8b20a3a4 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; } + 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; + } + + 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; - command = args->args[0]; - command_length = args->lengths[0]; - grn_ctx_send(ctx, command, command_length, 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 @@ MRN_API char *mroonga_command(UDF_INIT *initid, UDF_ARGS *args, char *result, 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 89b08a1c6d520..b97327fb1d0ce 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 @@ MRN_API my_bool mroonga_escape_init(UDF_INIT *initid, UDF_ARGS *args, 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]; - - 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_ctx *ctx = info->ctx; + + 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 0000000000000..dc46ef5f2055c --- /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 b54f5c5320640..fb4b5440ef10f 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 0000000000000..dd597946ea8ff --- /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 0000000000000..562499242fc08 --- /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 22ec0884014ac..7a35225545d40 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 @@ static my_bool mrn_snippet_prepare(st_mrn_snip_info *snip_info, UDF_ARGS *args, 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 @@ MRN_API char *mroonga_snippet(UDF_INIT *initid, UDF_ARGS *args, char *result, 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 0000000000000..99c9edfbba84f --- /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 380ab4b60cf45..ac2f098e31027 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 6c448a4e606ff..e27070f9e0c31 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 6f760a52b3010..1fc7028ff7e90 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 = \ + CMakeLists.txt \ README.md \ - bindings \ - version-gen.sh \ base_version \ + bindings \ + bundled_lz4_version \ + bundled_mecab_naist_jdic_version \ + bundled_mecab_version \ + config.h.cmake \ gpg_uid \ - CMakeLists.txt \ - config.h.cmake + 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 09e5764a02402..af0b5a7dbb503 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 d755e6b49fdf9..fca8c229a55f4 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 66184bf13be10..98dcc83a79ef6 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 25b08bbc78f00..bf993904af82d 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 310fb4585a379..a2a8b29ab79dc 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 0000000000000..53bc3af538855 --- /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 0000000000000..ee54209c7ab11 --- /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 3e43519071d7f..cd6a99a401f56 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 72d1d79b73f6d..f77cfb1d3e757 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 7b57eaaffdcc5..31be2c7ad17a9 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 0000000000000..96b1c9bc6e27e --- /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 d7ed91d0c565f..4ce55c55b6ab2 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 d45d453cba642..a0664d582706e 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 0000000000000..cd4866e5033c9 --- /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 7e06874dffd12..9e378f5530b88 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 55d113f92e947..2031b9aad8c70 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 02eb52f30a6dd..a0b424b3111c0 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 9a30ca8fc9c17..fca8465123cce 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 9cea8ce63c12a..c6e57c7b47ba5 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 e237377ba8033..047823b6ed7e8 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 c68f62e26ec43..161abe06757e2 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 0000000000000..6a126f402d53d --- /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 0000000000000..495c21efd6d17 --- /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 0000000000000..00445f812df9a --- /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 0000000000000..3e3c2f1e5edb0 --- /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 8e3bdaf216baa..bfd0cbdc01207 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 dad29c78f4c1c..414876c6a266b 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 b98397be05aec..e48700af07be0 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 aaad128a290b5..47e81754094c9 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 @@ - +