Commit 9e493e91 authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

Many files:

  Modifications for query cache + trxs, fix of q.c.+ foreign keys
os0file.c:
  Use unbuffered i/o in Windows
parent a30d0261
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ dict_mem_table_create(

	table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());

	table->query_cache_inv_trx_id = ut_dulint_zero;

	UT_LIST_INIT(table->locks);
	UT_LIST_INIT(table->foreign_list);
	UT_LIST_INIT(table->referenced_list);
+18 −2
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ Created 5/7/1996 Heikki Tuuri

#include "usr0sess.h"
#include "trx0purge.h"
#include "dict0mem.h"
#include "trx0sys.h"

/* Restricts the length of search we will do in the waits-for
graph of transactions */
@@ -3416,6 +3418,7 @@ lock_release_off_kernel(
/*====================*/
	trx_t*	trx)	/* in: transaction */
{
	dict_table_t*	table;
	ulint		count;
	lock_t*		lock;

@@ -3435,6 +3438,19 @@ lock_release_off_kernel(
		} else {
			ut_ad(lock_get_type(lock) == LOCK_TABLE);

			if (lock_get_mode(lock) != LOCK_IS
			    && (trx->insert_undo || trx->update_undo)) {

				/* The trx may have modified the table.
				We block the use of the MySQL query cache
				for all currently active transactions. */

				table = lock->un_member.tab_lock.table;
			
				table->query_cache_inv_trx_id =
							trx_sys->max_trx_id;
			}

			lock_table_dequeue(lock);
		}

+18 −15
Original line number Diff line number Diff line
@@ -669,13 +669,14 @@ os_file_get_size(
		return(FALSE);
	}
	
#if SIZEOF_OFF_T > 4
	if (sizeof(off_t) > 4) {
	        *size = (ulint)(offs & 0xFFFFFFFF);
		*size_high = (ulint)(offs >> 32);
#else
	} else {
		*size = (ulint) offs;
		*size_high = 0;
#endif	
	}
	
	return(TRUE);	
#endif
}
@@ -838,16 +839,18 @@ os_file_pread(
        /* If off_t is > 4 bytes in size, then we assume we can pass a
	64-bit address */

#if SIZEOF_OFF_T > 4
        if (sizeof(off_t) > 4) {
	        offs = (off_t)offset + (((off_t)offset_high) << 32);
#else
        				
        } else {
        	offs = (off_t)offset;

        	if (offset_high > 0) {
        		fprintf(stderr,
			"InnoDB: Error: file read at offset > 4 GB\n");
		}
#endif
        }

	os_n_file_reads++;

#ifdef HAVE_PREAD
+37 −0
Original line number Diff line number Diff line
@@ -32,6 +32,23 @@ Created 4/20/1996 Heikki Tuuri
#define	ROW_INS_PREV	1
#define	ROW_INS_NEXT	2


/*********************************************************************
This prototype is copied from /mysql/sql/ha_innodb.cc.
Invalidates the MySQL query cache for the table.
NOTE that the exact prototype of this function has to be in
/innobase/row/row0ins.c! */

void
innobase_invalidate_query_cache(
/*============================*/
	trx_t*	trx,		/* in: transaction which modifies the table */
	char*	full_name,	/* in: concatenation of database name, null
				char '\0', table name; NOTE that in
				Windows this is always in LOWER CASE! */
	ulint	full_name_len);	/* in: full name length */


/*************************************************************************
Creates an insert node struct. */

@@ -386,10 +403,30 @@ row_ins_foreign_delete_or_set_null(
	upd_t*		update;
	ulint		err;
	ulint		i;
	char*		ptr;
	char		table_name_buf[1000];
	char		err_buf[1000];
	
	ut_a(thr && foreign && pcur && mtr);

	/* Since we are going to delete or update a row, we have to invalidate
	the MySQL query cache for table */

	ut_a(ut_strlen(table->name) < 998);
	
	ut_memcpy(table_name_buf, table->name, ut_strlen(table->name) + 1);

	ptr = table_name_buf;

	while (*ptr != '/') {
		ptr++;
	}

	*ptr = '\0';
	
	/* We call a function in ha_innodb.cc */
	innobase_invalidate_query_cache(thr_get_trx(thr), table_name_buf,
						ut_strlen(table->name));
	node = thr->run_node;

	ut_a(que_node_get_type(node) == QUE_NODE_UPDATE);
+2 −13
Original line number Diff line number Diff line
@@ -1186,12 +1186,7 @@ row_create_table_for_mysql(
	ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
	ut_ad(mutex_own(&(dict_sys->mutex)));
	
	/* We allow a create table also if innodb_force_recovery is used. This
        enables the user to stop a runaway rollback or a crash caused by
	a temporary table #sql... He can use the trick explained in the
	manual to rename the temporary table to rsql..., and then drop it. */

	if (srv_created_new_raw) {
	if (srv_created_new_raw || srv_force_recovery) {
		fprintf(stderr,
		"InnoDB: A new raw disk partition was initialized or\n"
		"InnoDB: innodb_force_recovery is on: we do not allow\n"
@@ -1712,13 +1707,7 @@ row_drop_table_for_mysql(
	ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
	ut_a(name != NULL);

	/* Note that we allow dropping of a table even if innodb_force_recovery
        is used. If a rollback or purge would crash because of a corrupt
        table, the user can try dropping it to avoid the crash. This is also
        a nice way to stop a runaway rollback caused by a failing big
        table import in a single transaction. */

	if (srv_created_new_raw) {
	if (srv_created_new_raw || srv_force_recovery) {
		fprintf(stderr,
		"InnoDB: A new raw disk partition was initialized or\n"
		"InnoDB: innodb_force_recovery is on: we do not allow\n"
Loading