Commit 777df004 authored by unknown's avatar unknown

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


Docs/manual.texi:
  Auto merged
parents 6ee4a0d2 77b02100
...@@ -46862,6 +46862,9 @@ not yet 100% confident in this code. ...@@ -46862,6 +46862,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.43 @appendixsubsec Changes in release 3.23.43
@itemize @bullet @itemize @bullet
@item @item
Fixed a bug in @code{INSERT DELAYED} and @code{FLUSH TABLES} introduced
in 3.23.42.
@item
Fixed unlikely bug, which returned not matching rows, in SELECT with Fixed unlikely bug, which returned not matching rows, in SELECT with
many tables and multi-column indexes and 'range' type. many tables and multi-column indexes and 'range' type.
@item @item
...@@ -937,7 +937,7 @@ static bool add_line(String &buffer,char *line,char *in_string) ...@@ -937,7 +937,7 @@ static bool add_line(String &buffer,char *line,char *in_string)
{ // mSQL or postgreSQL style command ? { // mSQL or postgreSQL style command ?
if (!(inchar = (uchar) *++pos)) if (!(inchar = (uchar) *++pos))
break; // readline adds one '\' break; // readline adds one '\'
if (*in_string || inchar == 'N') if (*in_string || inchar == 'N') // \N is short for NULL
{ // Don't allow commands in string { // Don't allow commands in string
*out++='\\'; *out++='\\';
*out++= (char) inchar; *out++= (char) inchar;
......
...@@ -1194,8 +1194,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1194,8 +1194,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
param->glob_crc=0; param->glob_crc=0;
if (param->testflag & T_CALC_CHECKSUM) if (param->testflag & T_CALC_CHECKSUM)
param->calc_checksum=1; param->calc_checksum=1;
if (!rep_quick)
share->state.checksum=0;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
for (i=0 ; i < info->s->base.keys ; i++) for (i=0 ; i < info->s->base.keys ; i++)
...@@ -1290,9 +1288,9 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1290,9 +1288,9 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
else else
{ {
info->state->data_file_length=sort_info->max_pos; info->state->data_file_length=sort_info->max_pos;
if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc;
} }
if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc;
if (!(param->testflag & T_SILENT)) if (!(param->testflag & T_SILENT))
{ {
...@@ -1878,8 +1876,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -1878,8 +1876,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
param->glob_crc=0; param->glob_crc=0;
if (param->testflag & T_CALC_CHECKSUM) if (param->testflag & T_CALC_CHECKSUM)
param->calc_checksum=1; param->calc_checksum=1;
if (! rep_quick)
share->state.checksum=0;
rec_per_key_part= param->rec_per_key_part; rec_per_key_part= param->rec_per_key_part;
for (sort_info->key=0 ; sort_info->key < share->base.keys ; for (sort_info->key=0 ; sort_info->key < share->base.keys ;
...@@ -1999,7 +1995,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -1999,7 +1995,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
"Can't change size of datafile, error: %d", "Can't change size of datafile, error: %d",
my_errno); my_errno);
} }
else if (param->testflag & T_CALC_CHECKSUM) if (param->testflag & T_CALC_CHECKSUM)
share->state.checksum=param->glob_crc; share->state.checksum=param->glob_crc;
if (my_chsize(share->kfile,info->state->key_file_length,MYF(0))) if (my_chsize(share->kfile,info->state->key_file_length,MYF(0)))
...@@ -2478,7 +2474,7 @@ int sort_write_record(SORT_INFO *sort_info) ...@@ -2478,7 +2474,7 @@ int sort_write_record(SORT_INFO *sort_info)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
sort_info->filepos+=share->base.pack_reclength; sort_info->filepos+=share->base.pack_reclength;
info->s->state.checksum+=mi_static_checksum(info, sort_info->record); /* sort_info->param->glob_crc+=mi_static_checksum(info, sort_info->record); */
break; break;
case DYNAMIC_RECORD: case DYNAMIC_RECORD:
if (! info->blobs) if (! info->blobs)
...@@ -2502,7 +2498,7 @@ int sort_write_record(SORT_INFO *sort_info) ...@@ -2502,7 +2498,7 @@ int sort_write_record(SORT_INFO *sort_info)
} }
info->checksum=mi_checksum(info,sort_info->record); info->checksum=mi_checksum(info,sort_info->record);
reclength=_mi_rec_pack(info,from,sort_info->record); reclength=_mi_rec_pack(info,from,sort_info->record);
info->s->state.checksum+=info->checksum; /* sort_info->param->glob_crc+=info->checksum; */
block_length=reclength+ 3 + test(reclength >= (65520-3)); block_length=reclength+ 3 + test(reclength >= (65520-3));
if (block_length < share->base.min_block_length) if (block_length < share->base.min_block_length)
block_length=share->base.min_block_length; block_length=share->base.min_block_length;
...@@ -2516,7 +2512,7 @@ int sort_write_record(SORT_INFO *sort_info) ...@@ -2516,7 +2512,7 @@ int sort_write_record(SORT_INFO *sort_info)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
sort_info->filepos+=block_length; sort_info->filepos+=block_length;
info->s->state.checksum+=info->checksum; /* sort_info->param->glob_crc+=info->checksum; */
break; break;
case COMPRESSED_RECORD: case COMPRESSED_RECORD:
reclength=info->packed_length; reclength=info->packed_length;
...@@ -2529,7 +2525,7 @@ int sort_write_record(SORT_INFO *sort_info) ...@@ -2529,7 +2525,7 @@ int sort_write_record(SORT_INFO *sort_info)
mi_check_print_error(param,"%d when writing to datafile",my_errno); mi_check_print_error(param,"%d when writing to datafile",my_errno);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
info->s->state.checksum+=info->checksum; /* sort_info->param->glob_crc+=info->checksum; */
sort_info->filepos+=reclength+length; sort_info->filepos+=reclength+length;
break; break;
} }
...@@ -2746,9 +2742,9 @@ static int sort_delete_record(MI_CHECK *param) ...@@ -2746,9 +2742,9 @@ static int sort_delete_record(MI_CHECK *param)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
if (info->s->calc_checksum) if (param->calc_checksum)
info->s->state.checksum-=(*info->s->calc_checksum)(info, param->glob_crc-=(*info->s->calc_checksum)(info,
sort_info->record); sort_info->record);
} }
error=flush_io_cache(&info->rec_cache) || (*info->s->delete_record)(info); error=flush_io_cache(&info->rec_cache) || (*info->s->delete_record)(info);
info->dfile=old_file; /* restore actual value */ info->dfile=old_file; /* restore actual value */
......
...@@ -841,6 +841,7 @@ void kill_delayed_threads(void) ...@@ -841,6 +841,7 @@ void kill_delayed_threads(void)
delayed_insert *tmp; delayed_insert *tmp;
while ((tmp=it++)) while ((tmp=it++))
{ {
/* Ensure that the thread doesn't kill itself while we are looking at it */
pthread_mutex_lock(&tmp->mutex); pthread_mutex_lock(&tmp->mutex);
tmp->thd.killed=1; tmp->thd.killed=1;
if (tmp->thd.mysys_var) if (tmp->thd.mysys_var)
...@@ -848,9 +849,15 @@ void kill_delayed_threads(void) ...@@ -848,9 +849,15 @@ void kill_delayed_threads(void)
pthread_mutex_lock(&tmp->thd.mysys_var->mutex); pthread_mutex_lock(&tmp->thd.mysys_var->mutex);
if (tmp->thd.mysys_var->current_cond) if (tmp->thd.mysys_var->current_cond)
{ {
pthread_mutex_lock(tmp->thd.mysys_var->current_mutex); /*
We need the following test because the main mutex may be locked
in handle_delayed_insert()
*/
if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
pthread_cond_broadcast(tmp->thd.mysys_var->current_cond); pthread_cond_broadcast(tmp->thd.mysys_var->current_cond);
pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex); if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex);
} }
pthread_mutex_unlock(&tmp->thd.mysys_var->mutex); pthread_mutex_unlock(&tmp->thd.mysys_var->mutex);
} }
......
...@@ -390,7 +390,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -390,7 +390,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE) if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
ptr=strmov(ptr," delay_key_write=1"); ptr=strmov(ptr," delay_key_write=1");
if (table->row_type != ROW_TYPE_DEFAULT) if (table->row_type != ROW_TYPE_DEFAULT)
ptr=strxmov(ptr, " format=", ha_row_type[(uint) table->row_type], ptr=strxmov(ptr, " row_format=", ha_row_type[(uint) table->row_type],
NullS); NullS);
if (file->raid_type) if (file->raid_type)
{ {
...@@ -910,6 +910,12 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -910,6 +910,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
p = longlong10_to_str(table->max_rows, buff, 10); p = longlong10_to_str(table->max_rows, buff, 10);
packet->append(buff, (uint) (p - buff)); packet->append(buff, (uint) (p - buff));
} }
if (table->avg_row_length)
{
packet->append(" AVG_ROW_LENGTH=");
p=longlong10_to_str(table->avg_row_length, buff,10);
packet->append(buff, (uint) (p - buff));
}
if (table->db_create_options & HA_OPTION_PACK_KEYS) if (table->db_create_options & HA_OPTION_PACK_KEYS)
packet->append(" PACK_KEYS=1", 12); packet->append(" PACK_KEYS=1", 12);
...@@ -919,6 +925,11 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -919,6 +925,11 @@ store_create_info(THD *thd, TABLE *table, String *packet)
packet->append(" CHECKSUM=1", 11); packet->append(" CHECKSUM=1", 11);
if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE) if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
packet->append(" DELAY_KEY_WRITE=1",18); packet->append(" DELAY_KEY_WRITE=1",18);
if (table->row_type != ROW_TYPE_DEFAULT)
{
packet->append(" ROW_FORMAT=",12);
packet->append(ha_row_type[(uint) table->row_type]);
}
table->file->append_create_info(packet); table->file->append_create_info(packet);
if (table->comment && table->comment[0]) if (table->comment && table->comment[0])
{ {
......
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