summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-06-27 17:22:23 +0300
committerMichael Widenius <monty@askmonty.org>2012-06-27 17:22:23 +0300
commitaa67a198e8a29f2fdae84846cc1d8e74c2d47a83 (patch)
tree47719240f2509a3fa373f54852b54d552ac6e844 /storage/maria
parent9ebda8764d2e94096924c0a0181f5773d836114a (diff)
parent072097174c8b91299fe74a3cd7c5248e6e3cfc57 (diff)
downloadmariadb-git-aa67a198e8a29f2fdae84846cc1d8e74c2d47a83.tar.gz
automatic merge with 5.5
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ma_close.c31
-rw-r--r--storage/maria/ma_delete_table.c12
-rw-r--r--storage/maria/ma_info.c1
-rw-r--r--storage/maria/ma_open.c4
4 files changed, 28 insertions, 20 deletions
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index 973adf2b91e..c355f1f1def 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -195,20 +195,27 @@ int maria_close(register MARIA_HA *info)
if (share->state_history)
{
- MARIA_STATE_HISTORY_CLOSED *history;
- /*
- Here we ignore the unlikely case that we don't have memory to
- store the state. In the worst case what happens is that any transaction
- that tries to access this table will get a wrong status information.
- */
- if ((history= (MARIA_STATE_HISTORY_CLOSED *)
- my_malloc(sizeof(*history), MYF(MY_WME))))
+ if (share->state_history->trid) /* If not visible for all */
{
- history->create_rename_lsn= share->state.create_rename_lsn;
- history->state_history= share->state_history;
- if (my_hash_insert(&maria_stored_state, (uchar*) history))
- my_free(history);
+ MARIA_STATE_HISTORY_CLOSED *history;
+ DBUG_PRINT("info", ("Storing state history"));
+ /*
+ Here we ignore the unlikely case that we don't have memory
+ to store the state. In the worst case what happens is that
+ any transaction that tries to access this table will get a
+ wrong status information.
+ */
+ if ((history= (MARIA_STATE_HISTORY_CLOSED *)
+ my_malloc(sizeof(*history), MYF(MY_WME))))
+ {
+ history->create_rename_lsn= share->state.create_rename_lsn;
+ history->state_history= share->state_history;
+ if (my_hash_insert(&maria_stored_state, (uchar*) history))
+ my_free(history);
+ }
}
+ else
+ my_free(share->state_history);
/* Marker for concurrent checkpoint */
share->state_history= 0;
}
diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c
index 9e91638fa27..09d5cde5ad0 100644
--- a/storage/maria/ma_delete_table.c
+++ b/storage/maria/ma_delete_table.c
@@ -38,14 +38,8 @@ int maria_delete_table(const char *name)
/** @todo LOCK take X-lock on table */
/*
We need to know if this table is transactional.
- When built with RAID support, we also need to determine if this table
- makes use of the raid feature. If yes, we need to remove all raid
- chunks. This is done with my_raid_delete(). Unfortunately it is
- necessary to open the table just to check this. We use
- 'open_for_repair' to be able to open even a crashed table. If even
- this open fails, we assume no raid configuration for this table
- and try to remove the normal data file only. This may however
- leave the raid chunks behind.
+ Unfortunately it is necessary to open the table just to check this. We use
+ 'open_for_repair' to be able to open even a crashed table.
*/
if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
{
@@ -56,6 +50,8 @@ int maria_delete_table(const char *name)
sync_dir= (info->s->now_transactional && !info->s->temporary &&
!maria_in_recovery) ?
MY_SYNC_DIR : 0;
+ /* Remove history for table */
+ _ma_reset_state(info);
maria_close(info);
}
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 97b5b8b7f7b..341ea147785 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -42,6 +42,7 @@ int maria_status(MARIA_HA *info, register MARIA_INFO *x, uint flag)
MY_STAT state;
MARIA_SHARE *share= info->s;
DBUG_ENTER("maria_status");
+ DBUG_PRINT("info", ("records: %lld", info->state->records));
x->recpos= info->cur_row.lastpos;
if (flag == HA_STATUS_POS)
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index a526c0d4276..5f90f61c786 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -866,6 +866,9 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
_ma_remove_not_visible_states(history->state_history, 0, 0);
history->state_history= 0;
(void) my_hash_delete(&maria_stored_state, (uchar*) history);
+ DBUG_PRINT("info", ("Reading state history. trid: %lu records: %lld",
+ (ulong) share->state_history->trid,
+ share->state_history->state.records));
}
else
{
@@ -988,6 +991,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
mysql_mutex_unlock(&THR_LOCK_maria);
m_info->open_flags= open_flags;
+ DBUG_PRINT("exit", ("table: %p name: %s",m_info, name));
DBUG_RETURN(m_info);
err: