Commit 74ca91e0 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Merge work:/home/bk/mysql into donna.mysql.fi:/home/my/bk/mysql

parents a40774fb 2ba0846a
This diff is collapsed.
...@@ -340,7 +340,7 @@ int main(int argc,char *argv[]) ...@@ -340,7 +340,7 @@ int main(int argc,char *argv[])
} }
#endif #endif
sprintf(buff, sprintf(buff,
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer\n"); "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n");
put_info(buff,INFO_INFO); put_info(buff,INFO_INFO);
status.exit_status=read_lines(1); // read lines and execute them status.exit_status=read_lines(1); // read lines and execute them
if (opt_outfile) if (opt_outfile)
......
...@@ -28,7 +28,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, ...@@ -28,7 +28,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
uchar *key_buff; uchar *key_buff;
MYISAM_SHARE *share=info->s; MYISAM_SHARE *share=info->s;
uint pack_key_length; uint pack_key_length;
DBUG_ENTER("_mi_rkey"); DBUG_ENTER("mi_rkey");
DBUG_PRINT("enter",("base: %lx inx: %d search_flag: %d", DBUG_PRINT("enter",("base: %lx inx: %d search_flag: %d",
info,inx,search_flag)); info,inx,search_flag));
......
...@@ -158,7 +158,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -158,7 +158,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
info->page_changed=0; info->page_changed=0;
info->buff_used= (info->buff != buff); /* If we have to reread buff */ info->buff_used= (info->buff != buff); /* If we have to reread buff */
DBUG_PRINT("exit",("found key at %ld",info->lastpos)); DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_PRINT("exit",("Error: %d",my_errno));
...@@ -1276,7 +1276,7 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -1276,7 +1276,7 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo,
} }
memcpy(info->lastkey,lastkey,info->lastkey_length); memcpy(info->lastkey,lastkey,info->lastkey_length);
info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length); info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
DBUG_PRINT("exit",("found key at %d",info->lastpos)); DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
DBUG_RETURN(0); DBUG_RETURN(0);
} /* _mi_search_next */ } /* _mi_search_next */
...@@ -1318,7 +1318,7 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -1318,7 +1318,7 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo,
info->page_changed=info->buff_used=0; info->page_changed=info->buff_used=0;
info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length); info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
DBUG_PRINT("exit",("found key at %d",info->lastpos)); DBUG_PRINT("exit",("found key at %ld",(ulong) info->lastpos));
DBUG_RETURN(0); DBUG_RETURN(0);
} /* _mi_search_first */ } /* _mi_search_first */
...@@ -1362,7 +1362,7 @@ int _mi_search_last(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -1362,7 +1362,7 @@ int _mi_search_last(register MI_INFO *info, register MI_KEYDEF *keyinfo,
info->last_search_keypage=info->last_keypage; info->last_search_keypage=info->last_keypage;
info->page_changed=info->buff_used=0; info->page_changed=info->buff_used=0;
DBUG_PRINT("exit",("found key at %d",info->lastpos)); DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
DBUG_RETURN(0); DBUG_RETURN(0);
} /* _mi_search_last */ } /* _mi_search_last */
......
...@@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) ...@@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
isam_info->update&= HA_STATE_CHANGED; isam_info->update&= HA_STATE_CHANGED;
DBUG_RETURN((*isam_info->s->read_rnd) DBUG_RETURN((*isam_info->s->read_rnd)
(isam_info, (byte*) buf, (isam_info, (byte*) buf,
(ha_rows) (filepos - info->current_table->file_offset), (my_off_t) (filepos - info->current_table->file_offset),
0)); 0));
} }
......
...@@ -56,7 +56,7 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars) ...@@ -56,7 +56,7 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars)
CHANGEABLE_VAR *var,*found; CHANGEABLE_VAR *var,*found;
my_string var_end; my_string var_end;
const char *name; const char *name;
long num; longlong num;
/* Skip end space from variable */ /* Skip end space from variable */
for (var_end=end ; end > str && isspace(var_end[-1]) ; var_end--) ; for (var_end=end ; end > str && isspace(var_end[-1]) ; var_end--) ;
...@@ -87,7 +87,7 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars) ...@@ -87,7 +87,7 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
num=(long) atol(end); endchar=strend(end)[-1]; num=atoll(end); endchar=strend(end)[-1];
if (endchar == 'k' || endchar == 'K') if (endchar == 'k' || endchar == 'K')
num*=1024; num*=1024;
else if (endchar == 'm' || endchar == 'M') else if (endchar == 'm' || endchar == 'M')
...@@ -99,14 +99,12 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars) ...@@ -99,14 +99,12 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars)
fprintf(stderr,"Unknown prefix used for variable value '%s'\n",str); fprintf(stderr,"Unknown prefix used for variable value '%s'\n",str);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (num < (long) found->min_value) if (num < (longlong) found->min_value)
num=(long) found->min_value; num=(longlong) found->min_value;
else if ((unsigned long) num > else if (num > (longlong) (ulong) found->max_value)
(unsigned long) found->max_value) num=(longlong) (ulong) found->max_value;
num=(long) found->max_value; num=((num- (longlong) found->sub_size) / (ulonglong) found->block_size);
*found->varptr=(long) ((ulong) (num-found->sub_size) / (*found->varptr)= (long) (num*(ulonglong) found->block_size);
(ulong) found->block_size);
(*found->varptr)*= (ulong) found->block_size;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
......
...@@ -370,7 +370,7 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, ...@@ -370,7 +370,7 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
do do
{ {
pthread_cond_wait(cond,&data->lock->mutex); pthread_cond_wait(cond,&data->lock->mutex);
} while (data->cond == cond && !thread_var->abort); } while (data->cond == cond && (!thread_var->abort || in_wait_list));
if (data->cond || data->type == TL_UNLOCK) if (data->cond || data->type == TL_UNLOCK)
{ {
......
...@@ -2737,7 +2737,7 @@ CHANGEABLE_VAR changeable_vars[] = { ...@@ -2737,7 +2737,7 @@ CHANGEABLE_VAR changeable_vars[] = {
{ "thread_cache_size", (long*) &thread_cache_size, { "thread_cache_size", (long*) &thread_cache_size,
0, 0, 16384, 0, 1 }, 0, 0, 16384, 0, 1 },
{ "tmp_table_size", (long*) &tmp_table_size, { "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, { "thread_stack", (long*) &thread_stack,
DEFAULT_THREAD_STACK, 1024*32, ~0L, 0, 1024 }, DEFAULT_THREAD_STACK, 1024*32, ~0L, 0, 1024 },
{ "wait_timeout", (long*) &net_wait_timeout, { "wait_timeout", (long*) &net_wait_timeout,
......
...@@ -34,8 +34,8 @@ HASH open_cache; /* Used by mysql_test */ ...@@ -34,8 +34,8 @@ HASH open_cache; /* Used by mysql_test */
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db, static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
const char *name, const char *alias, bool locked); const char *name, const char *alias, bool locked);
static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name, static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
List_iterator<Item> *it); const char *table_name, List_iterator<Item> *it);
static void free_cache_entry(TABLE *entry); static void free_cache_entry(TABLE *entry);
static void mysql_rm_tmp_tables(void); static void mysql_rm_tmp_tables(void);
static key_map get_key_map_from_key_list(TABLE *table, 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, ...@@ -1754,7 +1754,8 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (item->type() == Item::FIELD_ITEM && if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name[0] == '*') ((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 */ DBUG_RETURN(-1); /* purecov: inspected */
} }
else else
...@@ -1838,8 +1839,8 @@ static key_map get_key_map_from_key_list(TABLE *table, ...@@ -1838,8 +1839,8 @@ static key_map get_key_map_from_key_list(TABLE *table,
****************************************************************************/ ****************************************************************************/
static bool static bool
insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name, insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
List_iterator<Item> *it) const char *table_name, List_iterator<Item> *it)
{ {
uint found; uint found;
DBUG_ENTER("insert_fields"); DBUG_ENTER("insert_fields");
...@@ -1851,7 +1852,9 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name, ...@@ -1851,7 +1852,9 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
if (grant_option && !thd->master_access && if (grant_option && !thd->master_access &&
check_grant_all_columns(thd,SELECT_ACL,table) ) check_grant_all_columns(thd,SELECT_ACL,table) )
DBUG_RETURN(-1); 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; Field **ptr=table->field,*field;
thd->used_tables|=table->map; thd->used_tables|=table->map;
......
...@@ -1088,6 +1088,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1088,6 +1088,7 @@ bool delayed_insert::handle_inserts(void)
int error; int error;
uint max_rows; uint max_rows;
bool using_ignore=0; bool using_ignore=0;
delayed_row *row;
DBUG_ENTER("handle_inserts"); DBUG_ENTER("handle_inserts");
/* Allow client to insert new rows */ /* Allow client to insert new rows */
...@@ -1113,7 +1114,6 @@ bool delayed_insert::handle_inserts(void) ...@@ -1113,7 +1114,6 @@ bool delayed_insert::handle_inserts(void)
table->file->extra(HA_EXTRA_WRITE_CACHE); table->file->extra(HA_EXTRA_WRITE_CACHE);
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
delayed_row *row;
while ((row=rows.get())) while ((row=rows.get()))
{ {
stacked_inserts--; stacked_inserts--;
...@@ -1138,9 +1138,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1138,9 +1138,7 @@ bool delayed_insert::handle_inserts(void)
if (write_record(table,&info)) if (write_record(table,&info))
{ {
info.error++; // Ignore errors info.error++; // Ignore errors
pthread_mutex_lock(&LOCK_delayed_status); thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
delayed_insert_errors++;
pthread_mutex_unlock(&LOCK_delayed_status);
row->log_query = 0; row->log_query = 0;
} }
if (using_ignore) if (using_ignore)
...@@ -1209,6 +1207,13 @@ bool delayed_insert::handle_inserts(void) ...@@ -1209,6 +1207,13 @@ bool delayed_insert::handle_inserts(void)
DBUG_RETURN(0); DBUG_RETURN(0);
err: 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); thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -3554,9 +3554,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -3554,9 +3554,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->recinfo=recinfo; param->recinfo=recinfo;
store_record(table,2); // Make empty default record store_record(table,2); // Make empty default record
if (tmp_table_size == ~(ulong) 0) // No limit
table->max_rows= ~(ha_rows) 0;
else
table->max_rows=(((table->db_type == DB_TYPE_HEAP) ? table->max_rows=(((table->db_type == DB_TYPE_HEAP) ?
min(tmp_table_size, max_heap_table_size) : tmp_table_size)/ min(tmp_table_size, max_heap_table_size) :
table->reclength); tmp_table_size)/ table->reclength);
set_if_bigger(table->max_rows,1); // For dummy start options set_if_bigger(table->max_rows,1); // For dummy start options
keyinfo=param->keyinfo; keyinfo=param->keyinfo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment