diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/maria/ma_close.c | 19 | ||||
-rw-r--r-- | storage/maria/ma_open.c | 9 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 2 | ||||
-rw-r--r-- | storage/maria/trnman.c | 2 |
4 files changed, 28 insertions, 4 deletions
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c index a29fe607d6e..973adf2b91e 100644 --- a/storage/maria/ma_close.c +++ b/storage/maria/ma_close.c @@ -36,6 +36,21 @@ int maria_close(register MARIA_HA *info) /* Check that we have unlocked key delete-links properly */ DBUG_ASSERT(info->key_del_used == 0); + if (share->reopen == 1) + { + /* + If we are going to close the file, flush page cache without + a global mutex + */ + if (flush_pagecache_blocks(share->pagecache, &share->kfile, + ((share->temporary || share->deleting) ? + FLUSH_IGNORE_CHANGED : + FLUSH_RELEASE))) + error= my_errno; + } + + + /* Ensure no one can open this file while we are closing it */ mysql_mutex_lock(&THR_LOCK_maria); if (info->lock_type == F_EXTRA_LCK) info->lock_type=F_UNLCK; /* HA_EXTRA_NO_USER_CHANGE */ @@ -81,6 +96,10 @@ int maria_close(register MARIA_HA *info) if ((*share->once_end)(share)) error= my_errno; + /* + Extra flush, just in case someone opened and closed the file + since the start of the function (very unlikely) + */ if (flush_pagecache_blocks(share->pagecache, &share->kfile, ((share->temporary || share->deleting) ? FLUSH_IGNORE_CHANGED : diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index 64717f7d89d..ef7d17b5c76 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -860,7 +860,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) { /* Move history from hash to share. This is safe to do as we - don't have a lock on share->intern_lock. + know we are the only one that is using the share. */ share->state_history= _ma_remove_not_visible_states(history->state_history, 0, 0); @@ -1352,6 +1352,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) uint i, keys= (uint) state->header.keys; size_t res; DBUG_ENTER("_ma_state_info_write_sub"); + DBUG_PRINT("info", ("Records: %lld", state->state.records)); memcpy(ptr,&state->header,sizeof(state->header)); ptr+=sizeof(state->header); @@ -1423,6 +1424,8 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state) { uint i,keys,key_parts; + DBUG_ENTER("_ma_state_info_read"); + memcpy(&state->header,ptr, sizeof(state->header)); ptr+= sizeof(state->header); keys= (uint) state->header.keys; @@ -1471,7 +1474,9 @@ static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state) float8get(state->rec_per_key_part[i], ptr); ptr+= 8; state->nulls_per_key_part[i]= mi_uint4korr(ptr); ptr+= 4; } - return ptr; + + DBUG_PRINT("info", ("Records: %lld", state->state.records)); + DBUG_RETURN(ptr); } diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 25c09e8de33..a2a19924a73 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -749,7 +749,7 @@ struct st_maria_handler @note cast of newtrn is because %p of NULL gives warning (NULL is int) */ #define _ma_set_trn_for_table(tbl, newtrn) do { \ - DBUG_PRINT("info",("table: %p trn: %p -> %p", \ + DBUG_PRINT("info",("table: %p trn: %p -> %p", \ (tbl), (tbl)->trn, (void *)(newtrn))); \ (tbl)->trn= (newtrn); \ } while (0) diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 0734e12cbe4..2e27d8a4dc5 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -413,7 +413,7 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit) TRN *free_me= 0; LF_PINS *pins= trn->pins; DBUG_ENTER("trnman_end_trn"); - DBUG_PRINT("enter", ("trn=0x%lx commit=%d", (ulong) trn, commit)); + DBUG_PRINT("enter", ("trn: %p commit: %d", trn, commit)); /* if a rollback, all UNDO records should have been executed */ DBUG_ASSERT(commit || trn->undo_lsn == 0); |