diff options
author | sasha@mysql.sashanet.com <> | 2001-07-17 16:23:36 -0600 |
---|---|---|
committer | sasha@mysql.sashanet.com <> | 2001-07-17 16:23:36 -0600 |
commit | b5f76be02425f62411b48bf12a1ea470ea193203 (patch) | |
tree | 6b12d97d09cd80fd52fbc48fbe802efa550e1112 /sql | |
parent | 66ab2056ccad4ad12ab0cd360e1d4d9d709a9951 (diff) | |
parent | ef88e507580fa1f2949afa1d5cde743339f7bc58 (diff) | |
download | mariadb-git-b5f76be02425f62411b48bf12a1ea470ea193203.tar.gz |
merged with 3.23
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_berkeley.cc | 4 | ||||
-rw-r--r-- | sql/ha_gemini.cc | 5 | ||||
-rw-r--r-- | sql/ha_gemini.h | 2 | ||||
-rw-r--r-- | sql/ha_innobase.cc | 45 | ||||
-rw-r--r-- | sql/ha_innobase.h | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/slave.cc | 1 | ||||
-rw-r--r-- | sql/slave.h | 4 | ||||
-rw-r--r-- | sql/sql_acl.cc | 7 | ||||
-rw-r--r-- | sql/sql_delete.cc | 7 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 3 |
13 files changed, 73 insertions, 14 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 32af39e4a0d..d2b3ef62865 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -453,9 +453,11 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) if ((primary_key=table->primary_key) >= MAX_KEY) { // No primary key primary_key=table->keys; + key_used_on_scan=MAX_KEY; ref_length=hidden_primary_key=BDB_HIDDEN_PRIMARY_KEY_LENGTH; } - key_used_on_scan=primary_key; + else + key_used_on_scan=primary_key; /* Need some extra memory in case of packed keys */ uint max_key_length= table->max_key_length + MAX_REF_PARTS*3; diff --git a/sql/ha_gemini.cc b/sql/ha_gemini.cc index c95a348f238..e80d9a001e6 100644 --- a/sql/ha_gemini.cc +++ b/sql/ha_gemini.cc @@ -1,5 +1,5 @@ -/* Copyright (C) 2000 NuSphere Corporation - +/* Copyright (C) 2000 MySQL AB & NuSphere Corporation + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* This file is based on ha_berkeley.cc */ #ifdef __GNUC__ #pragma implementation // gcc: Class implementation diff --git a/sql/ha_gemini.h b/sql/ha_gemini.h index 495dc2fd1c9..3bfe85bfba2 100644 --- a/sql/ha_gemini.h +++ b/sql/ha_gemini.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 NuSphere Corporation +/* Copyright (C) 2000 MySQL AB & NuSphere Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 184c97837db..bab5dc582e7 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -2885,4 +2885,49 @@ ha_innobase::store_lock( return(to); } +/*********************************************************************** +Returns the next auto-increment column value for the table. write_row +normally fetches the value from the cache in the data dictionary. This +function in used by SHOW TABLE STATUS and when the first insert to the table +is done after database startup. */ + +longlong +ha_innobase::get_auto_increment() +/*=============================*/ + /* out: the next auto-increment column value */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + longlong nr; + int error; + + (void) extra(HA_EXTRA_KEYREAD); + index_init(table->next_number_index); + + /* We use an exclusive lock when we read the max key value from the + auto-increment column index. This is because then build_template will + advise InnoDB to fetch all columns. In SHOW TABLE STATUS the query + id of the auto-increment column is not changed, and previously InnoDB + did not fetch it, causing SHOW TABLE STATUS to show wrong values + for the autoinc column. */ + + prebuilt->select_lock_type = LOCK_X; + prebuilt->trx->mysql_n_tables_locked += 1; + + error=index_last(table->record[1]); + + if (error) { + nr = 1; + } else { + nr = (longlong) table->next_number_field-> + val_int_offset(table->rec_buff_length) + 1; + } + + (void) extra(HA_EXTRA_NO_KEYREAD); + + index_end(); + + return(nr); +} + + #endif /* HAVE_INNOBASE_DB */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index d832ac93d0f..4dbff654337 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -147,6 +147,7 @@ class ha_innobase: public handler THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); + longlong get_auto_increment(); }; extern bool innodb_skip; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f328ee56727..bbc14f307c0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -272,6 +272,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, net_interactive_timeout, slow_launch_time = 2L, net_read_timeout,net_write_timeout,slave_open_temp_tables=0, open_files_limit=0, max_binlog_size; +ulong slave_net_timeout; ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0; volatile ulong cached_thread_count=0; @@ -2782,6 +2783,8 @@ CHANGEABLE_VAR changeable_vars[] = { 0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE }, { "record_buffer", (long*) &my_default_record_cache_size, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, + { "slave_net_timeout", (long*) &slave_net_timeout, + SLAVE_NET_TIMEOUT, 1, 65535, 0, 1 }, { "slow_launch_time", (long*) &slow_launch_time, 2L, 0L, ~0L, 0, 1 }, { "sort_buffer", (long*) &sortbuff_size, @@ -2903,6 +2906,7 @@ struct show_var_st init_vars[]= { {"query_buffer_size", (char*) &query_buff_size, SHOW_LONG}, {"safe_show_database", (char*) &opt_safe_show_db, SHOW_BOOL}, {"server_id", (char*) &server_id, SHOW_LONG}, + {"slave_net_timeout", (char*) &slave_net_timeout, SHOW_LONG}, {"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL}, {"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL}, {"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL}, diff --git a/sql/slave.cc b/sql/slave.cc index 488fb357c52..60011209cde 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -735,6 +735,7 @@ static int init_slave_thread(THD* thd) thd->system_thread = thd->bootstrap = 1; thd->client_capabilities = 0; my_net_init(&thd->net, 0); + thd->net.timeout = slave_net_timeout; thd->max_packet_length=thd->net.max_packet; thd->master_access= ~0; thd->priv_user = 0; diff --git a/sql/slave.h b/sql/slave.h index 8e49511e08d..85db0b75f53 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -2,6 +2,10 @@ #define SLAVE_H #include "mysql.h" +#define SLAVE_NET_TIMEOUT 3600 + +extern ulong slave_net_timeout; + typedef struct st_master_info { diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 0f3ee483400..0cca3df0b16 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1824,10 +1824,9 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, *Str, (!db ? rights : 0), what))) result= -1; - if (db) - if (( replace_db_table(tables[1].table, db, *Str, rights, - what))) - result= -1; + if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS, + what)) + result= -1; } VOID(pthread_mutex_unlock(&acl_cache->lock)); pthread_mutex_unlock(&LOCK_grant); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c2ac8c05b85..d14201822e0 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -178,12 +178,13 @@ int mysql_delete(THD *thd, select=make_select(table,0,0,conds,&error); if (error) DBUG_RETURN(-1); - if (select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), - limit)) + if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), + limit)) || + !limit) { delete select; send_ok(&thd->net,0L); - DBUG_RETURN(0); + DBUG_RETURN(0); // Nothing to delete } /* If running in safe sql mode, don't allow updates without keys */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 18774955f6a..981e64e5de5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -556,7 +556,7 @@ pthread_handler_decl(handle_one_connection,arg) free_root(&thd->mem_root,MYF(0)); if (net->error && net->vio != 0) { - if (!thd->killed && ! opt_warnings) + if (!thd->killed && opt_warnings) sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), thd->thread_id,(thd->db ? thd->db : "unconnected"), thd->user ? thd->user : "unauthenticated", diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4ed59f7d1b0..34e8985007e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -599,7 +599,7 @@ mysqld_show_logs(THD *thd) DBUG_RETURN(1); #ifdef HAVE_BERKELEY_DB - if (berkeley_show_logs(thd)) + if (!berkeley_skip && berkeley_show_logs(thd)) DBUG_RETURN(-1); #endif diff --git a/sql/sql_update.cc b/sql/sql_update.cc index a6ded7cef9c..609c2642bc6 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -114,7 +114,8 @@ int mysql_update(THD *thd, select=make_select(table,0,0,conds,&error); if (error || (select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), - limit))) + limit)) || + !limit) { delete select; table->time_stamp=save_time_stamp; // Restore timestamp pointer |