Commit 254befa1 authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

Merge

parents f8bc5e06 828bff91
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
monty@donna.mysql.com
sasha@mysql.sashanet.com
serg@serg.mysql.com
+60 −10
Original line number Diff line number Diff line
@@ -1807,6 +1807,13 @@ is as tested as the other table types.
This only affects the new code that checks if the table was closed properly
on open and executes an automatic check/repair of the table if it wasn't.
@item MERGE tables -- Alpha / Beta
The usage of keys on @code{MERGE} tables is still not that tested.  The
other part of the @code{MERGE} code is quite well tested.
@item FULLTEXT -- Alpha / Beta
Text search seams to work, but is still not widely used.
@end table
MySQL AB provides e-mail support for paying customers, but the @strong{MySQL}
@@ -9029,9 +9036,9 @@ priority in one thread.
@item --memlock
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.
a problem where the operating system is causing @code{mysqld} to swap on disk.
@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP or FORCE.
@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP, FORCE or QUICK.
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}).
@@ -9044,10 +9051,15 @@ The following options affects how the repair works.
@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.
@item QUICK @tab Don't check the rows in the table if there isn't any delete blocks.
@end multitable
Before a table is automaticly repaired, mysqld will add a note about this
in the error log.
Before a table is automaticly repaired, mysqld will add a note about
this in the error log.  If you want to be able to recover from most
things without user intervention, you should use the options
@code{BACKUP,FORCE}.  This will force a repair of a table even if some rows
would be deleted, but it will keep the old data file as a backup so that
you can later examine what happened.
@item --pid-file=path
Path to pid file used by @code{safe_mysqld}.
@@ -16312,7 +16324,8 @@ Version 3.22. @code{ADDDATE()} and @code{SUBDATE()} are synonyms for
@code{DATE_ADD()} and @code{DATE_SUB()}.
In @strong{MySQL} Version 3.23, you can use @code{+} and @code{-} instead of
@code{DATE_ADD()} and @code{DATE_SUB()}. (See example)
@code{DATE_ADD()} and @code{DATE_SUB()} if the expression on the right side is
a date or datetime column. (See example)
@code{date} is a @code{DATETIME} or @code{DATE} value specifying the starting
date.  @code{expr} is an expression specifying the interval value to be added
@@ -20214,7 +20227,9 @@ this join type is good.
@item range
Only rows that are in a given range will be retrieved, using an index to
select the rows.  The @code{ref} column indicates which index is used.
select the rows.  The @code{key} column indicates which index is used.
The @code{key_len} contains the longest key part that was used.
The @code{ref} column will be NULL for this type.
@item index
This is the same as @code{ALL}, except that only the index tree is
@@ -21256,7 +21271,7 @@ of both worlds.
@menu
* MyISAM::                      MyISAM tables
* MERGE::
* MERGE::			MERGE tables
* ISAM::                        ISAM tables
* HEAP::                        HEAP tables
* BDB::                         BDB or Berkeley_db tables
@@ -21368,11 +21383,37 @@ The following options to @code{mysqld} can be used to change the behavior of
@multitable @columnfractions .40 .60
@item @strong{Option} @tab @strong{Meaning}
@item @code{--myisam-recover} @tab Automatic recover of crashed tables.
@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
The automatic recovery is activated if you start mysqld with
@code{--myisam-recover=#}. @xref{Command-line options}.
On open, the table is checked if it's marked as crashed or if the open
count variable for the table is not 0 and you are running with
@code{--skip-locking}.  If either of the above is true the following happens.
@itemize @bullet
@item
The table is checked for errors.
@item
If we found an error, try to do a fast repair (with sorting and without
recreating the data file) of the table.
@item
If the repair fails because of an error in the data file (for example a
duplicate key error), we try again, but this time we recreate the data file.
@item
If the repair fails, retry once more with the old repair option method
(write row by row without sorting) which should be able to repair any
type of error with little disk requirements..
@end itemize
Note that if you run automatic recover with the @code{BACKUP} option,
you should have a cron script that automaticly moves file with names
like @file{tablename-datetime.BAK} from the database directories to a
backup media.
@xref{Command-line options}.
@menu
@@ -21903,6 +21944,9 @@ properly locked if one another thread issues a table lock.
@item
Internal locking in @code{BDB} tables are done on page level.
@item
@code{SELECT COUNT(*) FROM table_name} is slow as @code{BDB} tables doesn't
maintain a count of the number of rows in the table.
@item
Scanning is slower than with @code{MyISAM} tables as one has data in BDB
tables is stored in B-trees and not in a separate data file.
@item
@@ -37037,7 +37081,7 @@ This listing.
Perl @code{Data-Dumper} module.  Useful with @code{DBI}/@code{DBD} support for
older perl installations.
@item @uref{http://www.mysql.com/Downloads/Contrib/DBI-1.13.tar.gz, DBI-1.13.tar.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/DBI-1.14.tar.gz, DBI-1.14.tar.gz}
Perl @code{DBI} module.
@item @uref{http://www.mysql.com/Downloads/Contrib/KAMXbase1.0.tar.gz,KAMXbase1.0.tar.gz}
@@ -37046,7 +37090,7 @@ module written by Pratap Pereira @email{pereira@@ee.eng.ohio-state.edu},
extened by Kevin A. McGrail @email{kmcgrail@@digital1.peregrinehw.com}.
This converter can handle MEMO fields.
@item @uref{http://www.mysql.com/Downloads/Contrib/Msql-Mysql-modules-1.2214.tar.gz, Msql-Mysql-modules-1.2214.tar.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/Msql-Mysql-modules-1.2215.tar.gz, Msql-Mysql-modules-1.2215.tar.gz}
Perl @code{DBD} module to access mSQL and @strong{MySQL} databases..
@item @uref{http://www.mysql.com/Downloads/Contrib/Data-ShowTable-3.3.tar.gz,  Data-ShowTable-3.3.tar.gz}
@@ -38003,6 +38047,12 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.26
@itemize @bullet
@item
Fixed problem with @code{SUBSTRING_INDEX()} and @code{REPLACE()}.
(Patch by Alexander Igonitchev)
@item
@code{CREATE TEMPORARY TABLE IF NOT EXISTS} doesn't anymore give an error
if the table existed.
@item
If one don't create a @code{PRIMARY KEY} in a BDB table, a hidden
@code{PRIMARY KEY} will be created.
@item
+2 −4
Original line number Diff line number Diff line
@@ -30,16 +30,14 @@ noinst_HEADERS = global.h config-win.h \
			my_tree.h hash.h thr_alarm.h thr_lock.h \
			getopt.h t_ctype.h violite.h \
			mysql_version.h.in
EXTRA_DIST=		my_config.h

# mysql_version.h are generated
SUPERCLEANFILES =	mysql_version.h my_global.h
SUPERCLEANFILES =	mysql_version.h my_global.h my_config.h

# Some include files that may be moved and patched by configure
DISTCLEANFILES =	sched.h
CLEANFILES =		my_config.h

all-local:		my_global.h
all-local:		my_global.h my_config.h

# Since we include my_config.h it better exist from the beginning
link_sources:
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ struct timespec { /* For pthread_cond_timedwait() */

typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B)
typedef unsigned (__cdecl *pthread_handler)(void *);
#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
typedef void * (__cdecl *pthread_handler)(void *);

void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
+93 −30
Original line number Diff line number Diff line
@@ -504,7 +504,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,

  if (used_length > keyinfo->block_length)
  {
    mi_check_print_error(param,"Wrong pageinfo at page: %s", llstr(page,llbuff));
    mi_check_print_error(param,"Wrong pageinfo at page: %s",
			 llstr(page,llbuff));
    goto err;
  }
  for ( ;; )
@@ -1174,7 +1175,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
      mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s",
			  info->errkey+1,
			  llstr(sort_info->start_recpos,llbuff),
		 llstr(info->lastpos,llbuff2));
			  llstr(info->dupp_key_pos,llbuff2));
      if (param->testflag & T_VERBOSE)
      {
	VOID(_mi_make_key(info,(uint) info->errkey,info->lastkey,
@@ -1185,7 +1186,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
      sort_info->dupp++;
      if (rep_quick == 1)
      {
	param->error_printed=1;
	param->error_printed=param->retry_without_quick=1;
	goto err;
      }
      continue;
@@ -1217,6 +1218,16 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
    param->retry_repair=param->retry_without_quick=1;
    goto err;
  }
  if (param->testflag & T_SAFE_REPAIR)
  {
    /* Don't repair if we loosed more than one row */
    if (info->state->records+1 < start_records)
    {
      info->state->records=start_records;
      got_error=1;
      goto err;
    }
  }

  if (!rep_quick)
  {
@@ -1225,7 +1236,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
    info->state->data_file_length=sort_info->filepos;
    /* Only whole records */
    share->state.split=info->state->records+info->state->del;
    param->out_flag|=O_NEW_DATA;			/* Data in new file */
    share->state.version=(ulong) time((time_t*) 0);	/* Force reopen */
  }
  else
@@ -1247,6 +1257,21 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
    memcpy( &share->state.state, info->state, sizeof(*info->state));

err:
  if (!got_error)
  {
    /* Replace the actual file with the temporary file */
    if (new_file >= 0)
    {
      my_close(new_file,MYF(0));
      info->dfile=new_file= -1;
      if (change_to_newfile(share->filename,MI_NAME_DEXT,
			    DATA_TMP_EXT, share->base.raid_chunks,
			    (param->testflag & T_BACKUP_DATA ?
			     MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) ||
	  mi_open_datafile(info,share))
	got_error=1;
    }
  }
  if (got_error)
  {
    if (! param->error_printed)
@@ -1274,7 +1299,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
    share->pack.header_length=0;
    share->data_file_type=sort_info->new_data_file_type;
  }
  share->state.changed|=STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES;
  share->state.changed|= (STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES |
			  STATE_NOT_ANALYZED);
  DBUG_RETURN(got_error);
}

@@ -1453,14 +1479,17 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
  flush_key_blocks(info->s->kfile, FLUSH_IGNORE_CHANGED);

	/* Put same locks as old file */
  if (lock_file(param,new_file,0L,F_WRLCK,"tempfile",param->temp_filename))
    goto err;
  info->s->state.version=(ulong) time((time_t*) 0);
  VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
  VOID(my_close(info->s->kfile,MYF(MY_WME)));
  param->out_flag|=O_NEW_INDEX;			/* Data in new file */
  info->s->kfile = -1;
  VOID(my_close(new_file,MYF(MY_WME)));
  if (change_to_newfile(info->s->filename,MI_NAME_IEXT,INDEX_TMP_EXT,0,
			MYF(0)) ||
      mi_open_keyfile(info->s))
    goto err2;
  _mi_readinfo(info,F_WRLCK,0);

  info->s->kfile=new_file;
  info->state->key_file_length=param->new_file_pos;
  info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
  for (key=0 ; key < info->s->base.keys ; key++)
@@ -1473,6 +1502,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)

err:
  VOID(my_close(new_file,MYF(MY_WME)));
err2:
  VOID(my_delete(param->temp_filename,MYF(MY_WME)));
  DBUG_RETURN(-1);
} /* sort_index */
@@ -1842,7 +1872,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
      /* Only whole records */
      share->state.split=info->state->records+info->state->del;
      share->state.version=(ulong) time((time_t*) 0);
      param->out_flag|=O_NEW_DATA;		/* Data in new file */
      my_close(info->dfile,MYF(0));
      info->dfile=new_file;
      share->data_file_type=sort_info->new_data_file_type;
@@ -1909,18 +1938,34 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
    memcpy( &share->state.state, info->state, sizeof(*info->state));

err:
  got_error|= flush_blocks(param,share->kfile);
  VOID(end_io_cache(&info->rec_cache));
  if (!got_error)
  {
    /* Replace the actual file with the temporary file */
    if (new_file >= 0)
    {
      my_close(new_file,MYF(0));
      info->dfile=new_file= -1;
      if (change_to_newfile(share->filename,MI_NAME_DEXT,
			    DATA_TMP_EXT, share->base.raid_chunks,
			    (param->testflag & T_BACKUP_DATA ?
			     MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) ||
	  mi_open_datafile(info,share))
	got_error=1;
    }
  }
  if (got_error)
  {
    if (! param->error_printed)
      mi_check_print_error(param,"%d when fixing table",my_errno);
    if (new_file >= 0)
    {
      VOID(end_io_cache(&info->rec_cache));
      VOID(my_close(new_file,MYF(0)));
      VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
      VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
			  MYF(MY_WME)));
      if (info->dfile == new_file)
	info->dfile=0;
	info->dfile= -1;
    }
    mi_mark_crashed_on_repair(info);
  }
@@ -1932,7 +1977,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
  my_free(sort_info->record,MYF(MY_ALLOW_ZERO_PTR));
  my_free(sort_info->buff,MYF(MY_ALLOW_ZERO_PTR));
  VOID(end_io_cache(&param->read_cache));
  VOID(end_io_cache(&info->rec_cache));
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
  if (!got_error && (param->testflag & T_UNPACK))
  {
@@ -2440,6 +2484,7 @@ static int sort_key_write(SORT_INFO *sort_info, const void *a)
						    sort_info->key_block->
						    lastkey),
				 llbuff2));
    param->error_printed=param->retry_without_quick=1;
    if (sort_info->param->testflag & T_VERBOSE)
      _mi_print_key(stdout,sort_info->keyseg,(uchar*) a, USE_WHOLE_KEY);
    return (sort_delete_record(param));
@@ -2474,7 +2519,7 @@ static int sort_insert_key(MI_CHECK *param,
			   my_off_t prev_block)
{
  uint a_length,t_length,nod_flag;
  my_off_t filepos;
  my_off_t filepos,key_file_length;
  uchar *anc_buff,*lastkey;
  MI_KEY_PARAM s_temp;
  MI_INFO *info;
@@ -2525,9 +2570,18 @@ static int sort_insert_key(MI_CHECK *param,
  mi_putint(anc_buff,key_block->last_length,nod_flag);
  bzero((byte*) anc_buff+key_block->last_length,
	sort_info->keyinfo->block_length- key_block->last_length);
  key_file_length=info->state->key_file_length;
  if ((filepos=_mi_new(info,sort_info->keyinfo)) == HA_OFFSET_ERROR)
    return 1;
  if (my_pwrite(info->s->kfile,(byte*) anc_buff,
    DBUG_RETURN(1);

  /* If we read the page from the key cache, we have to write it back to it */
  if (key_file_length == info->state->key_file_length)
  {
    if (_mi_write_keypage(info, sort_info->keyinfo, filepos,
			  anc_buff))
      DBUG_RETURN(1);
  }
  else if (my_pwrite(info->s->kfile,(byte*) anc_buff,
		     (uint) sort_info->keyinfo->block_length,filepos,
		     param->myf_rw))
    DBUG_RETURN(1);
@@ -2607,7 +2661,7 @@ static int sort_delete_record(MI_CHECK *param)
static int flush_pending_blocks(MI_CHECK *param)
{
  uint nod_flag,length;
  my_off_t filepos;
  my_off_t filepos,key_file_length;
  MI_INFO *info;
  SORT_KEY_BLOCKS *key_block;
  SORT_INFO *sort_info= &param->sort_info;
@@ -2622,11 +2676,20 @@ static int flush_pending_blocks(MI_CHECK *param)
    length=mi_getint(key_block->buff);
    if (nod_flag)
      _mi_kpointer(info,key_block->end_pos,filepos);
    if ((filepos=_mi_new(info,sort_info->keyinfo)) == HA_OFFSET_ERROR)
      DBUG_RETURN(1);
    key_file_length=info->state->key_file_length;
    bzero((byte*) key_block->buff+length,
	  sort_info->keyinfo->block_length-length);
    if (my_pwrite(info->s->kfile,(byte*) key_block->buff,
    if ((filepos=_mi_new(info,sort_info->keyinfo)) == HA_OFFSET_ERROR)
      DBUG_RETURN(1);

    /* If we read the page from the key cache, we have to write it back */
    if (key_file_length == info->state->key_file_length)
    {
      if (_mi_write_keypage(info, sort_info->keyinfo, filepos,
			    key_block->buff))
	DBUG_RETURN(1);
    }
    else if (my_pwrite(info->s->kfile,(byte*) key_block->buff,
		       (uint) sort_info->keyinfo->block_length,filepos,
		       param->myf_rw))
      DBUG_RETURN(1);
Loading