summaryrefslogtreecommitdiff
path: root/innobase/row/row0sel.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-09-20 05:11:08 +0300
committerunknown <heikki@hundin.mysql.fi>2002-09-20 05:11:08 +0300
commitb8cfcf768ef493218b3917caf179c90c00632452 (patch)
tree83fa0b9921ca4d827b9a72cf561764aaaa2e4296 /innobase/row/row0sel.c
parentebf518bc45b19cc0118422773c99d16b84420518 (diff)
downloadmariadb-git-b8cfcf768ef493218b3917caf179c90c00632452.tar.gz
Many files:
Modifications for query cache + trxs, fix of q.c.+ foreign keys os0file.c: Use unbuffered i/o in Windows innobase/dict/dict0mem.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys innobase/os/os0file.c: Use unbuffered i/o in Windows innobase/lock/lock0lock.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys innobase/row/row0ins.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys innobase/row/row0mysql.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys innobase/row/row0sel.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys innobase/srv/srv0srv.c: Modifications for query cache + trxs, fix of q.c.+ foreign keys sql/ha_innodb.h: Modifications for query cache + trxs, fix of q.c.+ foreign keys sql/ha_innodb.cc: Modifications for query cache + trxs, fix of q.c.+ foreign keys
Diffstat (limited to 'innobase/row/row0sel.c')
-rw-r--r--innobase/row/row0sel.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index f3dced15fdf..4af04251996 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -30,6 +30,7 @@ Created 12/19/1997 Heikki Tuuri
#include "pars0sym.h"
#include "pars0pars.h"
#include "row0mysql.h"
+#include "read0read.h"
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
#define SEL_MAX_N_PREFETCH 16
@@ -3115,3 +3116,56 @@ normal_return:
return(ret);
}
+
+/***********************************************************************
+Checks if MySQL at the moment is allowed for this table to retrieve a
+consistent read result, or store it to the query cache. */
+
+ibool
+row_search_check_if_query_cache_permitted(
+/*======================================*/
+ /* out: TRUE if storing or retrieving from
+ the query cache is permitted */
+ trx_t* trx, /* in: transaction object */
+ char* norm_name) /* in: concatenation of database name, '/'
+ char, table name */
+{
+ dict_table_t* table;
+ ibool ret = FALSE;
+
+ table = dict_table_get(norm_name, trx);
+
+ if (table == NULL) {
+
+ return(FALSE);
+ }
+
+ mutex_enter(&kernel_mutex);
+
+ /* Start the transaction if it is not started yet */
+
+ trx_start_if_not_started_low(trx);
+
+ /* If there are locks on the table or some trx has invalidated the
+ cache up to our trx id, then ret = FALSE.
+ We do not check what type locks there are on the table, though only
+ IX type locks actually would require ret = FALSE. */
+
+ if (UT_LIST_GET_LEN(table->locks) == 0
+ && ut_dulint_cmp(trx->id, table->query_cache_inv_trx_id) >= 0) {
+
+ ret = TRUE;
+
+ /* Assign a read view for the transaction if it does not yet
+ have one */
+
+ if (!trx->read_view) {
+ trx->read_view = read_view_open_now(trx,
+ trx->read_view_heap);
+ }
+ }
+
+ mutex_exit(&kernel_mutex);
+
+ return(ret);
+}