Commit 5e03ebbc authored by monty@mysql.com's avatar monty@mysql.com

After merge fixes

Cleanup of mi_print_error() handling
Deleted 'merge' directory
parent 34d5331c
...@@ -107,12 +107,13 @@ typedef struct st_mi_create_info ...@@ -107,12 +107,13 @@ typedef struct st_mi_create_info
} MI_CREATE_INFO; } MI_CREATE_INFO;
struct st_myisam_info; /* For referense */ struct st_myisam_info; /* For referense */
struct st_mi_isam_share;
typedef struct st_myisam_info MI_INFO; typedef struct st_myisam_info MI_INFO;
struct st_mi_s_param; struct st_mi_s_param;
typedef struct st_mi_keydef /* Key definition with open & info */ typedef struct st_mi_keydef /* Key definition with open & info */
{ {
struct st_mi_isam_share *share; /* Pointer to base (set in mi_open) */
uint16 keysegs; /* Number of key-segment */ uint16 keysegs; /* Number of key-segment */
uint16 flag; /* NOSAME, PACK_USED */ uint16 flag; /* NOSAME, PACK_USED */
......
.deps
Makefile
Makefile.in
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
pkglib_LIBRARIES = libmerge.a
noinst_HEADERS = mrg_def.h
libmerge_a_SOURCES = mrg_open.c mrg_extra.c mrg_info.c mrg_locking.c \
mrg_rrnd.c mrg_update.c mrg_delete.c mrg_rsame.c \
mrg_panic.c mrg_close.c mrg_create.c mrg_static.c
# Don't update the files from bitkeeper
%::SCCS/s.%
ccc -I./../include -I../include -DDBUG_OFF -fast -O3 -c _locking.c close.c create.c delete.c extra.c info.c open.c panic.c rrnd.c rsame.c static.c update.c
rm libmerge.a
ar -cr libmerge.a _locking.o
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* close a isam-database */
#include "mrg_def.h"
int mrg_close(register MRG_INFO *info)
{
int error=0,new_error;
MRG_TABLE *file;
DBUG_ENTER("mrg_close");
for (file=info->open_tables ; file != info->end_table ; file++)
if ((new_error=nisam_close(file->table)))
error=new_error;
pthread_mutex_lock(&THR_LOCK_open);
mrg_open_list=list_delete(mrg_open_list,&info->open_list);
pthread_mutex_unlock(&THR_LOCK_open);
my_free((gptr) info,MYF(0));
if (error)
{
my_errno=error;
DBUG_RETURN(-1);
}
DBUG_RETURN(0);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Create a MERGE-file */
#include "mrg_def.h"
/* create file named 'name' and save filenames in it
table_names should be NULL or a vector of string-pointers with
a NULL-pointer last
*/
int mrg_create(const char *name, const char**table_names)
{
int save_errno;
uint errpos;
File file;
char buff[FN_REFLEN],*end;
DBUG_ENTER("mrg_create");
errpos=0;
if ((file = my_create(fn_format(buff,name,"",MRG_NAME_EXT,4),0,
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
goto err;
errpos=1;
if (table_names)
for ( ; *table_names ; table_names++)
{
strmov(buff,*table_names);
fn_same(buff,name,4);
*(end=strend(buff))='\n';
if (my_write(file,*table_names,(uint) (end-buff+1),
MYF(MY_WME | MY_NABP)))
goto err;
}
if (my_close(file,MYF(0)))
goto err;
DBUG_RETURN(0);
err:
save_errno=my_errno;
switch (errpos) {
case 1:
VOID(my_close(file,MYF(0)));
}
my_errno=save_errno; /* Return right errocode */
DBUG_RETURN(-1);
} /* mrg_create */
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Denna fil includeras i alla merge-filer */
#ifndef N_MAXKEY
#include "../isam/isamdef.h"
#endif
#include "merge.h"
extern LIST *mrg_open_list;
#ifdef THREAD
extern pthread_mutex_t THR_LOCK_open;
#endif
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Delete last read record */
#include "mrg_def.h"
int mrg_delete(MRG_INFO *info,const byte *record)
{
if (!info->current_table)
{
my_errno=HA_ERR_NO_ACTIVE_RECORD;
return(-1);
}
return nisam_delete(info->current_table->table,record);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Extra functions we want to do with a database
- All flags, exept record-cache-flags, are set in all used databases
record-cache-flags are set in mrg_rrnd when we are changing database.
*/
#include "mrg_def.h"
int mrg_extra(
MRG_INFO *info,
enum ha_extra_function function)
{
MRG_TABLE *file;
if (function == HA_EXTRA_CACHE)
info->cache_in_use=1;
else
{
if (function == HA_EXTRA_NO_CACHE || function == HA_EXTRA_RESET)
info->cache_in_use=0;
if (function == HA_EXTRA_RESET || function == HA_EXTRA_RESET_STATE)
{
info->current_table=0;
info->last_used_table=info->open_tables;
}
for (file=info->open_tables ; file != info->end_table ; file++)
nisam_extra(file->table,function);
}
return 0;
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mrg_def.h"
ulong mrg_position(MRG_INFO *info)
{
MRG_TABLE *current_table;
if (!(current_table = info->current_table) &&
info->open_tables != info->end_table)
current_table = info->open_tables;
return (current_table ?
(ulong) (current_table->table->lastpos +
current_table->file_offset) :
~(ulong) 0);
}
/* If flag != 0 one only gets pos of last record */
int mrg_info(MRG_INFO *info,register MERGE_INFO *x,int flag)
{
MRG_TABLE *current_table;
DBUG_ENTER("mrg_info");
if (!(current_table = info->current_table) &&
info->open_tables != info->end_table)
current_table = info->open_tables;
x->recpos = info->current_table ?
info->current_table->table->lastpos + info->current_table->file_offset :
(ulong) -1L;
if (flag != HA_STATUS_POS)
{
x->records = info->records;
x->deleted = info->del;
x->data_file_length = info->data_file_length;
x->reclength = info->reclength;
if (current_table)
x->errkey = current_table->table->errkey;
else
{ /* No tables in MRG */
x->errkey=0;
}
x->options = info->options;
}
DBUG_RETURN(0);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Lock databases against read or write.
*/
#include "mrg_def.h"
int mrg_lock_database(MRG_INFO *info,int lock_type)
{
int error,new_error;
MRG_TABLE *file;
error=0;
for (file=info->open_tables ; file != info->end_table ; file++)
if ((new_error=nisam_lock_database(file->table,lock_type)))
error=new_error;
return(error);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* open a MERGE-database */
#include "mrg_def.h"
#include <stddef.h>
#include <errno.h>
#ifdef VMS
#include "static.c"
#endif
/* open a MERGE-database.
if handle_locking is 0 then exit with error if some database is locked
if handle_locking is 1 then wait if database is locked
*/
MRG_INFO *mrg_open(
const char *name,
int mode,
int handle_locking)
{
int save_errno,i,errpos;
uint files,dir_length,length, options;
ulonglong file_offset;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MRG_INFO info,*m_info;
File fd;
IO_CACHE file;
N_INFO *isam,*last_isam;
DBUG_ENTER("mrg_open");
LINT_INIT(last_isam);
isam=0;
errpos=files=0;
bzero((gptr) &info,sizeof(info));
bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME | MY_NABP)))
goto err;
errpos=1;
dir_length=dirname_part(name_buff,name);
info.reclength=0;
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
if ((end=buff+length)[-1] == '\n')
end[-1]='\0';
if (buff[0] && buff[0] != '#') /* Skip empty lines and comments */
{
last_isam=isam;
if (!test_if_hard_path(buff))
{
VOID(strmake(name_buff+dir_length,buff,
sizeof(name_buff)-1-dir_length));
VOID(cleanup_dirname(buff,name_buff));
}
if (!(isam=nisam_open(buff,mode,test(handle_locking))))
goto err;
files++;
}
last_isam=isam;
if (info.reclength && info.reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_IN_RECORD;
goto err;
}
info.reclength=isam->s->base.reclength;
}
if (!(m_info= (MRG_INFO*) my_malloc(sizeof(MRG_INFO)+files*sizeof(MRG_TABLE),
MYF(MY_WME))))
goto err;
*m_info=info;
m_info->open_tables=(MRG_TABLE *) (m_info+1);
m_info->tables=files;
options= (uint) ~0;
for (i=files ; i-- > 0 ; )
{
m_info->open_tables[i].table=isam;
m_info->options|=isam->s->base.options;
options&=isam->s->base.options;
m_info->records+=isam->s->state.records;
m_info->del+=isam->s->state.del;
m_info->data_file_length=isam->s->state.data_file_length;
if (i)
isam=(N_INFO*) (isam->open_list.next->data);
}
/* Don't force readonly if not all tables are readonly */
if (! (options & (HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA)))
m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
/* Fix fileinfo for easyer debugging (actually set by rrnd) */
file_offset=0;
for (i=0 ; (uint) i < files ; i++)
{
m_info->open_tables[i].file_offset=(my_off_t) file_offset;
file_offset+=m_info->open_tables[i].table->s->state.data_file_length;
}
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{
my_errno=HA_ERR_RECORD_FILE_FULL;
my_free((char*) m_info,MYF(0));
goto err;
}
m_info->end_table=m_info->open_tables+files;
m_info->last_used_table=m_info->open_tables;
VOID(my_close(fd,MYF(0)));
end_io_cache(&file);
m_info->open_list.data=(void*) m_info;
pthread_mutex_lock(&THR_LOCK_open);
mrg_open_list=list_add(mrg_open_list,&m_info->open_list);
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(m_info);
err:
save_errno=my_errno;
switch (errpos) {
case 1:
VOID(my_close(fd,MYF(0)));
end_io_cache(&file);
for (i=files ; i-- > 0 ; )
{
isam=last_isam;
if (i)
last_isam=(N_INFO*) (isam->open_list.next->data);
nisam_close(isam);
}
}
my_errno=save_errno;
DBUG_RETURN (NULL);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mrg_def.h"
/* if flag == HA_PANIC_CLOSE then all misam files are closed */
/* if flag == HA_PANIC_WRITE then all misam files are unlocked and
all changed data in single user misam is written to file */
/* if flag == HA_PANIC_READ then all misam files that was locked when
nisam_panic(HA_PANIC_WRITE) was done is locked. A ni_readinfo() is
done for all single user files to get changes in database */
int mrg_panic(
enum ha_panic_function flag)
{
int error=0;
LIST *list_element,*next_open;
MRG_INFO *info;
DBUG_ENTER("mrg_panic");
for (list_element=mrg_open_list ; list_element ; list_element=next_open)
{
next_open=list_element->next; /* Save if close */
info=(MRG_INFO*) list_element->data;
if (flag == HA_PANIC_CLOSE && mrg_close(info))
error=my_errno;
}
if (mrg_open_list && flag != HA_PANIC_CLOSE)
DBUG_RETURN(nisam_panic(flag));
if (!error) DBUG_RETURN(0);
my_errno=error;
DBUG_RETURN(-1);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Read a record with random-access. The position to the record must
get by mrg_info(). The next record can be read with pos= -1 */
#include "mrg_def.h"
static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos);
/*
If filepos == -1, read next
Returns same as nisam_rrnd:
0 = Ok.
1 = Record deleted.
-1 = EOF (or something, errno should be HA_ERR_END_OF_FILE)
*/
int mrg_rrnd(MRG_INFO *info,byte *buf,mrg_off_t filepos)
{
int error;
N_INFO *isam_info;
if (filepos == ~(mrg_off_t) 0) /* Can't use HA_POS_ERROR */
{
if (!info->current_table)
{
if (info->open_tables == info->end_table)
{ /* No tables */
my_errno=HA_ERR_END_OF_FILE;
return -1;
}
isam_info=(info->current_table=info->open_tables)->table;
if (info->cache_in_use)
nisam_extra(isam_info,HA_EXTRA_CACHE);
filepos=isam_info->s->pack.header_length;
isam_info->lastinx= (uint) -1; /* Can't forward or backward */
}
else
{
isam_info=info->current_table->table;
filepos= isam_info->nextpos;
}
for (;;)
{
isam_info->update&= HA_STATE_CHANGED;
if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
filepos,1)) >= 0 ||
my_errno != HA_ERR_END_OF_FILE)
return (error);
if (info->cache_in_use)
nisam_extra(info->current_table->table,HA_EXTRA_NO_CACHE);
if (info->current_table+1 == info->end_table)
return(-1);
info->current_table++;
info->last_used_table=info->current_table;
if (info->cache_in_use)
nisam_extra(info->current_table->table,HA_EXTRA_CACHE);
info->current_table->file_offset=
info->current_table[-1].file_offset+
info->current_table[-1].table->s->state.data_file_length;
isam_info=info->current_table->table;
filepos=isam_info->s->pack.header_length;
isam_info->lastinx= (uint) -1;
}
}
info->current_table=find_table(info->open_tables,
info->end_table-1,filepos);
isam_info=info->current_table->table;
isam_info->update&= HA_STATE_CHANGED;
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
(ulong) (filepos -
info->current_table->file_offset),
0));
}
/* Find which table to use according to file-pos */
static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos)
{
MRG_TABLE *mid;
while (start != end)
{
mid=start+((uint) (end-start)+1)/2;
if (mid->file_offset > pos)
end=mid-1;
else
start=mid;
}
return start;
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mrg_def.h"
int mrg_rsame(
MRG_INFO *info,
byte *record,
int inx) /* not used, should be 0 */
{
if (inx)
{
my_errno=HA_ERR_WRONG_INDEX;
return(-1);
}
if (!info->current_table)
{
my_errno=HA_ERR_NO_ACTIVE_RECORD;
return(-1);
}
return nisam_rsame(info->current_table->table,record,inx);
}
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Static variables for pisam library. All definied here for easy making of
a shared library
*/
#ifndef stdin
#include "mrg_def.h"
#endif
LIST *mrg_open_list=0;
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Update last read record */
#include "mrg_def.h"
int mrg_update(
register MRG_INFO *info,
const byte *oldrec, const byte *newrec)
{
if (!info->current_table)
{
my_errno=HA_ERR_NO_ACTIVE_RECORD;
return(-1);
}
return nisam_update(info->current_table->table,oldrec,newrec);
}
...@@ -25,7 +25,7 @@ char ft_boolean_syntax[]="+ -><()~*:\"\"&|"; ...@@ -25,7 +25,7 @@ char ft_boolean_syntax[]="+ -><()~*:\"\"&|";
const HA_KEYSEG ft_keysegs[FT_SEGS]={ const HA_KEYSEG ft_keysegs[FT_SEGS]={
{ {
NullS, /* charset */ 0, /* charset */
HA_FT_WLEN, /* start */ HA_FT_WLEN, /* start */
0, /* null_pos */ 0, /* null_pos */
0, /* Bit pos */ 0, /* Bit pos */
...@@ -42,7 +42,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={ ...@@ -42,7 +42,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
be packed in any way, otherwise w_search() won't be able to be packed in any way, otherwise w_search() won't be able to
update key entry 'in vivo' update key entry 'in vivo'
*/ */
NullS, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, HA_FT_WTYPE, 63, 0, 0, 0, 0 0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, HA_FT_WTYPE, 63, 0, 0, 0, 0
} }
}; };
......
...@@ -46,10 +46,10 @@ int mi_delete(MI_INFO *info,const byte *record) ...@@ -46,10 +46,10 @@ int mi_delete(MI_INFO *info,const byte *record)
/* Test if record is in datafile */ /* Test if record is in datafile */
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage", DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage",
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(my_errno= HA_ERR_CRASHED);); DBUG_RETURN(my_errno= HA_ERR_CRASHED););
DBUG_EXECUTE_IF("my_error_test_undefined_error", DBUG_EXECUTE_IF("my_error_test_undefined_error",
mi_print_error(info, INT_MAX); mi_print_error(info->s, INT_MAX);
DBUG_RETURN(my_errno= INT_MAX);); DBUG_RETURN(my_errno= INT_MAX););
if (!(info->update & HA_STATE_AKTIV)) if (!(info->update & HA_STATE_AKTIV))
{ {
...@@ -116,7 +116,7 @@ err: ...@@ -116,7 +116,7 @@ err:
myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0); myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos, sizeof(lastpos),0);
if (save_errno != HA_ERR_RECORD_CHANGED) if (save_errno != HA_ERR_RECORD_CHANGED)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* mark table crashed */ mi_mark_crashed(info); /* mark table crashed */
} }
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
...@@ -125,7 +125,7 @@ err: ...@@ -125,7 +125,7 @@ err:
my_errno=save_errno; my_errno=save_errno;
if (save_errno == HA_ERR_KEY_NOT_FOUND) if (save_errno == HA_ERR_KEY_NOT_FOUND)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
} }
...@@ -154,7 +154,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -154,7 +154,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
if ((old_root=*root) == HA_OFFSET_ERROR) if ((old_root=*root) == HA_OFFSET_ERROR)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(my_errno=HA_ERR_CRASHED); DBUG_RETURN(my_errno=HA_ERR_CRASHED);
} }
if (!(root_buff= (uchar*) my_alloca((uint) keyinfo->block_length+ if (!(root_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
...@@ -266,9 +266,12 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -266,9 +266,12 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t root; my_off_t root;
uchar *kpos=keypos; uchar *kpos=keypos;
if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey)) if (!(tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&kpos,lastkey)))
&& (my_errno == HA_ERR_CRASHED)) {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno= HA_ERR_CRASHED;
DBUG_RETURN(-1);
}
root=_mi_dpos(info,nod_flag,kpos); root=_mi_dpos(info,nod_flag,kpos);
if (subkeys == -1) if (subkeys == -1)
{ {
...@@ -317,7 +320,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -317,7 +320,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!nod_flag) if (!nod_flag)
{ {
DBUG_PRINT("error",("Didn't find key")); DBUG_PRINT("error",("Didn't find key"));
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; /* This should newer happend */ my_errno=HA_ERR_CRASHED; /* This should newer happend */
goto err; goto err;
} }
...@@ -329,15 +332,10 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -329,15 +332,10 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{ /* Found key */ { /* Found key */
uint tmp; uint tmp;
length=mi_getint(anc_buff); length=mi_getint(anc_buff);
tmp=remove_key(keyinfo,nod_flag,keypos,lastkey,anc_buff+length, if (!(tmp= remove_key(keyinfo,nod_flag,keypos,lastkey,anc_buff+length,
&next_block); &next_block)))
if (tmp == 0) goto err;
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_PRINT("exit",("Return: %d",0));
DBUG_RETURN(0);
}
length-= tmp; length-= tmp;
mi_putint(anc_buff,length,nod_flag); mi_putint(anc_buff,length,nod_flag);
...@@ -386,6 +384,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -386,6 +384,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_afree((byte*) leaf_buff); my_afree((byte*) leaf_buff);
DBUG_PRINT("exit",("Return: %d",ret_value)); DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value); DBUG_RETURN(ret_value);
err: err:
my_afree((byte*) leaf_buff); my_afree((byte*) leaf_buff);
DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_PRINT("exit",("Error: %d",my_errno));
...@@ -491,8 +490,6 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key, ...@@ -491,8 +490,6 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
(info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH : (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)); (uint) keyinfo->underflow_block_length));
err: err:
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} /* del */ } /* del */
...@@ -579,14 +576,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -579,14 +576,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* remove key from anc_buff */ /* remove key from anc_buff */
s_length=remove_key(keyinfo,key_reflength,keypos,anc_key, if (!(s_length=remove_key(keyinfo,key_reflength,keypos,anc_key,
anc_buff+anc_length,(my_off_t *) 0); anc_buff+anc_length,(my_off_t *) 0)))
if (!s_length)
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
goto err; goto err;
}
anc_length-=s_length; anc_length-=s_length;
mi_putint(anc_buff,anc_length,key_reflength); mi_putint(anc_buff,anc_length,key_reflength);
...@@ -692,14 +685,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -692,14 +685,10 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
mi_putint(buff,buff_length,nod_flag); mi_putint(buff,buff_length,nod_flag);
/* remove key from anc_buff */ /* remove key from anc_buff */
s_length=remove_key(keyinfo,key_reflength,keypos,anc_key, if (!(s_length= remove_key(keyinfo,key_reflength,keypos,anc_key,
anc_buff+anc_length,(my_off_t *) 0); anc_buff+anc_length,(my_off_t *) 0)))
if (!s_length)
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
goto err; goto err;
}
anc_length-=s_length; anc_length-=s_length;
mi_putint(anc_buff,anc_length,key_reflength); mi_putint(anc_buff,anc_length,key_reflength);
...@@ -759,9 +748,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -759,9 +748,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff)) if (_mi_write_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,buff))
goto err; goto err;
DBUG_RETURN(anc_length <= (uint) keyinfo->block_length/2); DBUG_RETURN(anc_length <= (uint) keyinfo->block_length/2);
err: err:
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} /* underflow */ } /* underflow */
...@@ -798,6 +786,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -798,6 +786,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
/* Calculate length of key */ /* Calculate length of key */
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey)) if (!(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey))
DBUG_RETURN(0); /* Error */ DBUG_RETURN(0); /* Error */
if (next_block && nod_flag) if (next_block && nod_flag)
*next_block= _mi_kpos(nod_flag,keypos); *next_block= _mi_kpos(nod_flag,keypos);
s_length=(int) (keypos-start); s_length=(int) (keypos-start);
......
...@@ -187,7 +187,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) ...@@ -187,7 +187,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{ {
if ((error=flush_io_cache(&info->rec_cache))) if ((error=flush_io_cache(&info->rec_cache)))
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Fatal error found */ mi_mark_crashed(info); /* Fatal error found */
} }
} }
...@@ -288,7 +288,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) ...@@ -288,7 +288,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
{ {
error=my_errno; error=my_errno;
share->changed=1; share->changed=1;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Fatal error found */ mi_mark_crashed(info); /* Fatal error found */
} }
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
...@@ -343,7 +343,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) ...@@ -343,7 +343,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (error) if (error)
{ {
share->changed=1; share->changed=1;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Fatal error found */ mi_mark_crashed(info); /* Fatal error found */
} }
} }
......
...@@ -477,7 +477,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) ...@@ -477,7 +477,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
{ /* Read only key */ { /* Read only key */
if (_mi_put_key_in_record(info,(uint) info->lastinx,buf)) if (_mi_put_key_in_record(info,(uint) info->lastinx,buf))
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return -1; return -1;
} }
......
...@@ -79,7 +79,7 @@ int mi_assign_to_key_cache(MI_INFO *info, ...@@ -79,7 +79,7 @@ int mi_assign_to_key_cache(MI_INFO *info,
if (flush_key_blocks(share->key_cache, share->kfile, FLUSH_RELEASE)) if (flush_key_blocks(share->key_cache, share->kfile, FLUSH_RELEASE))
{ {
error= my_errno; error= my_errno;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Mark that table must be checked */ mi_mark_crashed(info); /* Mark that table must be checked */
} }
......
...@@ -66,7 +66,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) ...@@ -66,7 +66,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->kfile,FLUSH_KEEP)) share->kfile,FLUSH_KEEP))
{ {
error=my_errno; error=my_errno;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); /* Mark that table must be checked */ mi_mark_crashed(info); /* Mark that table must be checked */
} }
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
...@@ -74,7 +74,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) ...@@ -74,7 +74,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
if (end_io_cache(&info->rec_cache)) if (end_io_cache(&info->rec_cache))
{ {
error=my_errno; error=my_errno;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); mi_mark_crashed(info);
} }
} }
...@@ -101,7 +101,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) ...@@ -101,7 +101,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->not_flushed=1; share->not_flushed=1;
if (error) if (error)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); mi_mark_crashed(info);
} }
} }
...@@ -290,7 +290,7 @@ void mi_update_status(void* param) ...@@ -290,7 +290,7 @@ void mi_update_status(void* param)
{ {
if (end_io_cache(&info->rec_cache)) if (end_io_cache(&info->rec_cache))
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); mi_mark_crashed(info);
} }
info->opt_flag&= ~WRITE_CACHE_USED; info->opt_flag&= ~WRITE_CACHE_USED;
......
...@@ -309,6 +309,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -309,6 +309,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
HA_KEYSEG *pos=share->keyparts; HA_KEYSEG *pos=share->keyparts;
for (i=0 ; i < keys ; i++) for (i=0 ; i < keys ; i++)
{ {
share->keyinfo[i].share= share;
disk_pos=mi_keydef_read(disk_pos, &share->keyinfo[i]); disk_pos=mi_keydef_read(disk_pos, &share->keyinfo[i]);
disk_pos_assert(disk_pos + share->keyinfo[i].keysegs * HA_KEYSEG_SIZE, disk_pos_assert(disk_pos + share->keyinfo[i].keysegs * HA_KEYSEG_SIZE,
end_pos); end_pos);
...@@ -1236,7 +1237,7 @@ int mi_enable_indexes(MI_INFO *info) ...@@ -1236,7 +1237,7 @@ int mi_enable_indexes(MI_INFO *info)
if (share->state.state.data_file_length || if (share->state.state.data_file_length ||
(share->state.state.key_file_length != share->base.keystart)) (share->state.state.key_file_length != share->base.keystart))
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
error= HA_ERR_CRASHED; error= HA_ERR_CRASHED;
} }
else else
......
...@@ -40,7 +40,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -40,7 +40,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
{ {
DBUG_PRINT("error",("Got errno: %d from key_cache_read",my_errno)); DBUG_PRINT("error",("Got errno: %d from key_cache_read",my_errno));
info->last_keypage=HA_OFFSET_ERROR; info->last_keypage=HA_OFFSET_ERROR;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -52,7 +52,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -52,7 +52,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
(ulong) page, page_size)); (ulong) page, page_size));
DBUG_DUMP("page", (char*) tmp, keyinfo->block_length); DBUG_DUMP("page", (char*) tmp, keyinfo->block_length);
info->last_keypage = HA_OFFSET_ERROR; info->last_keypage = HA_OFFSET_ERROR;
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno = HA_ERR_CRASHED; my_errno = HA_ERR_CRASHED;
tmp = 0; tmp = 0;
} }
......
...@@ -213,7 +213,8 @@ err: ...@@ -213,7 +213,8 @@ err:
/* Get keynummer of current key and max number of keys in nod */ /* Get keynummer of current key and max number of keys in nod */
static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uchar *keypos, uint *ret_max_key) static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
uchar *keypos, uint *ret_max_key)
{ {
uint nod_flag,keynr,max_key; uint nod_flag,keynr,max_key;
uchar t_buff[MI_MAX_KEY_BUFF],*end; uchar t_buff[MI_MAX_KEY_BUFF],*end;
...@@ -222,7 +223,7 @@ static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, u ...@@ -222,7 +223,7 @@ static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, u
nod_flag=mi_test_if_nod(page); nod_flag=mi_test_if_nod(page);
page+=2+nod_flag; page+=2+nod_flag;
if (!(keyinfo->flag & (HA_VAR_LENGTH_KEY| HA_BINARY_PACK_KEY))) if (!(keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
{ {
*ret_max_key= (uint) (end-page)/(keyinfo->keylength+nod_flag); *ret_max_key= (uint) (end-page)/(keyinfo->keylength+nod_flag);
return (uint) (keypos-page)/(keyinfo->keylength+nod_flag); return (uint) (keypos-page)/(keyinfo->keylength+nod_flag);
...@@ -233,11 +234,7 @@ static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, u ...@@ -233,11 +234,7 @@ static uint _mi_keynr(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, u
while (page < end) while (page < end)
{ {
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&page,t_buff)) if (!(*keyinfo->get_key)(keyinfo,nod_flag,&page,t_buff))
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
return 0; /* Error */ return 0; /* Error */
}
max_key++; max_key++;
if (page == keypos) if (page == keypos)
keynr=max_key; keynr=max_key;
......
...@@ -78,7 +78,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, ...@@ -78,7 +78,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
case HA_KEY_ALG_RTREE: case HA_KEY_ALG_RTREE:
if (rtree_find_first(info,inx,key_buff,use_key_length,nextflag) < 0) if (rtree_find_first(info,inx,key_buff,use_key_length,nextflag) < 0)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
goto err; goto err;
} }
......
...@@ -159,10 +159,9 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -159,10 +159,9 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_PRINT("exit",("found key at %lu",(ulong) 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));
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
info->lastpos= HA_OFFSET_ERROR; info->lastpos= HA_OFFSET_ERROR;
info->page_changed=1; info->page_changed=1;
DBUG_RETURN (-1); DBUG_RETURN (-1);
...@@ -236,7 +235,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -236,7 +235,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,t_buff); length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,t_buff);
if (length == 0 || page > end) if (length == 0 || page > end)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p", DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
length, page, end)); length, page, end));
...@@ -383,7 +382,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -383,7 +382,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
if (page > end) if (page > end)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p", DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
length, page, end)); length, page, end));
...@@ -752,6 +751,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -752,6 +751,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
{ {
if (length > (uint) keyseg->length) if (length > (uint) keyseg->length)
{ {
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; /* Error */ return 0; /* Error */
} }
...@@ -767,6 +767,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -767,6 +767,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
("Found too long null packed key: %u of %u at %p", ("Found too long null packed key: %u of %u at %p",
length, keyseg->length, *page_pos)); length, keyseg->length, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16); DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; return 0;
} }
...@@ -823,6 +824,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -823,6 +824,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",("Found too long packed key: %u of %u at %p", DBUG_PRINT("error",("Found too long packed key: %u of %u at %p",
length, keyseg->length, *page_pos)); length, keyseg->length, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16); DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; /* Error */ return 0; /* Error */
} }
...@@ -878,6 +880,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -878,6 +880,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %p", DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %p",
length, keyinfo->maxlength, *page_pos)); length, keyinfo->maxlength, *page_pos));
DBUG_DUMP("key",(char*) *page_pos,16); DBUG_DUMP("key",(char*) *page_pos,16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; /* Wrong key */ return 0; /* Wrong key */
} }
...@@ -939,6 +942,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -939,6 +942,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
if (from_end != page_end) if (from_end != page_end)
{ {
DBUG_PRINT("error",("Error when unpacking key")); DBUG_PRINT("error",("Error when unpacking key"));
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; /* Error */ return 0; /* Error */
} }
...@@ -973,7 +977,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, ...@@ -973,7 +977,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
*return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,key); *return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,key);
if (*return_key_length == 0) if (*return_key_length == 0)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1011,7 +1015,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, ...@@ -1011,7 +1015,7 @@ static my_bool _mi_get_prev_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
*return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,key); *return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,key);
if (*return_key_length == 0) if (*return_key_length == 0)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -1052,7 +1056,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, ...@@ -1052,7 +1056,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
if (*return_key_length == 0) if (*return_key_length == 0)
{ {
DBUG_PRINT("error",("Couldn't find last key: page: %p", page)); DBUG_PRINT("error",("Couldn't find last key: page: %p", page));
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1185,12 +1189,8 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -1185,12 +1189,8 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo,
memcpy(lastkey,key,key_length); memcpy(lastkey,key,key_length);
if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag, if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag,
&info->int_keypos,lastkey))) &info->int_keypos,lastkey)))
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
}
else /* Previous key */ else /* Previous key */
{ {
uint length; uint length;
...@@ -1248,9 +1248,9 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -1248,9 +1248,9 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo,
} while ((pos=_mi_kpos(nod_flag,page)) != HA_OFFSET_ERROR); } while ((pos=_mi_kpos(nod_flag,page)) != HA_OFFSET_ERROR);
if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page, if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,
info->lastkey)) && info->lastkey)))
(my_errno == HA_ERR_CRASHED)) DBUG_RETURN(-1); /* Crashed */
mi_print_error(info, HA_ERR_CRASHED);
info->int_keypos=page; info->int_maxpos=info->buff+mi_getint(info->buff)-1; info->int_keypos=page; info->int_maxpos=info->buff+mi_getint(info->buff)-1;
info->int_nod_flag=nod_flag; info->int_nod_flag=nod_flag;
info->int_keytree_version=keyinfo->version; info->int_keytree_version=keyinfo->version;
......
...@@ -35,7 +35,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) ...@@ -35,7 +35,7 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
LINT_INIT(old_checksum); LINT_INIT(old_checksum);
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage", DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage",
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(my_errno= HA_ERR_CRASHED);); DBUG_RETURN(my_errno= HA_ERR_CRASHED););
if (!(info->update & HA_STATE_AKTIV)) if (!(info->update & HA_STATE_AKTIV))
{ {
...@@ -209,7 +209,7 @@ err: ...@@ -209,7 +209,7 @@ err:
} }
else else
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); mi_mark_crashed(info);
} }
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_ROW_CHANGED | info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_ROW_CHANGED |
...@@ -221,7 +221,7 @@ err: ...@@ -221,7 +221,7 @@ err:
allow_break(); /* Allow SIGHUP & SIGINT */ allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND) if (save_errno == HA_ERR_KEY_NOT_FOUND)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
save_errno=HA_ERR_CRASHED; save_errno=HA_ERR_CRASHED;
} }
DBUG_RETURN(my_errno=save_errno); DBUG_RETURN(my_errno=save_errno);
......
...@@ -53,7 +53,7 @@ int mi_write(MI_INFO *info, byte *record) ...@@ -53,7 +53,7 @@ int mi_write(MI_INFO *info, byte *record)
DBUG_PRINT("enter",("isam: %d data: %d",info->s->kfile,info->dfile)); DBUG_PRINT("enter",("isam: %d data: %d",info->s->kfile,info->dfile));
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage", DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage",
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
DBUG_RETURN(my_errno= HA_ERR_CRASHED);); DBUG_RETURN(my_errno= HA_ERR_CRASHED););
if (share->options & HA_OPTION_READ_ONLY_DATA) if (share->options & HA_OPTION_READ_ONLY_DATA)
{ {
...@@ -207,7 +207,7 @@ err: ...@@ -207,7 +207,7 @@ err:
} }
else else
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
mi_mark_crashed(info); mi_mark_crashed(info);
} }
info->update= (HA_STATE_CHANGED | HA_STATE_WRITTEN | HA_STATE_ROW_CHANGED); info->update= (HA_STATE_CHANGED | HA_STATE_WRITTEN | HA_STATE_ROW_CHANGED);
...@@ -353,11 +353,8 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -353,11 +353,8 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (tmp_key_length) if (tmp_key_length)
dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length); dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length);
else else
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
dupp_key_pos= HA_OFFSET_ERROR; dupp_key_pos= HA_OFFSET_ERROR;
}
if (keyinfo->flag & HA_FULLTEXT) if (keyinfo->flag & HA_FULLTEXT)
{ {
uint off; uint off;
...@@ -466,7 +463,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -466,7 +463,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{ {
if (t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH) if (t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -476,7 +473,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -476,7 +473,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{ {
if (-t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH) if (-t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH)
{ {
mi_print_error(info, HA_ERR_CRASHED); mi_print_error(info->s, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -571,11 +568,8 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -571,11 +568,8 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
key_pos=_mi_find_half_pos(nod_flag,keyinfo,buff,key_buff, &key_length, key_pos=_mi_find_half_pos(nod_flag,keyinfo,buff,key_buff, &key_length,
&after_key); &after_key);
if (!key_pos) if (!key_pos)
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_RETURN(-1); DBUG_RETURN(-1);
}
length=(uint) (key_pos-buff); length=(uint) (key_pos-buff);
a_length=mi_getint(buff); a_length=mi_getint(buff);
mi_putint(buff,length,nod_flag); mi_putint(buff,length,nod_flag);
...@@ -595,11 +589,8 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -595,11 +589,8 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* Store new page */ /* Store new page */
if (!(*keyinfo->get_key)(keyinfo,nod_flag,&key_pos,key_buff)) if (!(*keyinfo->get_key)(keyinfo,nod_flag,&key_pos,key_buff))
{
if (my_errno == HA_ERR_CRASHED)
mi_print_error(info, HA_ERR_CRASHED);
DBUG_RETURN(-1); DBUG_RETURN(-1);
}
t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(uchar *) 0, t_length=(*keyinfo->pack_key)(keyinfo,nod_flag,(uchar *) 0,
(uchar*) 0, (uchar*) 0, (uchar*) 0, (uchar*) 0,
key_buff, &s_temp); key_buff, &s_temp);
...@@ -706,6 +697,7 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, ...@@ -706,6 +697,7 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
memcpy(key, key_buff, length); /* previous key */ memcpy(key, key_buff, length); /* previous key */
if (!(length=(*keyinfo->get_key)(keyinfo,0,&page,key_buff))) if (!(length=(*keyinfo->get_key)(keyinfo,0,&page,key_buff)))
{ {
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -356,8 +356,8 @@ typedef struct st_mi_sort_param ...@@ -356,8 +356,8 @@ typedef struct st_mi_sort_param
#define mi_mark_crashed_on_repair(x) { (x)->s->state.changed|=STATE_CRASHED|STATE_CRASHED_ON_REPAIR ; (x)->update|= HA_STATE_CHANGED; } #define mi_mark_crashed_on_repair(x) { (x)->s->state.changed|=STATE_CRASHED|STATE_CRASHED_ON_REPAIR ; (x)->update|= HA_STATE_CHANGED; }
#define mi_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED) #define mi_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED)
#define mi_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR) #define mi_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR)
#define mi_print_error(INFO, ERRNO) \ #define mi_print_error(SHARE, ERRNO) \
mi_report_error((ERRNO), (INFO)->s->index_file_name) mi_report_error((ERRNO), (SHARE)->index_file_name)
/* Functions to store length of space packed keys, VARCHAR or BLOB keys */ /* Functions to store length of space packed keys, VARCHAR or BLOB keys */
......
...@@ -389,14 +389,14 @@ flush privileges; ...@@ -389,14 +389,14 @@ flush privileges;
use mysqltest_1; use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1'
use mysqltest_2; use mysqltest_2;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't2'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1'
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r a q b r
10 2 1 2 10 2 1 2
......
...@@ -273,9 +273,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC') ...@@ -273,9 +273,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
flush privileges; flush privileges;
grant all privileges on test.t1 to mysqltest_1@localhost; grant all privileges on test.t1 to mysqltest_1@localhost;
......
...@@ -337,15 +337,15 @@ connection conn2; ...@@ -337,15 +337,15 @@ connection conn2;
use mysqltest_1; use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
# the following failed before, should fail now. # the following failed before, should fail now.
--error 1044 --error 1142
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2; use mysqltest_2;
#the following used to succeed, it must fail now. #the following used to succeed, it must fail now.
--error 1044 --error 1142
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
--error 1044 --error 1142
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
--error 1044 --error 1142
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
#lets see the result #lets see the result
connection master; connection master;
......
...@@ -226,9 +226,9 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; ...@@ -226,9 +226,9 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
# But still these two statements should not work: # But still these two statements should not work:
--error 1044 --error 1142
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
--error 1044 --error 1142
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
# #
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#endif #endif
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_acl.h"
#include "slave.h" // for wait_for_master_pos #include "slave.h" // for wait_for_master_pos
#include <m_ctype.h> #include <m_ctype.h>
#include <hash.h> #include <hash.h>
......
...@@ -4835,7 +4835,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list) ...@@ -4835,7 +4835,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
close_thread_tables(thd); close_thread_tables(thd);
if (result) if (result)
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr()); my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
DBUG_RETURN(result); DBUG_RETURN(result);
} }
......
...@@ -1807,7 +1807,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) ...@@ -1807,7 +1807,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
0, HA_READ_KEY_EXACT)) 0, HA_READ_KEY_EXACT))
{ {
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
sql_print_error("Can't find description of time zone."); sql_print_error("Can't find description of time zone '%.*s'", tz_name->length(),
tz_name->ptr());
#endif #endif
goto end; goto end;
} }
...@@ -1829,7 +1830,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) ...@@ -1829,7 +1830,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr, if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
0, HA_READ_KEY_EXACT)) 0, HA_READ_KEY_EXACT))
{ {
sql_print_error("Can't find description of time zone."); sql_print_error("Can't find description of time zone '%u'", tzid);
goto end; goto end;
} }
......
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