Commit ba9bc33b authored by unknown's avatar unknown

merge

parents 24d1df1a 2b521320
......@@ -3074,6 +3074,16 @@ static int mark_recovery_success(void)
}
/*
Return 1 if table has changed during the current transaction
*/
bool ha_maria::is_changed() const
{
return file->state->changed;
}
static int ha_maria_init(void *p)
{
int res;
......
......@@ -139,6 +139,7 @@ class ha_maria :public handler
int repair(THD * thd, HA_CHECK_OPT * check_opt);
bool check_and_repair(THD * thd);
bool is_crashed() const;
bool is_changed() const;
bool auto_repair() const { return 1; }
int optimize(THD * thd, HA_CHECK_OPT * check_opt);
int restore(THD * thd, HA_CHECK_OPT * check_opt);
......
......@@ -116,6 +116,7 @@ int maria_delete(MARIA_HA *info,const uchar *record)
info->update= HA_STATE_CHANGED+HA_STATE_DELETED+HA_STATE_ROW_CHANGED;
share->state.changed|= (STATE_NOT_OPTIMIZED_ROWS | STATE_NOT_MOVABLE |
STATE_NOT_ZEROFILLED);
info->state->changed=1;
mi_sizestore(lastpos, info->cur_row.lastpos);
VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
......
......@@ -824,6 +824,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
VOID(my_rwlock_init(&share->mmap_lock, NULL));
share->row_is_visible= _ma_row_visible_always;
share->lock.get_status= _ma_reset_update_flag;
if (!thr_lock_inited)
{
/* Probably a single threaded program; Don't use concurrent inserts */
......
......@@ -96,6 +96,8 @@ my_bool _ma_setup_live_state(MARIA_HA *info)
pthread_mutex_unlock(&share->intern_lock);
/* The current item can't be deleted as it's the first one visible for us */
tables->state_start= tables->state_current= history->state;
tables->state_current.changed= 0;
DBUG_PRINT("info", ("records: %ld", (ulong) tables->state_start.records));
end:
......@@ -262,6 +264,7 @@ void _ma_get_status(void* param, my_bool concurrent_insert)
#endif
info->state_save= info->s->state.state;
info->state= &info->state_save;
info->state->changed= 0;
info->append_insert_at_end= concurrent_insert;
DBUG_VOID_RETURN;
}
......@@ -315,6 +318,13 @@ void _ma_copy_status(void* to, void *from)
}
void _ma_reset_update_flag(void *param)
{
MARIA_HA *info=(MARIA_HA*) param;
info->state->changed= 0;
}
/**
@brief Check if should allow concurrent inserts
......
......@@ -24,6 +24,7 @@ typedef struct st_maria_status_info
my_off_t key_file_length;
my_off_t data_file_length;
ha_checksum checksum;
my_bool changed;
} MARIA_STATUS_INFO;
......@@ -62,6 +63,7 @@ void _ma_get_status(void* param, my_bool concurrent_insert);
void _ma_update_status(void* param);
void _ma_restore_status(void *param);
void _ma_copy_status(void* to, void *from);
void _ma_reset_update_flag(void *param);
my_bool _ma_check_status(void *param);
void _ma_block_get_status(void* param, my_bool concurrent_insert);
void _ma_block_update_status(void *param);
......
......@@ -173,6 +173,7 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
*/
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | key_changed);
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
info->state->changed= 1;
/*
Every Maria function that updates Maria table must end with
......
......@@ -289,6 +289,7 @@ int maria_write(MARIA_HA *info, uchar *record)
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
HA_STATE_ROW_CHANGED);
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
info->state->changed= 1;
info->cur_row.lastpos= filepos;
VOID(_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
......
......@@ -222,7 +222,7 @@ static TrID new_trid()
static uint get_short_trid(TRN *trn)
{
int i= (int) ((global_trid_generator + (intptr)trn) * 312089 %
SHORT_TRID_MAX + 1);
SHORT_TRID_MAX) + 1;
uint res=0;
for ( ; !res ; i= 1)
......
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