summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@donna.mysql.fi <>2001-05-17 00:47:21 +0300
committermonty@donna.mysql.fi <>2001-05-17 00:47:21 +0300
commit74ca91e08fafb8c3f24986d12bb1c85cbb930ac5 (patch)
tree1441bc29eedff96659ef2faf0ad98c72717c734d /sql
parenta40774fb854fe906001bdd469fc7122d53023475 (diff)
parent2ba0846a60ac43e1ef477bdfd95c37901b6c7fe7 (diff)
downloadmariadb-git-74ca91e08fafb8c3f24986d12bb1c85cbb930ac5.tar.gz
Merge work:/home/bk/mysql into donna.mysql.fi:/home/my/bk/mysql
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_base.cc15
-rw-r--r--sql/sql_insert.cc13
-rw-r--r--sql/sql_select.cc9
4 files changed, 26 insertions, 15 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c9e19b65a6c..7a0fb4ccddc 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2701,7 +2701,7 @@ CHANGEABLE_VAR changeable_vars[] = {
1024, 4, 8192*1024L, 0, 1 },
{ "max_tmp_tables", (long*) &max_tmp_tables,
32, 1, ~0L, 0, 1 },
- { "max_user_connections", (long*) &max_user_connections,
+ { "max_user_connections", (long*) &max_user_connections,
0, 1, ~0L, 0, 1 },
{ "max_write_lock_count", (long*) &max_write_lock_count,
~0L, 1, ~0L, 0, 1 },
@@ -2737,7 +2737,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{ "thread_cache_size", (long*) &thread_cache_size,
0, 0, 16384, 0, 1 },
{ "tmp_table_size", (long*) &tmp_table_size,
- 1024*1024L, 1024, ~0L, MALLOC_OVERHEAD, 1 },
+ 32*1024*1024L, 1024, ~0L, 0, 1 },
{ "thread_stack", (long*) &thread_stack,
DEFAULT_THREAD_STACK, 1024*32, ~0L, 0, 1024 },
{ "wait_timeout", (long*) &net_wait_timeout,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3c81723b61f..e7d63e1e5e4 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -34,8 +34,8 @@ HASH open_cache; /* Used by mysql_test */
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
const char *name, const char *alias, bool locked);
-static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
- List_iterator<Item> *it);
+static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
+ const char *table_name, List_iterator<Item> *it);
static void free_cache_entry(TABLE *entry);
static void mysql_rm_tmp_tables(void);
static key_map get_key_map_from_key_list(TABLE *table,
@@ -1754,7 +1754,8 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name[0] == '*')
{
- if (insert_fields(thd,tables,((Item_field*) item)->table_name,&it))
+ if (insert_fields(thd,tables,((Item_field*) item)->db_name,
+ ((Item_field*) item)->table_name,&it))
DBUG_RETURN(-1); /* purecov: inspected */
}
else
@@ -1838,8 +1839,8 @@ static key_map get_key_map_from_key_list(TABLE *table,
****************************************************************************/
static bool
-insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
- List_iterator<Item> *it)
+insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
+ const char *table_name, List_iterator<Item> *it)
{
uint found;
DBUG_ENTER("insert_fields");
@@ -1851,7 +1852,9 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
if (grant_option && !thd->master_access &&
check_grant_all_columns(thd,SELECT_ACL,table) )
DBUG_RETURN(-1);
- if (!table_name || !strcmp(table_name,tables->name))
+ if (!table_name || (!strcmp(table_name,tables->name) &&
+ (!db_name || !tables->db ||
+ !strcmp(tables->db,db_name))))
{
Field **ptr=table->field,*field;
thd->used_tables|=table->map;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3be195b8984..cfd16df5d17 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1088,6 +1088,7 @@ bool delayed_insert::handle_inserts(void)
int error;
uint max_rows;
bool using_ignore=0;
+ delayed_row *row;
DBUG_ENTER("handle_inserts");
/* Allow client to insert new rows */
@@ -1113,7 +1114,6 @@ bool delayed_insert::handle_inserts(void)
table->file->extra(HA_EXTRA_WRITE_CACHE);
pthread_mutex_lock(&mutex);
- delayed_row *row;
while ((row=rows.get()))
{
stacked_inserts--;
@@ -1138,9 +1138,7 @@ bool delayed_insert::handle_inserts(void)
if (write_record(table,&info))
{
info.error++; // Ignore errors
- pthread_mutex_lock(&LOCK_delayed_status);
- delayed_insert_errors++;
- pthread_mutex_unlock(&LOCK_delayed_status);
+ thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
row->log_query = 0;
}
if (using_ignore)
@@ -1209,6 +1207,13 @@ bool delayed_insert::handle_inserts(void)
DBUG_RETURN(0);
err:
+ /* Remove all not used rows */
+ while ((row=rows.get()))
+ {
+ delete row;
+ thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
+ stacked_inserts--;
+ }
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
pthread_mutex_lock(&mutex);
DBUG_RETURN(1);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c2b5662d436..f464c237d78 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3554,9 +3554,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->recinfo=recinfo;
store_record(table,2); // Make empty default record
- table->max_rows=(((table->db_type == DB_TYPE_HEAP) ?
- min(tmp_table_size, max_heap_table_size) : tmp_table_size)/
- table->reclength);
+ if (tmp_table_size == ~(ulong) 0) // No limit
+ table->max_rows= ~(ha_rows) 0;
+ else
+ table->max_rows=(((table->db_type == DB_TYPE_HEAP) ?
+ min(tmp_table_size, max_heap_table_size) :
+ tmp_table_size)/ table->reclength);
set_if_bigger(table->max_rows,1); // For dummy start options
keyinfo=param->keyinfo;