Commit 9f7c4563 authored by monty@tramp.mysql.fi's avatar monty@tramp.mysql.fi
Browse files

First part of automatic repair of MyISAM tables.

Error on full disk on repair.
SIGHUP signal handling.
Update with keys on timestamp
Portability fixes
parent 69a249c0
Loading
Loading
Loading
Loading
+1 −24
Original line number Diff line number Diff line
bk@work.mysql.com
davida@work.mysql.com
jamppa@work.mysql.com
jcole@ham.spaceapes.com
jcole@jcole.burghcom.com
jcole@nslinux.bedford.progress.com
jcole@tetra.bedford.progress.com
jcole@tetra.spaceapes.com
matt@work.mysql.com
monty@donna.mysql.com
monty@work.mysql.com
mwagner@evoq.home.mwagner.org
nusphere@main.burghcom.com
paul@central.snake.net
paul@work.mysql.com
sasha@mysql.sashanet.com
sasha@work.mysql.com
serg@infomag.ape.relarn.ru
serg@work.mysql.com
sinisa@work.mysql.com
tim@localhost.polyesthetic.msg
tim@work.mysql.com
tonu@work.mysql.com
spurr@nslinux.bedford.progress.com
monty@tramp.mysql.fi
+41 −1
Original line number Diff line number Diff line
@@ -8984,6 +8984,24 @@ Lock the @code{mysqld} process in memory. This works only if your system
supports the @code{mlockall()} system call.  This may help if you have
a problem where the opearting system is causing @code{mysqld} to swap on disk.
@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP or FORCE.
If this option is used, @code{mysqld} will on open check if the table is
marked as crashed or if if the table wasn't closed properly
(The last option only works if you are running with @code{--skip-locking}).
If this is the case mysqld will run check on the table. If the table was
corrupted, @code{mysqld} will attempt to repair it.
The following options affects how the repair works.
@multitable @columnfractions .3 .7
@item DEFAULT @tab The same as not giving any option to @code{--myisam-recover}.
@item BACKUP @tab If the data table was changed during recover, save a backup of the @file{table_name.MYD} data file as @file{table_name-datetime.BAK}.
@item FORCE @tab Run recover even if we will loose more than one row from the .MYD file.
@end multitable
Before a table is automaticly repaired, mysqld will add a note about this
in the error log.
@item --pid-file=path
Path to pid file used by @code{safe_mysqld}.
@@ -21065,6 +21083,9 @@ The following is new in @code{MyISAM}:
@itemize @bullet
@item
If @code{mysqld} is started with @code{--myisam-recover}, @code{MyISAM} tables
will automaticly be repaired on open if the table wasn't closed properly.
@item
You can @code{INSERT} new rows in a table without deleted rows,
while other threads are reading from the table.
@item
@@ -21148,6 +21169,18 @@ Note that index files are usually much smaller with @code{MyISAM} than with
system resources than @code{ISAM}, but will need more CPU when inserting
data into compressed index.
The following options to @code{mysqld} can be used to change the behavior of
@code{MyISAM} tables:
@multitable @columnfractions .40 .60
@item @strong{Option} @tab @strong{Meaning}
@item @code{--myisam-recover} @tab Automatic recover of crashed tables.
@item @code{-O myisam_sort_buffer_size=#} @tab Buffer used when recovering tables.
@item @code{--delay-key-write-for-all-tables} @tab Don't flush key buffers between writes for any MyISAM table
@end multitable
@xref{Command-line options}.
@menu
* Key space::                   Space needed for keys
* MyISAM table formats::        MyISAM table formats
@@ -37416,7 +37449,14 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.26
@itemize @bullet
@item
Fixed bug in @code{FULLTEXT} index when inserting a NULL column.
Automatic repair of @code{MyISAM} tables.
@item
Columns referenced in @code{INSERT} are are now properly initialized.
@item
@code{UPDATE} didn't always work when used with a range on a timestamp that
was part of the key that was used to find rows.
@item
Fixed bug in @code{FULLTEXT} index when inserting a NULL value.
@item
Changed to use @code{mkstemp()} instead of @code{tempnam()}.
@end itemize
+3 −4
Original line number Diff line number Diff line
@@ -1543,12 +1543,12 @@ com_edit(String *buffer,char *line __attribute__((unused)))
  put_info("Sorry, you can't send the result to an editor in Win32",
	   INFO_ERROR);
#else
  char	*filename,buff[160];
  char	filename[FN_REFLEN],buff[160];
  int	fd,tmp;
  const char *editor;

  filename = my_tempnam(NullS,"sql",MYF(MY_WME));
  if ((fd = my_create(filename,0,O_CREAT | O_WRONLY, MYF(MY_WME))) < 0)
  if ((fd=create_temp_file(filename,NullS,"sql", O_CREAT | O_WRONLY,
			   MYF(MY_WME))) < 0)
    goto err;
  if (buffer->is_empty() && !old_buffer.is_empty())
    (void) my_write(fd,(byte*) old_buffer.ptr(),old_buffer.length(),
@@ -1576,7 +1576,6 @@ com_edit(String *buffer,char *line __attribute__((unused)))
  (void) my_close(fd,MYF(0));
  (void) my_delete(filename,MYF(MY_WME));
err:
  free(filename);
#endif
  return 0;
}
+9 −6
Original line number Diff line number Diff line
@@ -266,20 +266,21 @@ typedef struct st_dynamic_string {

typedef struct st_io_cache		/* Used when cacheing files */
{
  my_off_t pos_in_file,end_of_file;
  byte	*rc_pos,*rc_end,*buffer,*rc_request_pos;
  int (*read_function)(struct st_io_cache *,byte *,uint);
  char *file_name;			/* if used with 'open_cached_file' */
  char *dir,*prefix;
  File file;
  int	seek_not_done,error;
  uint	buffer_length,read_length;
  my_off_t pos_in_file,end_of_file;
  myf	myflags;			/* Flags used to my_read/my_write */
  enum cache_type type;
#ifdef HAVE_AIOWAIT
  uint inited;
  my_off_t aio_read_pos;
  my_aio_result aio_result;
#endif
  enum cache_type type;
  int (*read_function)(struct st_io_cache *,byte *,uint);
  char *file_name;			/* if used with 'open_cached_file' */
} IO_CACHE;

typedef int (*qsort2_cmp)(const void *, const void *, const void *);
@@ -399,7 +400,7 @@ extern void TERMINATE(FILE *file);
#endif
extern void init_glob_errs(void);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_chsize(File fd,my_off_t newlength,myf MyFlags);
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
@@ -430,7 +431,7 @@ extern uint dirname_part(my_string to,const char *name);
extern uint dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name);
extern void convert_dirname(my_string name);
extern char *convert_dirname(my_string name);
extern void to_unix_path(my_string name);
extern my_string fn_ext(const char *name);
extern my_string fn_same(my_string toname,const char *name,int flag);
@@ -507,6 +508,8 @@ extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
				 myf cache_myflags);
extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache);
File create_temp_file(char *to, const char *dir, const char *pfx,
		      int mode, myf MyFlags);
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
				  uint init_alloc,uint alloc_increment);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
+2 −1
Original line number Diff line number Diff line
@@ -339,7 +339,6 @@ typedef struct st_mi_check_param


typedef struct st_mi_sortinfo {
  uint key_length;
  ha_rows max_records;
  SORT_INFO *sort_info;
  char *tmpdir;
@@ -347,6 +346,8 @@ typedef struct st_mi_sortinfo {
  int (*key_read)(SORT_INFO *info,void *buff);
  int (*key_write)(SORT_INFO *info, const void *buff);
  void (*lock_in_memory)(MI_CHECK *info);
  uint key_length;
  myf myf_rw;
} MI_SORT_PARAM;

/* functions in mi_check */
Loading