summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-10-15 16:23:01 +0300
committerunknown <monty@mashka.mysql.fi>2003-10-15 16:23:01 +0300
commit60fb31ddec27323101ad491bf324da5df2b04ab6 (patch)
tree38e01149b27f4d0b0b29f436336f67902beb68fa /sql
parent4f5887b22d5d900a0e6166ff26f50d8c09e969f9 (diff)
parentcad75f4a429830e1dd9713a16bd13ace17623dc4 (diff)
downloadmariadb-git-60fb31ddec27323101ad491bf324da5df2b04ab6.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0 sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc21
-rw-r--r--sql/slave.cc5
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_handler.cc15
-rw-r--r--sql/sql_insert.cc14
-rw-r--r--sql/sql_parse.cc2
7 files changed, 45 insertions, 18 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c4739a060e1..811984e50b4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3134,7 +3134,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
** handle start options
******************************************************************************/
-enum options {
+enum options_mysqld {
OPT_ISAM_LOG=256, OPT_SKIP_NEW,
OPT_SKIP_GRANT, OPT_SKIP_LOCK,
OPT_ENABLE_LOCK, OPT_USE_LOCKING,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 642f7c21ce3..fbcc341f128 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -86,6 +86,7 @@ static void fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type);
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
+static void fix_max_connections(THD *thd, enum_var_type type);
/*
Variable definition list
@@ -147,7 +148,8 @@ sys_var_long_ptr sys_max_binlog_size("max_binlog_size",
&max_binlog_size,
fix_max_binlog_size);
sys_var_long_ptr sys_max_connections("max_connections",
- &max_connections);
+ &max_connections,
+ fix_max_connections);
sys_var_long_ptr sys_max_connect_errors("max_connect_errors",
&max_connect_errors);
sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads",
@@ -661,7 +663,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
thd->options&= ~OPTION_BIG_SELECTS;
}
}
-
+
/*
If one doesn't use the SESSION modifier, the isolation level
@@ -714,7 +716,7 @@ static void fix_key_buffer_size(THD *thd, enum_var_type type)
}
-void fix_delay_key_write(THD *thd, enum_var_type type)
+extern void fix_delay_key_write(THD *thd, enum_var_type type)
{
switch ((enum_delay_key_write) delay_key_write_options) {
case DELAY_KEY_WRITE_NONE:
@@ -730,7 +732,7 @@ void fix_delay_key_write(THD *thd, enum_var_type type)
}
}
-void fix_max_binlog_size(THD *thd, enum_var_type type)
+static void fix_max_binlog_size(THD *thd, enum_var_type type)
{
DBUG_ENTER("fix_max_binlog_size");
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
@@ -741,7 +743,7 @@ void fix_max_binlog_size(THD *thd, enum_var_type type)
DBUG_VOID_RETURN;
}
-void fix_max_relay_log_size(THD *thd, enum_var_type type)
+static void fix_max_relay_log_size(THD *thd, enum_var_type type)
{
DBUG_ENTER("fix_max_relay_log_size");
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
@@ -751,6 +753,13 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
DBUG_VOID_RETURN;
}
+#include <thr_alarm.h>
+static void
+fix_max_connections(THD *thd, enum_var_type type)
+{
+ resize_thr_alarm(max_connections);
+}
+
bool sys_var_long_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
@@ -1504,7 +1513,7 @@ int set_var::check(THD *thd)
{
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
return -1;
- }
+ }
return var->check(thd, this) ? -1 : 0;
}
diff --git a/sql/slave.cc b/sql/slave.cc
index 10d451a88bc..12698c8eda4 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1017,11 +1017,12 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
BINLOG_FORMAT_323_GEQ_57 ;
break;
case '4':
- case '5':
mi->old_format = BINLOG_FORMAT_CURRENT;
break;
default:
- errmsg = "Master reported unrecognized MySQL version";
+ /* 5.0 is not supported */
+ errmsg = "Master reported an unrecognized MySQL version. Note that 4.0 \
+slaves can't replicate a 5.0 or newer master.";
break;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 15631472895..7c663ce831b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -708,6 +708,7 @@ class select_create: public select_insert {
HA_CREATE_INFO *create_info;
MYSQL_LOCK *lock;
Field **field;
+ my_bool do_not_drop;
public:
select_create (const char *db_name, const char *table_name,
HA_CREATE_INFO *create_info_par,
@@ -716,8 +717,7 @@ public:
List<Item> &select_fields,enum_duplicates duplic)
:select_insert (NULL, &select_fields, duplic), db(db_name),
name(table_name), extra_fields(&fields_par),keys(&keys_par),
- create_info(create_info_par),
- lock(0)
+ create_info(create_info_par), lock(0), do_not_drop(0)
{}
int prepare(List<Item> &list);
bool send_data(List<Item> &values);
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index b0d8b18dd17..a19fcdc2d73 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -34,7 +34,7 @@
The second is to be freeed only on thread end. mysql_ha_open should
then do { handler_items=concat(handler_items, free_list); free_list=0; }
- But !!! do_cammand calls free_root at the end of every query and frees up
+ But !!! do_command calls free_root at the end of every query and frees up
all the sql_alloc'ed memory. It's harder to work around...
*/
@@ -73,7 +73,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
if (*ptr)
{
VOID(pthread_mutex_lock(&LOCK_open));
- close_thread_table(thd, ptr);
+ if (close_thread_table(thd, ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ }
VOID(pthread_mutex_unlock(&LOCK_open));
}
else
@@ -90,8 +94,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
{
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
- if (*ptr)
- close_thread_table(thd, ptr);
+ if (*ptr && close_thread_table(thd, ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ }
return 0;
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 0a83358e8c6..ad08ad6ccd6 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1438,6 +1438,15 @@ select_create::prepare(List<Item> &values)
if (!table)
DBUG_RETURN(-1); // abort() deletes table
+ if (table->fields < values.elements)
+ {
+ do_not_drop=1;
+ my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
+ ER(ER_WRONG_VALUE_COUNT_ON_ROW),
+ MYF(0),1);
+ DBUG_RETURN(-1);
+ }
+
/* First field to copy */
field=table->field+table->fields - values.elements;
@@ -1498,7 +1507,7 @@ bool select_create::send_eof()
*/
if (!table->tmp_table)
hash_delete(&open_cache,(byte*) table);
- lock=0;
+ lock=0;
table=0;
VOID(pthread_mutex_unlock(&LOCK_open));
}
@@ -1519,7 +1528,8 @@ void select_create::abort()
enum db_type table_type=table->db_type;
if (!table->tmp_table)
hash_delete(&open_cache,(byte*) table);
- quick_rm_table(table_type,db,name);
+ if (!do_not_drop)
+ quick_rm_table(table_type,db,name);
table=0;
}
VOID(pthread_mutex_unlock(&LOCK_open));
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c913b29cdeb..e068c309e21 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2693,7 +2693,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
/* grant_option is set if there exists a single table or column grant */
if (db_access == want_access ||
((grant_option && !dont_check_global_grants) &&
- !(want_access & ~TABLE_ACLS)))
+ !(want_access & ~(db_access | TABLE_ACLS))))
DBUG_RETURN(FALSE); /* Ok */
if (!no_errors)
net_printf(&thd->net,ER_DBACCESS_DENIED_ERROR,