Commit 4b2f5cce authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

row0vers.c:

  Add diagnostic code to track a probable table corruption reported by a user
parent 9171b5e4
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ row_vers_impl_x_locked_off_kernel(
	ibool		rec_del;
	ulint		err;
	mtr_t		mtr;
	char            err_buf[1000];
	
	ut_ad(mutex_own(&kernel_mutex));
	ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
@@ -74,7 +75,26 @@ row_vers_impl_x_locked_off_kernel(

	clust_rec = row_get_clust_rec(BTR_SEARCH_LEAF, rec, index,
							&clust_index, &mtr);
	ut_a(clust_rec);
	if (!clust_rec) {
	        rec_sprintf(err_buf, 900, rec);

	        ut_print_timestamp(stderr);
	        fprintf(stderr,
"  InnoDB: Error: cannot find the clustered index record\n"
"InnoDB: for a secondary index record in table %s index %s.\n"
"InnoDB: Secondary index record %s.\n"
"InnoDB: The table is probably corrupt. Please run CHECK TABLE on it.\n"
"InnoDB: You can try to repair the table by dump + drop + reimport.\n"
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n",
		  index->table_name, index->name, err_buf);
	        mutex_enter(&kernel_mutex);
	        mtr_commit(&mtr);

	        /* We assume there is no lock on the record, though this
	        is not certain because the table is apparently corrupt */

	        return(NULL);
	}

	trx_id = row_get_rec_trx_id(clust_rec, clust_index);