When one does 'REPAIR TABLE', update uuid() to the current system

mysql-test/suite/maria/maria-autozerofill.result:
  Updated result
mysql-test/suite/maria/maria-autozerofill.test:
  Added test that zerofilled table should not give any warnings when table is used
mysql-test/suite/maria/maria-recovery2.result:
  More tests to make it easier to find bugs
mysql-test/suite/maria/maria-recovery2.test:
  More tests to make it easier to find bugs
storage/maria/ha_maria.cc:
  Set create_trid after repair (needed if table was moved from another system)
  Set uuid after repair (needed if table was moved from another system)
storage/maria/maria_chk.c:
  Reset share->state.create_trid if we reset share->state.create_rename_lsn.
  Make the table moveable
This commit is contained in:
Michael Widenius 2013-05-14 18:32:16 +03:00
commit d0265a632f
6 changed files with 51 additions and 7 deletions

View file

@ -1668,6 +1668,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
}
}
thd_proc_info(thd, "Saving state");
if (optimize_done && !error && !(param->testflag & T_NO_CREATE_RENAME_LSN))
{
/* Set trid (needed if the table was moved from another system) */
share->state.create_trid= trnman_get_min_safe_trid();
}
mysql_mutex_lock(&share->intern_lock);
if (!error)
{
@ -1683,6 +1688,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
*/
if (file->state != &share->state.state)
*file->state= share->state.state;
if (share->base.auto_key)
_ma_update_auto_increment_key(param, file, 1);
if (optimize_done)
@ -1690,6 +1696,9 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
UPDATE_TIME | UPDATE_OPEN_COUNT |
(local_testflag &
T_STATISTICS ? UPDATE_STAT : 0));
/* File is repaired; Mark the file as moved to this system */
(void) _ma_set_uuid(share, 0);
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST);
if (rows != file->state->records && !(param->testflag & T_VERY_SILENT))

View file

@ -1205,8 +1205,11 @@ static int maria_chk(HA_CHECK *param, char *filename)
((param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
T_ZEROFILL | T_ZEROFILL_KEEP_LSN)) !=
(T_ZEROFILL | T_ZEROFILL_KEEP_LSN)))
{
share->state.create_rename_lsn= share->state.is_of_horizon=
share->state.skip_redo_lsn= LSN_NEEDS_NEW_STATE_LSNS;
share->state.create_trid= 0;
}
}
if (!error && (param->testflag & T_REP_ANY))
{