Commit 7a17b659 authored by Monty's avatar Monty Committed by Sergei Petrunia

Don't do zerofill of Aria table if it's already zerofilled

This will speed up using tables that are already zerofilled
with aria_chk --zerofill.
parent 5bf2421e
......@@ -1618,6 +1618,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
pos=strmov(pos,"sorted index pages,");
if (!(share->state.changed & STATE_NOT_ZEROFILLED))
pos=strmov(pos,"zerofilled,");
if (test_all_bits(share->state.changed, (STATE_NOT_ZEROFILLED | STATE_HAS_LSN)))
pos=strmov(pos,"has_lsn,");
if (!(share->state.changed & STATE_NOT_MOVABLE))
pos=strmov(pos,"movable,");
if (have_control_file && (share->state.changed & STATE_MOVED))
......
......@@ -3651,28 +3651,35 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name)
{
my_bool error, reenable_logging,
my_bool error= 0, reenable_logging,
zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN);
MARIA_SHARE *share= info->s;
DBUG_ENTER("maria_zerofill");
if ((reenable_logging= share->now_transactional))
_ma_tmp_disable_logging_for_table(info, 0);
if (!(error= (maria_zerofill_index(param, info, name) ||
maria_zerofill_data(param, info, name) ||
_ma_set_uuid(info->s, 0))))
if (share->state.changed & (STATE_NOT_ZEROFILLED | (zero_lsn ? STATE_HAS_LSN : 0)))
error= (maria_zerofill_index(param, info, name) ||
maria_zerofill_data(param, info, name));
if (!error)
error= _ma_set_uuid(info->s, 0);
if (!error)
{
/*
Mark that we have done zerofill of data and index. If we zeroed pages'
LSN, table is movable.
Mark that we have done zerofill of data and index. If we zeroed the LSN
on the pages, table is movable.
*/
share->state.changed&= ~STATE_NOT_ZEROFILLED;
if (zero_lsn)
{
share->state.changed&= ~(STATE_NOT_MOVABLE | STATE_MOVED);
share->state.changed&= ~(STATE_NOT_MOVABLE | STATE_MOVED | STATE_HAS_LSN);
/* Table should get new LSNs */
share->state.create_rename_lsn= share->state.is_of_horizon=
share->state.skip_redo_lsn= LSN_NEEDS_NEW_STATE_LSNS;
}
else
share->state.changed|= STATE_HAS_LSN;
/* Ensure state is later flushed to disk, if within maria_chk */
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
......
......@@ -1063,6 +1063,7 @@ struct ha_table_option_struct
#define STATE_IN_REPAIR 1024U /* We are running repair on table */
#define STATE_CRASHED_PRINTED 2048U
#define STATE_DATA_FILE_FULL 4096U
#define STATE_HAS_LSN 8192U /* Some page still has LSN */
#define STATE_CRASHED_FLAGS (STATE_CRASHED | STATE_CRASHED_ON_REPAIR | STATE_CRASHED_PRINTED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment