Commit a06f391e authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fixed multi-table-delete

Optimize fixed length MyISAM rows to use pread/pwrite.
parent 595d087e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"

extra_configs="$extra_configs --with-berkeley-db --with-innodb"
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-embedded-server"

. "$path/FINISH.sh"
+5 −0
Original line number Diff line number Diff line
@@ -233,4 +233,9 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
{
}

my_bool vio_poll_read(Vio *vio,uint timeout)
{
  return 0;
}

#endif /* HAVE_VIO */
+24 −24
Original line number Diff line number Diff line
@@ -27,16 +27,15 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
  {
    my_off_t filepos=info->s->state.dellink;
    info->rec_cache.seek_not_done=1;		/* We have done a seek */
    VOID(my_seek(info->dfile,info->s->state.dellink+1,MY_SEEK_SET,MYF(0)));

    if (my_read(info->dfile,(char*) &temp[0],info->s->base.rec_reflength,
    if (my_pread(info->dfile,(char*) &temp[0],info->s->base.rec_reflength,
		info->s->state.dellink+1,
		 MYF(MY_NABP)))
      goto err;
    info->s->state.dellink= _mi_rec_pos(info->s,temp);
    info->state->del--;
    info->state->empty-=info->s->base.pack_reclength;
    VOID(my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0)));
    if (my_write(info->dfile, (char*) record, info->s->base.reclength,
    if (my_pwrite(info->dfile, (char*) record, info->s->base.reclength,
		  filepos,
		  MYF(MY_NABP)))
      goto err;
  }
@@ -64,16 +63,18 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
    else
    {
      info->rec_cache.seek_not_done=1;		/* We have done a seek */
      VOID(my_seek(info->dfile,info->state->data_file_length,
		   MY_SEEK_SET,MYF(0)));
      if (my_write(info->dfile,(char*) record,info->s->base.reclength,
      if (my_pwrite(info->dfile,(char*) record,info->s->base.reclength,
		    info->state->data_file_length,
		    info->s->write_flag))
	goto err;
      if (info->s->base.pack_reclength != info->s->base.reclength)
      {
	uint length=info->s->base.pack_reclength - info->s->base.reclength;
	bzero((char*) temp,length);
	if (my_write(info->dfile, (byte*) temp,length, info->s->write_flag))
	if (my_pwrite(info->dfile, (byte*) temp,length,
		      info->state->data_file_length+
		      info->s->base.pack_reclength,
		      info->s->write_flag))
	  goto err;
      }
    }
@@ -88,8 +89,9 @@ int _mi_write_static_record(MI_INFO *info, const byte *record)
int _mi_update_static_record(MI_INFO *info, my_off_t pos, const byte *record)
{
  info->rec_cache.seek_not_done=1;		/* We have done a seek */
  VOID(my_seek(info->dfile,pos,MY_SEEK_SET,MYF(0)));
  return (my_write(info->dfile,(char*) record,info->s->base.reclength,
  return (my_pwrite(info->dfile,
		    (char*) record,info->s->base.reclength,
		    pos,
		    MYF(MY_NABP)) != 0);
}

@@ -104,9 +106,8 @@ int _mi_delete_static_record(MI_INFO *info)
  _mi_dpointer(info,temp+1,info->s->state.dellink);
  info->s->state.dellink = info->lastpos;
  info->rec_cache.seek_not_done=1;
  VOID(my_seek(info->dfile,info->lastpos,MY_SEEK_SET,MYF(0)));
  return (my_write(info->dfile,(byte*) temp, 1+info->s->rec_reflength,
		   MYF(MY_NABP)) != 0);
  return (my_pwrite(info->dfile,(byte*) temp, 1+info->s->rec_reflength,
		    info->lastpos, MYF(MY_NABP)) != 0);
}


@@ -129,8 +130,8 @@ int _mi_cmp_static_record(register MI_INFO *info, register const byte *old)
  if ((info->opt_flag & READ_CHECK_USED))
  {						/* If check isn't disabled  */
    info->rec_cache.seek_not_done=1;		/* We have done a seek */
    VOID(my_seek(info->dfile,info->lastpos,MY_SEEK_SET,MYF(0)));
    if (my_read(info->dfile, (char*) info->rec_buff, info->s->base.reclength,
    if (my_pread(info->dfile, (char*) info->rec_buff, info->s->base.reclength,
		 info->lastpos,
		 MYF(MY_NABP)))
      DBUG_RETURN(-1);
    if (memcmp((byte*) info->rec_buff, (byte*) old,
@@ -152,9 +153,8 @@ int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,
  DBUG_ENTER("_mi_cmp_static_unique");

  info->rec_cache.seek_not_done=1;		/* We have done a seek */
  VOID(my_seek(info->dfile,pos,MY_SEEK_SET,MYF(0)));
  if (my_read(info->dfile, (char*) info->rec_buff, info->s->base.reclength,
	      MYF(MY_NABP)))
  if (my_pread(info->dfile, (char*) info->rec_buff, info->s->base.reclength,
	       pos, MYF(MY_NABP)))
    DBUG_RETURN(-1);
  DBUG_RETURN(mi_unique_comp(def, record, info->rec_buff,
			     def->null_are_equal));
+0 −10
Original line number Diff line number Diff line
id1	t
1	3
2	2
3	1
id2	t
3	3
3	2
3	1
2	3
2	2
2	1
1	3
1	2
1	1
id3	t
3	3
3	2
3	1
2	3
2	2
2	1
+5 −4
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@ while ($1)
  dec $1;
 }

delete t1.*,t2.* from t1,t2 where t1.id1 = t2.id2 and t1.id1 = 3;
delete t3 from t3 left join t1 on (id1=id3) where t1.id1 is null;
delete t2 from t1,t2,t3 where id1=id2 and id2=id3 and id1=2;
select * from t1;
select * from t2;
select * from t3;

delete from t1,t2 where t1.id = t2.id and t1.id = 3;
select * from t1;
select * from t2;
delete t1,t2 from t1,t2 where 1;
drop table t1,t2,t3;
Loading