diff options
author | Michael Widenius <monty@askmonty.org> | 2010-08-06 15:51:07 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-08-06 15:51:07 +0300 |
commit | 569c37163e0e7afb8f9da37f5d67a2b52e610146 (patch) | |
tree | bad667053d9e1308d31c26091bbcc622a017a93f | |
parent | 2b0d16bcd9833ce73062c555f6755b9863e92ee2 (diff) | |
parent | 50b43cf8055819290f7155a052d52cc563928f22 (diff) | |
download | mariadb-git-569c37163e0e7afb8f9da37f5d67a2b52e610146.tar.gz |
Merge with MariaDB 5.1
-rw-r--r-- | client/mysqlslap.c | 12 | ||||
-rw-r--r-- | mysql-test/suite/maria/r/maria.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/maria/t/maria.test | 15 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/t/skip_name_resolve-master.opt | 1 | ||||
-rw-r--r-- | sql/handler.cc | 17 | ||||
-rw-r--r-- | sql/handler.h | 3 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 31 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 12 |
8 files changed, 77 insertions, 20 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 1d1fe4c27ed..7590ff35b5f 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -543,7 +543,7 @@ static struct my_option my_long_options[] = 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, "Specify test load type: mixed, update, write, key, or read; default is mixed.", - &auto_generate_sql_type, &auto_generate_sql_type, + (char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"auto-generate-sql-secondary-indexes", OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, @@ -574,13 +574,13 @@ static struct my_option my_long_options[] = &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"concurrency", 'c', "Number of clients to simulate for query to run.", - &concurrency_str, &concurrency_str, 0, GET_STR, + (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.", &create_string, &create_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.", - &create_schema_string, &create_schema_string, 0, GET_STR, + (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"csv", OPT_SLAP_CSV, "Generate CSV output to named file or to stdout if no file is named.", @@ -590,7 +590,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", - &default_dbug_option, &default_dbug_option, 0, GET_STR, + (char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", @@ -618,11 +618,11 @@ static struct my_option my_long_options[] = &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, {"number-char-cols", 'x', "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.", - &num_char_cols_opt, &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG, + (char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"number-int-cols", 'y', "Number of INT columns to create in table if specifying --auto-generate-sql.", - &num_int_cols_opt, &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, + (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, "Limit each client to this number of queries (this is not exact).", diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/r/maria.result index 5d7a5fec78b..76a115982f0 100644 --- a/mysql-test/suite/maria/r/maria.result +++ b/mysql-test/suite/maria/r/maria.result @@ -2607,3 +2607,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 drop table t1; +CREATE TABLE t1 ( f1 DOUBLE , f2 DOUBLE , f3 DOUBLE , f4 DOUBLE , v3 DOUBLE , v4 DOUBLE , KEY ( v3 ) , KEY ( v4 ) ) engine=maria; +REPLACE t1 ( f2 , f1 ) VALUES ( f2 , 56 ) ; +INSERT t1 ( f1 , f2 , f3 , f4 ) VALUES ( 0 , f2 , 8 , f3 ) ; +INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ; +DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ; +drop table t1; diff --git a/mysql-test/suite/maria/t/maria.test b/mysql-test/suite/maria/t/maria.test index 35ccb6263e3..a4498070390 100644 --- a/mysql-test/suite/maria/t/maria.test +++ b/mysql-test/suite/maria/t/maria.test @@ -1881,6 +1881,21 @@ Create table t1 (a int) engine="aria"; show create table t1; drop table t1; +# +# Test of LP#614265. This happens when we where using quick_range_select in +# delete +# + +CREATE TABLE t1 ( f1 DOUBLE , f2 DOUBLE , f3 DOUBLE , f4 DOUBLE , v3 DOUBLE , v4 DOUBLE , KEY ( v3 ) , KEY ( v4 ) ) engine=maria; +REPLACE t1 ( f2 , f1 ) VALUES ( f2 , 56 ) ; +INSERT t1 ( f1 , f2 , f3 , f4 ) VALUES ( 0 , f2 , 8 , f3 ) ; +INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ; +DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ; +drop table t1; + +# +# End of test +# # Set defaults back --disable_result_log --disable_query_log diff --git a/mysql-test/suite/pbxt/t/skip_name_resolve-master.opt b/mysql-test/suite/pbxt/t/skip_name_resolve-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/pbxt/t/skip_name_resolve-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/sql/handler.cc b/sql/handler.cc index 10f14be26ae..7ff4a616fd7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2029,6 +2029,10 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, handler *handler::clone(MEM_ROOT *mem_root) { handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); + + if (!new_handler) + return NULL; + /* Allocate handler->ref here because otherwise ha_open will allocate it on this->table->mem_root and we will not be able to reclaim that memory @@ -2036,12 +2040,13 @@ handler *handler::clone(MEM_ROOT *mem_root) */ if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2))) return NULL; - if (new_handler && !new_handler->ha_open(table, - table->s->normalized_path.str, - table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - return new_handler; - return NULL; + if (new_handler->ha_open(table, + table->s->normalized_path.str, + table->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) + return NULL; + new_handler->cloned= 1; // Marker for debugging + return new_handler; } diff --git a/sql/handler.h b/sql/handler.h index ad4743b78b1..0306f8aec61 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1245,6 +1245,7 @@ public: bool locked; bool implicit_emptied; /* Can be !=0 only if HEAP */ bool mark_trx_done; + bool cloned; /* 1 if this was created with clone */ const COND *pushed_cond; /** next_insert_id is the next value which should be inserted into the @@ -1288,7 +1289,7 @@ public: ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref_length(sizeof(my_off_t)), ft_handler(0), inited(NONE), - locked(FALSE), implicit_emptied(FALSE), mark_trx_done(FALSE), + locked(FALSE), implicit_emptied(FALSE), mark_trx_done(FALSE), cloned(0), pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0), auto_inc_intervals_count(0) { diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 9176e99c912..b8f31cce755 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -826,7 +826,11 @@ handler *ha_maria::clone(MEM_ROOT *mem_root) { ha_maria *new_handler= static_cast <ha_maria *>(handler::clone(mem_root)); if (new_handler) + { new_handler->file->state= file->state; + /* maria_create_trn_for_mysql() is never called for clone() tables */ + new_handler->file->trn= file->trn; + } return new_handler; } @@ -1078,6 +1082,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) HA_CHECK param; MARIA_SHARE *share= file->s; const char *old_proc_info= thd_proc_info(thd, "Checking table"); + TRN *old_trn= file->trn; maria_chk_init(¶m); param.thd= thd; @@ -1156,6 +1161,8 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); thd_proc_info(thd, old_proc_info); return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; } @@ -1379,11 +1386,13 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) { int error; HA_CHECK param; + TRN *old_trn; MARIA_SHARE *share= file->s; if (!file) return HA_ADMIN_INTERNAL_ERROR; + old_trn= file->trn; maria_chk_init(¶m); param.thd= thd; param.op_name= "zerofill"; @@ -1391,6 +1400,9 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) param.sort_buffer_length= THDVAR(thd, sort_buffer_size); error=maria_zerofill(¶m, file, share->open_file_name.str); + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); + if (!error) { pthread_mutex_lock(&share->intern_lock); @@ -1404,6 +1416,7 @@ int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt) { int error; HA_CHECK param; + if (!file) return HA_ADMIN_INTERNAL_ERROR; @@ -1420,6 +1433,7 @@ int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt) param.testflag &= ~T_REP_BY_SORT; error= repair(thd, ¶m, 1); } + return error; } @@ -1433,6 +1447,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) char fixed_name[FN_REFLEN]; MARIA_SHARE *share= file->s; ha_rows rows= file->state->records; + TRN *old_trn= file->trn; DBUG_ENTER("ha_maria::repair"); /* @@ -1594,6 +1609,9 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) thd_proc_info(thd, old_proc_info); if (!thd->locked_tables) maria_lock_database(file, F_UNLCK); + + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); error= error ? HA_ADMIN_FAILED : (optimize_done ? (write_log_record_for_repair(param, file) ? HA_ADMIN_FAILED : @@ -2331,6 +2349,8 @@ int ha_maria::info(uint flag, my_bool lock_table_share) int ha_maria::extra(enum ha_extra_function operation) { + int tmp; + TRN *old_trn= file->trn; if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD) return 0; #ifdef NOT_USED @@ -2356,7 +2376,9 @@ int ha_maria::extra(enum ha_extra_function operation) TRN *trn= THD_TRN; _ma_set_trn_for_table(file, trn); } - return maria_extra(file, operation, 0); + tmp= maria_extra(file, operation, 0); + file->trn= old_trn; // Reset trn if was used + return tmp; } int ha_maria::reset(void) @@ -2451,6 +2473,13 @@ int ha_maria::external_lock(THD *thd, int lock_type) *file->state= file->s->state.state; } + if (file->trn) + { + /* This can only happen with tables created with clone() */ + DBUG_ASSERT(cloned); + trnman_increment_locked_tables(file->trn); + } + if (!thd->transaction.on) { /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 47ab569b725..5c75dd0a30d 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18321,14 +18321,14 @@ static char **defaults_argv; static struct my_option client_test_long_options[] = { - {"basedir", 'b', "Basedir for tests.", &opt_basedir, - &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"basedir", 'b', "Basedir for tests.", (char**) &opt_basedir, + (char**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"count", 't', "Number of times test to be executed", &opt_count, &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, {"database", 'D', "Database to use", &opt_db, &opt_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"debug", '#', "Output debug log", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host", &opt_host, &opt_host, @@ -18364,8 +18364,8 @@ static struct my_option client_test_long_options[] = {"user", 'u', "User for login if not current user", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"vardir", 'v', "Data dir for tests.", &opt_vardir, - &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"vardir", 'v', "Data dir for tests.", (char**) &opt_vardir, + (char**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"getopt-ll-test", 'g', "Option for testing bug in getopt library", &opt_getopt_ll_test, &opt_getopt_ll_test, 0, GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0}, |