BUG#39249 Maria:query cache returns out of date results

BUG#41098 Query Cache returns wrong result with concurent insert

BUILD/SETUP.sh:
  test build without query cache setup
BUILD/compile-pentium-debug-max-no-qc:
  test build without query cache
sql/mysql_priv.h:
  removed double declaration
storage/maria/ha_maria.cc:
  query cache invalidation fixed
storage/maria/ma_state.c:
  query cache invalidation fixed
storage/maria/maria_def.h:
  last transaction ID added
  invalidation fixed
storage/myisam/ha_myisam.cc:
  invalidation fixed
storage/myisam/mi_locking.c:
  invalidation fixed
storage/myisam/myisamdef.h:
  invalidation fixed
This commit is contained in:
unknown 2009-10-06 09:57:22 +03:00
commit 0c0e1f2e35
9 changed files with 43 additions and 3 deletions

View file

@ -28,6 +28,7 @@
#include <my_bit.h>
#include "ha_maria.h"
#include "trnman_public.h"
#include "trnman.h"
C_MODE_START
#include "maria_def.h"
@ -907,6 +908,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER)))
return (my_errno ? my_errno : -1);
file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref;
if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
VOID(maria_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0));
@ -3227,6 +3230,9 @@ my_bool ha_maria::register_query_cache_table(THD *thd, char *table_name,
*/
*engine_data= 0;
if (file->s->now_transactional && file->s->have_versioning)
return (file->trn->trid >= file->s->state.last_change_trn);
/*
If a concurrent INSERT has happened just before the currently processed
SELECT statement, the total size of the table is unknown.