diff options
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ha_maria.cc | 18 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 7dc07a971b3..52ae6dd8e2b 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2858,6 +2858,17 @@ static void reset_thd_trn(THD *thd, MARIA_HA *first_table) { next= table->trn_next; _ma_reset_trn_for_table(table); + + /* + If table has changed by this statement, invalidate it from the query + cache + */ + if (table->row_changes != table->start_row_changes) + { + table->start_row_changes= table->row_changes; + DBUG_ASSERT(table->s->chst_invalidator != NULL); + (*table->s->chst_invalidator)(table->s->data_file_name.str); + } } DBUG_VOID_RETURN; } @@ -3338,6 +3349,8 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)), THD *thd, bool all) { TRN *trn= THD_TRN; + int res; + MARIA_HA *used_instances= (MARIA_HA*) trn->used_instances; DBUG_ENTER("maria_commit"); DBUG_ASSERT(trnman_has_locked_tables(trn) == 0); @@ -3348,8 +3361,9 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)), if ((thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && !all) DBUG_RETURN(0); // end of statement - reset_thd_trn(thd, (MARIA_HA*) trn->used_instances); - DBUG_RETURN(ma_commit(trn)); // end of transaction + res= ma_commit(trn); + reset_thd_trn(thd, used_instances); + DBUG_RETURN(res); } diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 720f4e1c783..13ae2a6150a 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -657,6 +657,7 @@ struct st_maria_handler invalidator_by_filename invalidator; /* query cache invalidator */ ulonglong last_auto_increment; /* auto value at start of statement */ ulonglong row_changes; /* Incremented for each change */ + ulonglong start_row_changes; /* Row changes since start trans */ ulong this_unique; /* uniq filenumber or thread */ ulong last_unique; /* last unique number */ ulong this_loop; /* counter for this open */ |