diff options
author | unknown <mskold@mysql.com> | 2005-01-17 09:44:34 +0100 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2005-01-17 09:44:34 +0100 |
commit | 78edb8a569e33ae8f7957240166c0a5eef9f0347 (patch) | |
tree | bbce6ee6332b88bfdd3cded288413658c0bd922c /sql | |
parent | e7f2dc6ba5b07ee1434c6c636f9457cee1fd9f54 (diff) | |
parent | 41c1a6c658d629c914cde4811074a0586caeb4a7 (diff) | |
download | mariadb-git-78edb8a569e33ae8f7957240166c0a5eef9f0347.tar.gz |
Merge
sql/filesort.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 25 | ||||
-rw-r--r-- | sql/filesort.cc | 5 | ||||
-rw-r--r-- | sql/ha_berkeley.cc | 2 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 28 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 142 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 39 | ||||
-rw-r--r-- | sql/opt_range.cc | 10 | ||||
-rw-r--r-- | sql/set_var.cc | 8 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 34 | ||||
-rw-r--r-- | sql/sql_analyse.cc | 15 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 6 | ||||
-rw-r--r-- | sql/sql_show.cc | 14 |
14 files changed, 218 insertions, 114 deletions
diff --git a/sql/field.cc b/sql/field.cc index 175ca09df37..400ebf65273 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4390,13 +4390,20 @@ int Field_str::store(double nr) char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; uint length; bool use_scientific_notation= TRUE; - use_scientific_notation= TRUE; - if (field_length < 32 && fabs(nr) < log_10[field_length]-1) + /* + Check fabs(nr) against longest value that can be stored in field, + which depends on whether the value is < 1 or not, and negative or not + */ + double anr= fabs(nr); + int neg= (nr < 0.0) ? 1 : 0; + if (field_length > 4 && field_length < 32 && + (anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */ + : anr < log_10[field_length-neg]-1)) use_scientific_notation= FALSE; length= (uint) my_sprintf(buff, (buff, "%-.*g", (use_scientific_notation ? - max(0, (int)field_length-5) : + max(0, (int)field_length-neg-5) : field_length), nr)); /* @@ -4482,8 +4489,7 @@ void Field_string::sort_string(char *to,uint length) uint tmp=my_strnxfrm(field_charset, (unsigned char *) to, length, (unsigned char *) ptr, field_length); - if (tmp < length) - field_charset->cset->fill(field_charset, to + tmp, length - tmp, ' '); + DBUG_ASSERT(tmp == length); } @@ -4834,9 +4840,7 @@ void Field_varstring::sort_string(char *to,uint length) (uchar*) to, length, (uchar*) ptr + length_bytes, tot_length); - if (tot_length < length) - field_charset->cset->fill(field_charset, to+tot_length,length-tot_length, - binary() ? (char) 0 : ' '); + DBUG_ASSERT(tot_length == length); } @@ -5511,10 +5515,7 @@ void Field_blob::sort_string(char *to,uint length) blob_length=my_strnxfrm(field_charset, (uchar*) to, length, (uchar*) blob, blob_length); - if (blob_length < length) - field_charset->cset->fill(field_charset, to+blob_length, - length-blob_length, - binary() ? (char) 0 : ' '); + DBUG_ASSERT(blob_length == length); } } diff --git a/sql/filesort.cc b/sql/filesort.cc index 6bad5202ec6..486215e51a1 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -657,10 +657,7 @@ static void make_sortkey(register SORTPARAM *param, } uint tmp_length=my_strnxfrm(cs,to,sort_field->length, (unsigned char *) from, length); - if (tmp_length < sort_field->length) - cs->cset->fill(cs, (char*) to+tmp_length, - sort_field->length-tmp_length, - fill_char); + DBUG_ASSERT(tmp_length == sort_field->length); } else { diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index fe266fdbf14..915d5dcea26 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -165,11 +165,13 @@ bool berkeley_init(void) { db_env->close(db_env,0); /* purecov: inspected */ db_env=0; /* purecov: inspected */ + goto err; } (void) hash_init(&bdb_open_tables,system_charset_info,32,0,0, (hash_get_key) bdb_get_key,0,0); pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST); +err: DBUG_RETURN(db_env == 0); } diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 02da7f876e2..d49f1c1ad46 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2302,13 +2302,7 @@ build_template( ulint n_fields; ulint n_requested_fields = 0; ibool fetch_all_in_key = FALSE; - ibool fetch_primary_key_cols = TRUE; /* The ROR code in - opt_range.cc assumes that the - primary key cols are always - retrieved. Starting from - MySQL-5.0.2, let us always - fetch them, even though it - wastes some CPU. */ + ibool fetch_primary_key_cols = FALSE; ulint i; if (prebuilt->select_lock_type == LOCK_X) { @@ -4039,8 +4033,8 @@ ha_innobase::create( DBUG_ASSERT(innobase_table != 0); - if ((thd->lex->create_info.used_fields & HA_CREATE_USED_AUTO) && - (thd->lex->create_info.auto_increment_value != 0)) { + if ((create_info->used_fields & HA_CREATE_USED_AUTO) && + (create_info->auto_increment_value != 0)) { /* Query was ALTER TABLE...AUTO_INCREMENT = x; or CREATE TABLE ...AUTO_INCREMENT = x; Find out a table @@ -4049,7 +4043,7 @@ ha_innobase::create( auto increment field if the value is greater than the maximum value in the column. */ - auto_inc_value = thd->lex->create_info.auto_increment_value; + auto_inc_value = create_info->auto_increment_value; dict_table_autoinc_initialize(innobase_table, auto_inc_value); } @@ -5710,7 +5704,9 @@ ha_innobase::store_lock( if ((lock_type == TL_READ && thd->in_lock_tables) || (lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) || lock_type == TL_READ_WITH_SHARED_LOCKS || - lock_type == TL_READ_NO_INSERT) { + lock_type == TL_READ_NO_INSERT || + thd->lex->sql_command != SQLCOM_SELECT) { + /* The OR cases above are in this order: 1) MySQL is doing LOCK TABLES ... READ LOCAL, or 2) (we do not know when TL_READ_HIGH_PRIORITY is used), or @@ -5718,7 +5714,15 @@ ha_innobase::store_lock( 4) we are doing a complex SQL statement like INSERT INTO ... SELECT ... and the logical logging (MySQL binlog) requires the use of a locking read, or - MySQL is doing LOCK TABLES ... READ. */ + MySQL is doing LOCK TABLES ... READ. + 5) we let InnoDB do locking reads for all SQL statements that + are not simple SELECTs; note that select_lock_type in this + case may get strengthened in ::external_lock() to LOCK_X. + Note that we MUST use a locking read in all data modifying + SQL statements, because otherwise the execution would not be + serializable, and also the results from the update could be + unexpected if an obsolete consistent read view would be + used. */ prebuilt->select_lock_type = LOCK_S; prebuilt->stored_select_lock_type = LOCK_S; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 2da25e6c109..8a2b8c8d9ae 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -85,7 +85,7 @@ static int unpackfrm(const void **data, uint *len, const void* pack_data); static int ndb_get_table_statistics(Ndb*, const char *, - Uint64* rows, Uint64* commits); + struct Ndb_statistics *); /* @@ -95,6 +95,44 @@ static int ndb_get_table_statistics(Ndb*, const char *, static uint32 dummy_buf; /* + Stats that can be retrieved from ndb +*/ + +struct Ndb_statistics { + Uint64 row_count; + Uint64 commit_count; + Uint64 row_size; + Uint64 fragment_memory; +}; + +/* Status variables shown with 'show status like 'Ndb%' */ + +static long ndb_cluster_node_id= 0; +static const char * ndb_connected_host= 0; +static long ndb_connected_port= 0; +static long ndb_number_of_replicas= 0; +static long ndb_number_of_storage_nodes= 0; + +static int update_status_variables(Ndb_cluster_connection *c) +{ + ndb_cluster_node_id= c->node_id(); + ndb_connected_port= c->get_connected_port(); + ndb_connected_host= c->get_connected_host(); + ndb_number_of_replicas= 0; + ndb_number_of_storage_nodes= c->no_db_nodes(); + return 0; +} + +struct show_var_st ndb_status_variables[]= { + {"cluster_node_id", (char*) &ndb_cluster_node_id, SHOW_LONG}, + {"connected_host", (char*) &ndb_connected_host, SHOW_CHAR_PTR}, + {"connected_port", (char*) &ndb_connected_port, SHOW_LONG}, +// {"number_of_replicas", (char*) &ndb_number_of_replicas, SHOW_LONG}, + {"number_of_storage_nodes",(char*) &ndb_number_of_storage_nodes, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} +}; + +/* Error handling functions */ @@ -465,9 +503,11 @@ void ha_ndbcluster::records_update() // if (info->records == ~(ha_rows)0) { Ndb *ndb= get_ndb(); - Uint64 rows; - if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0) == 0){ - info->records= rows; + struct Ndb_statistics stat; + if(ndb_get_table_statistics(ndb, m_tabname, &stat) == 0){ + mean_rec_length= stat.row_size; + data_file_length= stat.fragment_memory; + info->records= stat.row_count; } } { @@ -2931,10 +2971,19 @@ void ha_ndbcluster::info(uint flag) if ((my_errno= check_ndb_connection())) DBUG_VOID_RETURN; Ndb *ndb= get_ndb(); - Uint64 rows= 100; - if (current_thd->variables.ndb_use_exact_count) - ndb_get_table_statistics(ndb, m_tabname, &rows, 0); - records= rows; + struct Ndb_statistics stat; + if (current_thd->variables.ndb_use_exact_count && + ndb_get_table_statistics(ndb, m_tabname, &stat) == 0) + { + mean_rec_length= stat.row_size; + data_file_length= stat.fragment_memory; + records= stat.row_count; + } + else + { + mean_rec_length= 0; + records= 100; + } } } if (flag & HA_STATUS_CONST) @@ -4240,6 +4289,8 @@ Thd_ndb* ha_ndbcluster::seize_thd_ndb() thd_ndb= new Thd_ndb(); thd_ndb->ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info)); + + if (thd_ndb->ndb->init(max_transactions) != 0) { ERR_PRINT(thd_ndb->ndb->getNdbError()); @@ -4565,6 +4616,13 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, a NDB Cluster table handler */ +/* Call back after cluster connect */ +static int connect_callback() +{ + update_status_variables(g_ndb_cluster_connection); + return 0; +} + bool ndbcluster_init() { int res; @@ -4594,6 +4652,7 @@ bool ndbcluster_init() if ((res= g_ndb_cluster_connection->connect(0,0,0)) == 0) { + connect_callback(); DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d", g_ndb_cluster_connection->get_connected_host(), g_ndb_cluster_connection->get_connected_port())); @@ -4601,7 +4660,7 @@ bool ndbcluster_init() } else if(res == 1) { - if (g_ndb_cluster_connection->start_connect_thread()) + if (g_ndb_cluster_connection->start_connect_thread(connect_callback)) { DBUG_PRINT("error", ("g_ndb_cluster_connection->start_connect_thread()")); goto ndbcluster_init_error; @@ -5019,8 +5078,8 @@ static int unpackfrm(const void **unpack_data, uint *unpack_len, static int -ndb_get_table_statistics(Ndb* ndb, const char * table, - Uint64* row_count, Uint64* commit_count) +ndb_get_table_statistics(Ndb* ndb, const char * table, + struct Ndb_statistics * ndbstat) { DBUG_ENTER("ndb_get_table_statistics"); DBUG_PRINT("enter", ("table: %s", table)); @@ -5041,9 +5100,11 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, if (check == -1) break; - Uint64 rows, commits; + Uint64 rows, commits, size, mem; pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows); pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits); + pOp->getValue(NdbDictionary::Column::ROW_SIZE, (char*)&size); + pOp->getValue(NdbDictionary::Column::FRAGMENT_MEMORY, (char*)&mem); check= pTrans->execute(NdbTransaction::NoCommit, NdbTransaction::AbortOnError, @@ -5053,10 +5114,15 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, Uint64 sum_rows= 0; Uint64 sum_commits= 0; + Uint64 sum_row_size= 0; + Uint64 sum_mem= 0; while((check= pOp->nextResult(TRUE, TRUE)) == 0) { sum_rows+= rows; sum_commits+= commits; + if (sum_row_size < size) + sum_row_size= size; + sum_mem+= mem; } if (check == -1) @@ -5065,11 +5131,14 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, pOp->close(TRUE); ndb->closeTransaction(pTrans); - if(row_count) - * row_count= sum_rows; - if(commit_count) - * commit_count= sum_commits; - DBUG_PRINT("exit", ("records: %u commits: %u", sum_rows, sum_commits)); + + ndbstat->row_count= sum_rows; + ndbstat->commit_count= sum_commits; + ndbstat->row_size= sum_row_size; + ndbstat->fragment_memory= sum_mem; + + DBUG_PRINT("exit", ("records: %u commits: %u row_size: %d mem: %d", + sum_rows, sum_commits, sum_row_size, sum_mem)); DBUG_RETURN(0); } while(0); @@ -6227,4 +6296,43 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack, DBUG_RETURN(0); } +char* +ha_ndbcluster::update_table_comment( + /* out: table comment + additional */ + const char* comment)/* in: table comment defined by user */ +{ + uint length= strlen(comment); + if(length > 64000 - 3) + { + return((char*)comment); /* string too long */ + } + + Ndb* ndb; + if (!(ndb= get_ndb())) + { + return((char*)comment); + } + + ndb->setDatabaseName(m_dbname); + NDBDICT* dict= ndb->getDictionary(); + const NDBTAB* tab; + if (!(tab= dict->getTable(m_tabname))) + { + return((char*)comment); + } + + char *str; + const char *fmt="%s%snumber_of_replicas: %d"; + const unsigned fmt_len_plus_extra= length + strlen(fmt); + if ((str= my_malloc(fmt_len_plus_extra, MYF(0))) == NULL) + { + return (char*)comment; + } + + snprintf(str,fmt_len_plus_extra,fmt,comment, + length > 0 ? " ":"", + tab->getReplicaCount()); + return str; +} + #endif /* HAVE_NDBCLUSTER_DB */ diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 8a2aa472b4a..df30e0ef2ac 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -467,6 +467,8 @@ class ha_ndbcluster: public handler Ndb *get_ndb(); }; +extern struct show_var_st ndb_status_variables[]; + bool ndbcluster_init(void); bool ndbcluster_end(void); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6e0c98c83b5..94c780301e1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -147,6 +147,10 @@ int deny_severity = LOG_WARNING; #include <sys/mman.h> #endif +#define zVOLSTATE_ACTIVE 6 +#define zVOLSTATE_DEACTIVE 2 +#define zVOLSTATE_MAINTENANCE 3 + #ifdef __NETWARE__ #include <nks/vm.h> #include <library.h> @@ -1683,7 +1687,9 @@ ulong neb_event_callback(struct EventBlock *eblock) voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData; /* Deactivation of a volume */ - if ((voldata->oldState == 6 && voldata->newState == 2)) + if ((voldata->oldState == zVOLSTATE_ACTIVE && + voldata->newState == zVOLSTATE_DEACTIVE || + voldata->newState == zVOLSTATE_MAINTENANCE)) { /* Ensure that we bring down MySQL server only for MySQL data @@ -4419,6 +4425,9 @@ Disable with --skip-large-pages.", Disable with --skip-innodb (will save memory).", (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, OPT_INNODB_DEFAULT, 0, 0, 0, 0, 0}, + {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \ +Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums, + (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH, "Path to individual files and their sizes.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -4430,9 +4439,6 @@ Disable with --skip-innodb (will save memory).", {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer (enabled by default). \ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled by default). \ -Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums, - (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, "Speeds up server shutdown process.", (gptr*) &innobase_fast_shutdown, (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, @@ -5023,6 +5029,12 @@ log and this option does nothing anymore.", "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0}, + {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS, + "Number of times a thread is allowed to enter InnoDB within the same \ + SQL query after it has once got the ticket", + (gptr*) &srv_n_free_tickets_to_enter, + (gptr*) &srv_n_free_tickets_to_enter, + 0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0}, {"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS, "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads, (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0, @@ -5056,17 +5068,6 @@ log and this option does nothing anymore.", "How many files at the maximum InnoDB keeps open at the same time.", (gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0, GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0}, - {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS, - "Count of spin-loop rounds in InnoDB mutexes", - (gptr*) &srv_n_spin_wait_rounds, - (gptr*) &srv_n_spin_wait_rounds, - 0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0}, - {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS, - "Number of times a thread is allowed to enter InnoDB within the same \ - SQL query after it has once got the ticket", - (gptr*) &srv_n_free_tickets_to_enter, - (gptr*) &srv_n_free_tickets_to_enter, - 0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0}, #ifdef HAVE_REPLICATION /* Disabled for the 4.1.3 release. Disabling just this paragraph of code is @@ -5087,6 +5088,11 @@ log and this option does nothing anymore.", 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, #endif #endif + {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS, + "Count of spin-loop rounds in InnoDB mutexes", + (gptr*) &srv_n_spin_wait_rounds, + (gptr*) &srv_n_spin_wait_rounds, + 0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0}, {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY, "Helps in performance tuning in heavily concurrent environments.", (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency, @@ -5616,6 +5622,9 @@ struct show_var_st status_vars[]= { SHOW_KEY_CACHE_LONG}, {"Last_query_cost", (char*) &last_query_cost, SHOW_DOUBLE}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, +#ifdef HAVE_NDBCLUSTER_DB + {"Ndb_", (char*) &ndb_status_variables, SHOW_VARS}, +#endif /*HAVE_NDBCLUSTER_DB*/ {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST}, {"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST}, {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST}, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d36ce743b05..4b0e5f036cb 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -912,7 +912,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) { DBUG_PRINT("info", ("Reusing handler %p", file)); if (file->extra(HA_EXTRA_KEYREAD) || - file->extra(HA_EXTRA_RETRIEVE_ALL_COLS) | + file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || init() || reset()) { DBUG_RETURN(1); @@ -937,7 +937,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) } if (file->extra(HA_EXTRA_KEYREAD) || - file->extra(HA_EXTRA_RETRIEVE_ALL_COLS) || + file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || init() || reset()) { file->close(); @@ -5621,7 +5621,8 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::prepare_unique"); /* We're going to just read rowids. */ - head->file->extra(HA_EXTRA_KEYREAD); + if (head->file->extra(HA_EXTRA_KEYREAD)) + DBUG_RETURN(1); /* Make innodb retrieve all PK member fields, so @@ -5630,7 +5631,8 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() (This also creates a deficiency - it is possible that we will retrieve parts of key that are not used by current query at all.) */ - head->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); + if (head->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY)) + DBUG_RETURN(1); cur_quick_it.rewind(); cur_quick= cur_quick_it++; diff --git a/sql/set_var.cc b/sql/set_var.cc index 3d5e08812e9..6cbf305e856 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -754,11 +754,11 @@ struct show_var_st init_vars[]= { {sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment, SHOW_SYS}, {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG }, {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, + {"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL}, + {sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS}, {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR}, {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR}, {"innodb_doublewrite", (char*) &innobase_use_doublewrite, SHOW_MY_BOOL}, - {"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL}, - {sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS}, {"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL}, {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, {"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL}, @@ -777,10 +777,10 @@ struct show_var_st init_vars[]= { {sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS}, {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG}, {"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG }, - {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS}, - {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS}, {sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS}, {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS}, + {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS}, + {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS}, #endif {sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS}, {sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS}, diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 5b48f27d2e3..951bffd698d 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -4023,28 +4023,11 @@ ER_DUMP_NOT_IMPLEMENTED swe "Tabellhanteraren klarar inte en binär kopiering av tabellen" ukr "ãÅÊ ÔÉÐ ÔÁÂÌÉæ ΊЦÄÔÒÉÍÕ¤ ¦ÎÁÒÎÕ ÐÅÒÅÄÁÞÕ ÔÁÂÌÉæ" ER_FLUSH_MASTER_BINLOG_CLOSED - cze "Binlog uzav-Bøen pøi pokusu o FLUSH MASTER" - dan "Binlog blev lukket mens kommandoen FLUSH MASTER blev udført" - nla "Binlog gesloten tijdens FLUSH MASTER poging" eng "Binlog closed, cannot RESET MASTER" - est "Binlog closed while trying to FLUSH MASTER" - fre "Le 'binlog' a été fermé pendant l'exécution du FLUSH MASTER" ger "Binlog geschlossen. Kann RESET MASTER nicht ausführen" - greek "Binlog closed while trying to FLUSH MASTER" - hun "Binlog closed while trying to FLUSH MASTER" - ita "Binlog e` stato chiuso durante l'esecuzione del FLUSH MASTER" - jpn "Binlog closed while trying to FLUSH MASTER" - kor "Binlog closed while trying to FLUSH MASTER" - nor "Binlog closed while trying to FLUSH MASTER" - norwegian-ny "Binlog closed while trying to FLUSH MASTER" - pol "Binlog closed while trying to FLUSH MASTER" por "Binlog fechado. Não pode fazer RESET MASTER" - rum "Binlog closed while trying to FLUSH MASTER" rus "ä×ÏÉÞÎÙÊ ÖÕÒÎÁÌ ÏÂÎÏ×ÌÅÎÉÑ ÚÁËÒÙÔ, ÎÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ RESET MASTER" serbian "Binarni log file zatvoren, ne mogu da izvršim komandu 'RESET MASTER'" - slo "Binlog closed while trying to FLUSH MASTER" - spa "Binlog cerrado mientras tentaba el FLUSH MASTER" - swe "Binärloggen stängdes medan FLUSH MASTER utfördes" ukr "òÅÐ̦ËÁæÊÎÉÊ ÌÏÇ ÚÁËÒÉÔÏ, ÎÅ ÍÏÖÕ ×ÉËÏÎÁÔÉ RESET MASTER" ER_INDEX_REBUILD cze "P-Bøebudování indexu dumpnuté tabulky '%-.64s' nebylo úspì¹né" @@ -4258,7 +4241,6 @@ ER_SLAVE_THREAD ita "Impossibile creare il thread 'slave', controllare le risorse di sistema" por "Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema" rus "îÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÐÏÔÏË ÐÏÄÞÉÎÅÎÎÏÇÏ ÓÅÒ×ÅÒÁ. ðÒÏ×ÅÒØÔÅ ÓÉÓÔÅÍÎÙÅ ÒÅÓÕÒÓÙ" - slo "Could not create slave thread, check system resources" serbian "Nisam mogao da startujem thread za podreðeni server, proverite sistemske resurse" spa "No puedo crear el thread esclavo, verifique recursos del sistema" swe "Kunde inte starta en tråd för replikering" @@ -4266,7 +4248,7 @@ ER_SLAVE_THREAD ER_TOO_MANY_USER_CONNECTIONS 42000 dan "Brugeren %-.64s har allerede mere end 'max_user_connections' aktive forbindelser" nla "Gebruiker %-.64s heeft reeds meer dan 'max_user_connections' actieve verbindingen" - eng "User %-.64s has already more than 'max_user_connections' active connections" + eng "User %-.64s already has more than 'max_user_connections' active connections" est "Kasutajal %-.64s on juba rohkem ühendusi kui lubatud 'max_user_connections' muutujaga" fre "L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connections actives" ger "Benutzer '%-.64s' hat mehr als max_user_connections aktive Verbindungen" @@ -4764,7 +4746,7 @@ ER_SLAVE_WAS_RUNNING spa "Slave ya está funcionando" swe "Slaven har redan startat" ER_SLAVE_WAS_NOT_RUNNING - eng "Slave has already been stopped" + eng "Slave already has been stopped" ger "Slave wurde bereits angehalten" por "O slave já está parado" spa "Slave ya fué parado" @@ -4788,9 +4770,7 @@ ER_ZLIB_Z_DATA_ERROR eng "ZLIB: Input data corrupted" ger "ZLIB: Eingabedaten beschädigt" por "ZLIB: Dados de entrada está corrupto" - spa "Z_DATA_ERROR: Dato de entrada fué corrompido para zlib" - swe "Z_DATA_ERROR: Input data was corrupted for zlib" - ukr "Z_DATA_ERROR: Input data was corrupted for zlib" + spa "ZLIB: Dato de entrada fué corrompido para zlib" ER_CUT_VALUE_GROUP_CONCAT eng "%d line(s) were cut by GROUP_CONCAT()" ger "%d Zeile(n) durch GROUP_CONCAT() abgeschnitten" @@ -4867,8 +4847,6 @@ ER_SLAVE_IGNORED_SSL_PARAMS ger "SSL-Parameter in CHANGE MASTER werden ignoriert, weil dieser MySQL-Slave ohne SSL-Unterstützung kompiliert wurde. Sie können aber später verwendet werden, wenn der MySQL-Slave mit SSL gestartet wird" por "SSL parâmetros em CHANGE MASTER são ignorados porque este escravo MySQL foi compilado sem o SSL suporte. Os mesmos podem ser usados mais tarde quando o escravo MySQL com SSL seja iniciado." spa "Parametros SSL en CHANGE MASTER son ignorados porque este slave MySQL fue compilado sin soporte SSL; pueden ser usados despues cuando el slave MySQL con SSL sea inicializado" - swe "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started" - ukr "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started" ER_SERVER_IS_IN_SECURE_AUTH_MODE eng "Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format" ger "Server läuft im Modus --secure-auth, aber '%s'@'%s' hat ein Passwort im alten Format. Bitte Passwort ins neue Format ändern" @@ -4965,26 +4943,20 @@ ER_TOO_MUCH_AUTO_TIMESTAMP_COLS eng "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" por "Incorreta definição de tabela; Pode ter somente uma coluna TIMESTAMP com CURRENT_TIMESTAMP em DEFAULT ou ON UPDATE cláusula" spa "Incorrecta definición de tabla; Solamente debe haber una columna TIMESTAMP con CURRENT_TIMESTAMP en DEFAULT o ON UPDATE cláusula" - swe "Incorrect table definition; There can only be one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" - ukr "Incorrect table definition; There can only be one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" ER_INVALID_ON_UPDATE eng "Invalid ON UPDATE clause for '%-.64s' column" por "Inválida cláusula ON UPDATE para campo '%-.64s'" spa "Inválido ON UPDATE cláusula para campo '%-.64s'" - swe "Invalid ON UPDATE clause for '%-.64s' field" - ukr "Invalid ON UPDATE clause for '%-.64s' field" ER_UNSUPPORTED_PS eng "This command is not supported in the prepared statement protocol yet" ER_GET_ERRMSG dan "Modtog fejl %d '%-.100s' fra %s" eng "Got error %d '%-.100s' from %s" - jpn "Got NDB error %d '%-.100s'" nor "Mottok feil %d '%-.100s' fa %s" norwegian-ny "Mottok feil %d '%-.100s' fra %s" ER_GET_TEMPORARY_ERRMSG dan "Modtog temporary fejl %d '%-.100s' fra %s" eng "Got temporary error %d '%-.100s' from %s" - jpn "Got temporary NDB error %d '%-.100s'" nor "Mottok temporary feil %d '%-.100s' fra %s" norwegian-ny "Mottok temporary feil %d '%-.100s' fra %s" ER_UNKNOWN_TIME_ZONE diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index a8c0d689794..6a9a9e51231 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -1029,20 +1029,19 @@ uint check_ulonglong(const char *str, uint length) } /* check_ulonlong */ - /* - FUNCTION: append_escaped() - + Quote special characters in a string. + + SYNOPSIS + append_escaped(to_str, from_str) + to_str (in) A pointer to a String. + from_str (to) A pointer to an allocated string + DESCRIPTION append_escaped() takes a String type variable, where it appends escaped the second argument. Only characters that require escaping will be escaped. - ARGUMENTS - A pointer to a String variable, where results will be appended - A pointer to a String variable, which is appended to the result - String, escaping those characters that require it. - RETURN VALUES 0 Success 1 Out of memory diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6082b943b7f..b7a75a0bdd6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -77,7 +77,7 @@ const char *command_name[]={ "Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist", "Connect","Kill","Debug","Ping","Time","Delayed insert","Change user", "Binlog Dump","Table Dump", "Connect Out", "Register Slave", - "Prepare", "Prepare Execute", "Long Data", "Close stmt", + "Prepare", "Execute", "Long Data", "Close stmt", "Reset stmt", "Set option", "Fetch", "Error" // Last command number }; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6364d5ae039..9e4f6c1334c 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1740,7 +1740,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, DBUG_RETURN(TRUE); } - mysql_log.write(thd, COM_PREPARE, "%s", packet); + mysql_log.write(thd, COM_PREPARE, "[%lu] %s", stmt->id, packet); thd->current_arena= stmt; mysql_init_query(thd, (uchar *) thd->query, thd->query_length); @@ -1990,6 +1990,10 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) goto err; } + mysql_log.write(thd, COM_EXECUTE, "[%lu] %s", stmt->id, + expanded_query.length() ? expanded_query.c_ptr() : + stmt->query); + thd->protocol= &thd->protocol_prep; // Switch to binary protocol if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),QUERY_PRIOR); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b1fd0cbbccd..2aa8a67fbab 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -887,14 +887,18 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) && !limited_mysql_mode && !foreign_db_mode) { - if (share->db_type == DB_TYPE_HEAP && - key_info->algorithm == HA_KEY_ALG_BTREE) - packet->append(" USING BTREE", 12); - + if (key_info->algorithm == HA_KEY_ALG_BTREE) + packet->append(" USING BTREE", 12); + + if (key_info->algorithm == HA_KEY_ALG_HASH) + packet->append(" USING HASH", 11); + // +BAR: send USING only in non-default case: non-spatial rtree if ((key_info->algorithm == HA_KEY_ALG_RTREE) && !(key_info->flags & HA_SPATIAL)) - packet->append(" USING RTREE", 12); + packet->append(" USING RTREE", 12); + + // No need to send USING FULLTEXT, it is sent as FULLTEXT KEY } packet->append(" (", 2); |