diff options
author | unknown <guilhem@gbichot4.local> | 2008-02-11 16:36:34 +0100 |
---|---|---|
committer | unknown <guilhem@gbichot4.local> | 2008-02-11 16:36:34 +0100 |
commit | d2a3bf33a7602e294fdbb348083c9b010c72999f (patch) | |
tree | b5ed32ad7a0fccf53d66ca79928e67f35f2514d1 /storage/maria/ma_check.c | |
parent | 5fa560e995a01c87bd7d20264c85c2ec66c19748 (diff) | |
download | mariadb-git-d2a3bf33a7602e294fdbb348083c9b010c72999f.tar.gz |
A new option for maria_chk: --zerofill-keep-lsn. This will be used
by ma_test_recovery.pl when it happens that Recovery does not recreate
pages exactly as they were at first run: this option will help us
verify that the differences are in unimportant page pieces (those pieces
will be zeroed by --zerofill-keep-lsn, but not the important LSNs).
include/myisamchk.h:
new zerofill flag for maria_chk
storage/maria/ma_check.c:
If T_ZEROFILL_KEEP_LSN, we don't zero out LSNs of data/index pages.
Then the table is not movable. We still mark it zerofilled, it helps
to know what was last done to the table.
storage/maria/maria_chk.c:
New option --zerofill-keep-lsn
Diffstat (limited to 'storage/maria/ma_check.c')
-rw-r--r-- | storage/maria/ma_check.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index b9873b37db5..7921af857be 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2952,7 +2952,8 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, my_off_t pos; my_off_t key_file_length= share->state.state.key_file_length; uint block_size= share->block_size; - my_bool transactional= share->base.born_transactional; + my_bool zero_lsn= share->base.born_transactional && + !(param->testflag & T_ZEROFILL_KEEP_LSN); DBUG_ENTER("maria_zerofill_index"); if (!(param->testflag & T_SILENT)) @@ -2979,7 +2980,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, llstr(pos, llbuff), my_errno); DBUG_RETURN(1); } - if (transactional) + if (zero_lsn) bzero(buff, LSN_SIZE); length= _ma_get_page_used(share, buff); /* Skip mailformed blocks */ @@ -3021,6 +3022,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, pgcache_page_no_t page; uint block_size= share->block_size; MARIA_FILE_BITMAP *bitmap= &share->bitmap; + my_bool zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN); DBUG_ENTER("maria_zerofill_data"); /* This works only with BLOCK_RECORD files */ @@ -3055,16 +3057,23 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, page_type= buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK; switch ((enum en_page_type) page_type) { case UNALLOCATED_PAGE: - bzero(buff, block_size); + if (zero_lsn) + bzero(buff, block_size); + else + bzero(buff + LSN_SIZE, block_size - LSN_SIZE); break; case BLOB_PAGE: if (_ma_bitmap_get_page_bits(info, bitmap, page) == 0) { /* Unallocated page */ - bzero(buff, block_size); + if (zero_lsn) + bzero(buff, block_size); + else + bzero(buff + LSN_SIZE, block_size - LSN_SIZE); } else - bzero(buff, LSN_SIZE); + if (zero_lsn) + bzero(buff, LSN_SIZE); break; case HEAD_PAGE: case TAIL_PAGE: @@ -3073,7 +3082,8 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, uint offset, dir_start; uchar *dir; - bzero(buff, LSN_SIZE); + if (zero_lsn) + bzero(buff, LSN_SIZE); if (max_entry != 0) { dir= dir_entry_pos(buff, block_size, max_entry - 1); @@ -3123,7 +3133,8 @@ err: int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name) { - my_bool error, reenable_logging; + my_bool error, reenable_logging, + zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN); DBUG_ENTER("maria_zerofill"); if ((reenable_logging= info->s->now_transactional)) _ma_tmp_disable_logging_for_table(info, 0); @@ -3132,11 +3143,12 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name) _ma_set_uuid(info, 0)))) { /* - Mark that table is movable and that we have done zerofill of data and - index + Mark that we have done zerofill of data and index. If we zeroed pages' + LSN, table is movable. */ - info->s->state.changed&= ~(STATE_NOT_ZEROFILLED | STATE_NOT_MOVABLE | - STATE_MOVED); + info->s->state.changed&= ~STATE_NOT_ZEROFILLED; + if (zero_lsn) + info->s->state.changed&= ~(STATE_NOT_MOVABLE | STATE_MOVED); /* Ensure state are flushed to disk */ info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); } |