diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 9a0a458bfe5..158fa8d0430 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -640,6 +640,7 @@ int ha_s3::open(const char *name, int mode, uint open_flags) file->dfile.big_block_size= file->s->kfile.big_block_size= file->s->bitmap.file.big_block_size= file->s->base.s3_block_size; file->s->kfile.head_blocks= file->s->base.keystart / file->s->block_size; + file->s->no_status_updates= in_alter_table == S3_NO_ALTER; } } open_args= 0; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index f8377df8350..70a1c976f46 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -6326,6 +6326,9 @@ int maria_update_state_info(HA_CHECK *param, MARIA_HA *info,uint update) MARIA_SHARE *share= info->s; DBUG_ENTER("maria_update_state_info"); + if (info->s->no_status_updates) + DBUG_RETURN(0); /* S3 readonly table */ + if (update & UPDATE_OPEN_COUNT) { share->state.open_count=0; diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 83d4f584e69..43fbfa22178 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1461,6 +1461,7 @@ int _ma_update_state_lsns_sub(MARIA_SHARE *share, LSN lsn, TrID create_trid, File file= share->kfile.file; DBUG_ENTER("_ma_update_state_lsns_sub"); DBUG_ASSERT(file >= 0); + CRASH_IF_S3_TABLE(share); if (lsn == LSN_IMPOSSIBLE) { diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c index 200a728626f..f895e66d9e0 100644 --- a/storage/maria/ma_locking.c +++ b/storage/maria/ma_locking.c @@ -303,6 +303,8 @@ int _ma_writeinfo(register MARIA_HA *info, uint operation) /* transactional tables flush their state at Checkpoint */ if (operation) { /* Two threads can't be here */ + CRASH_IF_S3_TABLE(info->s); /* S3 readonly doesn't come here */ + olderror= my_errno; /* Remember last error */ #ifdef MARIA_EXTERNAL_LOCKING @@ -446,6 +448,7 @@ int _ma_mark_file_changed_now(register MARIA_SHARE *share) */ if (!share->temporary) { + CRASH_IF_S3_TABLE(share); mi_int2store(buff,share->state.open_count); buff[2]=1; /* Mark that it's changed */ if (my_pwrite(share->kfile.file, buff, sizeof(buff), @@ -458,6 +461,7 @@ int _ma_mark_file_changed_now(register MARIA_SHARE *share) if (share->base.born_transactional && !(share->state.org_changed & STATE_NOT_MOVABLE)) { + CRASH_IF_S3_TABLE(share); /* Lock table to current installation */ if (_ma_set_uuid(share, 0) || (share->state.create_rename_lsn == LSN_NEEDS_NEW_STATE_LSNS && @@ -518,6 +522,7 @@ int _ma_decrement_open_count(MARIA_HA *info, my_bool lock_tables) /* Its not fatal even if we couldn't get the lock ! */ if (share->state.open_count > 0) { + CRASH_IF_S3_TABLE(share); share->state.open_count--; share->changed= 1; /* We have to update state */ /* @@ -548,9 +553,15 @@ void _ma_mark_file_crashed(MARIA_SHARE *share) { uchar buff[2]; DBUG_ENTER("_ma_mark_file_crashed"); + CRASH_IF_S3_TABLE(share); share->state.changed|= STATE_CRASHED; + if (share->no_status_updates) + DBUG_VOID_RETURN; /* Safety */ + mi_int2store(buff, share->state.changed); + + /* We can ignore the errors, as if the mark failed, there isn't anything else we can do; The user should already have got an error that the @@ -606,6 +617,7 @@ my_bool _ma_set_uuid(MARIA_SHARE *share, my_bool reset_uuid) bzero(buff, sizeof(buff)); uuid= buff; } + CRASH_IF_S3_TABLE(share); return (my_bool) my_pwrite(share->kfile.file, uuid, MY_UUID_SIZE, mi_uint2korr(share->state.header.base_pos), MYF(MY_NABP)); diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 59f92dd91b1..2be30a22e76 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -787,6 +787,7 @@ typedef struct st_maria_share my_bool changed, /* If changed since lock */ global_changed, /* If changed since open */ not_flushed; + my_bool no_status_updates; /* Set to 1 if S3 readonly table */ my_bool internal_table; /* Internal tmp table */ my_bool lock_key_trees; /* If we have to lock trees on read */ my_bool non_transactional_concurrent_insert; @@ -1768,3 +1769,5 @@ static inline void decrement_share_in_trans(MARIA_SHARE *share) } C_MODE_END #endif + +#define CRASH_IF_S3_TABLE(share) DBUG_ASSERT(!share->no_status_updates)