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

Fix for LOAD DATA FROM MASTER when using tables with checksum

Fixed some wrong test cases
parent db61a345
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -46853,6 +46853,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.43
@itemize @bullet
@item
Fixed bug in @code{LOAD DATA FROM MASTER} when using table with
@code{CHECKSUM=1}.
@item
Added unique error message when one gets a DEADLOCK during a transaction with
BDB tables.
@item
+15 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

/* Return error-text for system error messages and nisam messages */

#define PERROR_VERSION "2.6"
#define PERROR_VERSION "2.7"

#include <global.h>
#include <my_sys.h>
@@ -71,6 +71,18 @@ static HA_ERRORS ha_errlist[]=
  { 147,"Lock table is full;  Restart program with a larger locktable"},
  { 148,"Updates are not allowed under a read only transactions"},
  { 149,"Lock deadlock; Retry transaction"},
  { -30999, "DB_INCOMPLETE: Sync didn't finish"},
  { -30998, "DB_KEYEMPTY: Key/data deleted or never created"},
  { -30997, "DB_KEYEXIST: The key/data pair already exists"},
  { -30996, "DB_LOCK_DEADLOCK: Deadlock"},
  { -30995, "DB_LOCK_NOTGRANTED: Lock unavailable"},
  { -30994, "DB_NOSERVER: Server panic return"},
  { -30993, "DB_NOSERVER_HOME: Bad home sent to server"},
  { -30992, "DB_NOSERVER_ID: Bad ID sent to server"},
  { -30991, "DB_NOTFOUND: Key/data pair not found (EOF)"},
  { -30990, "DB_OLD_VERSION: Out-of-date version"},
  { -30989, "DB_RUNRECOVERY: Panic return"},
  { -30988, "DB_VERIFY_BAD: Verify failed; bad format"},
  { 0,NullS },
};

@@ -85,7 +97,8 @@ static void usage(void)
{
  print_version();
  puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
  printf("Print a description for a system error code or a error code from\na MyISAM/ISAM table handler\n");
  printf("Print a description for a system error code or a error code from\na MyISAM/ISAM/BDB table handler.\n");
  printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
  printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
  printf("\n\
   -?, --help     Displays this help and exits.\n\
+2 −1
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
#define T_SAFE_REPAIR		T_CREATE_MISSING_KEYS*2
#define T_AUTO_REPAIR   	T_SAFE_REPAIR*2
#define T_BACKUP_DATA		T_AUTO_REPAIR*2
#define T_CALC_CHECKSUM		T_BACKUP_DATA*2

#define O_NEW_INDEX	1		/* Bits set in out_flag */
#define O_NEW_DATA	2
@@ -324,7 +325,7 @@ typedef struct st_mi_check_param
  uint testflag;
  uint8 language;
  my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
  my_bool retry_repair,retry_without_quick, force_sort;
  my_bool retry_repair,retry_without_quick, force_sort, calc_checksum;
  char temp_filename[FN_REFLEN],*isam_file_name,*tmpdir;
  int tmpfile_createflag;
  myf myf_rw;
+31 −2
Original line number Diff line number Diff line
@@ -1191,8 +1191,12 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
  del=info->state->del;
  info->state->records=info->state->del=share->state.split=0;
  info->state->empty=0;
  param->glob_crc=0;
  if (param->testflag & T_CALC_CHECKSUM)
    param->calc_checksum=1;
  if (!rep_quick)
    share->state.checksum=0;

  info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
  for (i=0 ; i < info->s->base.keys ; i++)
    share->state.key_root[i]= HA_OFFSET_ERROR;
@@ -1284,7 +1288,14 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
    share->state.version=(ulong) time((time_t*) 0);	/* Force reopen */
  }
  else
  {
    info->state->data_file_length=sort_info->max_pos;
    if (param->testflag & T_CALC_CHECKSUM)
    {
      DBUG_PRINT("QQ",("set_checksum"));
      share->state.checksum=param->glob_crc;
    }
  }

  if (!(param->testflag & T_SILENT))
  {
@@ -1867,6 +1878,9 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
  sort_param.sort_info=sort_info;

  del=info->state->del;
  param->glob_crc=0;
  if (param->testflag & T_CALC_CHECKSUM)
    param->calc_checksum=1;
  if (! rep_quick)
    share->state.checksum=0;

@@ -1912,6 +1926,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
      param->retry_repair=1;
      goto err;
    }
    param->calc_checksum=0;			/* No need to calc glob_crc */

    /* Set for next loop */
    sort_param.max_records=sort_info->max_records=
@@ -1987,6 +2002,9 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
			       "Can't change size of datafile,  error: %d",
			       my_errno);
  }
  else if (param->testflag & T_CALC_CHECKSUM)
    share->state.checksum=param->glob_crc;

  if (my_chsize(share->kfile,info->state->key_file_length,MYF(0)))
    mi_check_print_warning(param,
			   "Can't change size of indexfile, error: %d",
@@ -2116,7 +2134,14 @@ static int sort_get_next_record(SORT_INFO *sort_info)
      sort_info->max_pos=(sort_info->pos+=share->base.pack_reclength);
      share->state.split++;
      if (*sort_info->record)
      {
	if (param->calc_checksum)
	{
	  DBUG_PRINT("QQ",("calc_checksum"));
	  param->glob_crc+= mi_static_checksum(info,sort_info->record);
	}
	DBUG_RETURN(0);
      }
      if (!sort_info->fix_datafile)
      {
	info->state->del++;
@@ -2348,10 +2373,10 @@ static int sort_get_next_record(SORT_INFO *sort_info)
      {
	if (param->read_cache.error < 0)
	  DBUG_RETURN(1);
	if ((param->testflag & (T_EXTEND | T_REP)) || searching)
	{
	if (info->s->calc_checksum)
	  info->checksum=mi_checksum(info,sort_info->record);
	if ((param->testflag & (T_EXTEND | T_REP)) || searching)
	{
	  if (_mi_rec_check(info, sort_info->record))
	  {
	    mi_check_print_info(param,"Found wrong packed record at %s",
@@ -2359,6 +2384,8 @@ static int sort_get_next_record(SORT_INFO *sort_info)
	    goto try_next;
	  }
	}
	if (param->calc_checksum)
	  param->glob_crc+= info->checksum;
	DBUG_RETURN(0);
      }
      if (!searching)
@@ -2421,6 +2448,8 @@ static int sort_get_next_record(SORT_INFO *sort_info)
			 block_info.rec_len);
      share->state.split++;
      info->packed_length=block_info.rec_len;
      if (param->calc_checksum)
	param->glob_crc+= info->checksum;
      DBUG_RETURN(0);
    }
  }
+2 −2
Original line number Diff line number Diff line
@@ -210,9 +210,9 @@ while test $# -gt 0; do
      ;;
    --debug)
      EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
       --debug=d:t:O,$MYSQL_TEST_DIR/var/log/master.trace"
       --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace"
      EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
       --debug=d:t:O,$MYSQL_TEST_DIR/var/log/slave.trace"
       --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/slave.trace"
      EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
      ;;
    -- )  shift; break ;;
Loading