Commit 15017480 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into mysql.com:/home/dlenev/src/mysql-4.0-bg7297

parents 1ffd688a 4ba981e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.0.23)
AM_INIT_AUTOMAKE(mysql, 4.0.24)
AM_CONFIG_HEADER(config.h)

PROTOCOL_VERSION=10
+8 −6
Original line number Diff line number Diff line
@@ -1195,6 +1195,7 @@ os_file_pread(
	return(n_bytes);
#else
	{
	off_t	ret_offset;
	ssize_t	ret;
	ulint	i;

@@ -1203,12 +1204,12 @@ os_file_pread(
	
	os_mutex_enter(os_file_seek_mutexes[i]);

	ret = lseek(file, offs, 0);
	ret_offset = lseek(file, offs, SEEK_SET);

	if (ret < 0) {
	if (ret_offset < 0) {
		os_mutex_exit(os_file_seek_mutexes[i]);

		return(ret);
		return(-1);
	}
	
	ret = read(file, buf, (ssize_t)n);
@@ -1281,6 +1282,7 @@ os_file_pwrite(
        return(ret);
#else
	{
	off_t	ret_offset;
	ulint	i;

	/* Protect the seek / write operation with a mutex */
@@ -1288,12 +1290,12 @@ os_file_pwrite(
	
	os_mutex_enter(os_file_seek_mutexes[i]);

	ret = lseek(file, offs, 0);
	ret_offset = lseek(file, offs, SEEK_SET);

	if (ret < 0) {
	if (ret_offset < 0) {
		os_mutex_exit(os_file_seek_mutexes[i]);

		return(ret);
		return(-1);
	}
	
	ret = write(file, buf, (ssize_t)n);
+26 −0
Original line number Diff line number Diff line
@@ -1373,8 +1373,34 @@ row_ins_check_foreign_constraints(
				row_mysql_freeze_data_dictionary(trx);
			}

			if (foreign->referenced_table) {
				mutex_enter(&(dict_sys->mutex));

				(foreign->referenced_table
					->n_foreign_key_checks_running)++;

				mutex_exit(&(dict_sys->mutex));
			}

			/* NOTE that if the thread ends up waiting for a lock
			we will release dict_operation_lock temporarily!
			But the counter on the table protects the referenced
			table from being dropped while the check is running. */

			err = row_ins_check_foreign_constraint(TRUE, foreign,
						table, entry, thr);

			if (foreign->referenced_table) {
				mutex_enter(&(dict_sys->mutex));

				ut_a(foreign->referenced_table
					->n_foreign_key_checks_running > 0);
				(foreign->referenced_table
					->n_foreign_key_checks_running)--;

				mutex_exit(&(dict_sys->mutex));
			}

			if (got_s_lock) {
				row_mysql_unfreeze_data_dictionary(trx);
			}
+77 −39
Original line number Diff line number Diff line
@@ -1761,21 +1761,20 @@ row_drop_table_for_mysql_in_background(

	trx = trx_allocate_for_background();

	/* If the original transaction was dropping a table referenced by
	foreign keys, we must set the following to be able to drop the
	table: */

	trx->check_foreigns = FALSE;

/*	fputs("InnoDB: Error: Dropping table ", stderr);
	ut_print_name(stderr, name);
	fputs(" in background drop list\n", stderr); */

  	/* Drop the table in InnoDB */
  	/* Try to drop the table in InnoDB */

  	error = row_drop_table_for_mysql(name, trx, FALSE);
  	
	if (error != DB_SUCCESS) {
		ut_print_timestamp(stderr);
		fputs("  InnoDB: Error: Dropping table ", stderr);
		ut_print_name(stderr, name);
		fputs(" in background drop list failed\n", stderr);
	}
  	
	/* Flush the log to reduce probability that the .frm files and
	the InnoDB data dictionary get out-of-sync if the user runs
	with innodb_flush_log_at_trx_commit = 0 */
@@ -1786,7 +1785,7 @@ row_drop_table_for_mysql_in_background(

  	trx_free_for_background(trx);

	return(DB_SUCCESS);
	return(error);
}

/*************************************************************************
@@ -1820,6 +1819,7 @@ row_drop_tables_for_mysql_in_background(void)
	mutex_exit(&kernel_mutex);

	if (drop == NULL) {
		/* All tables dropped */

		return(n_tables + n_tables_dropped);
	}
@@ -1835,16 +1835,16 @@ row_drop_tables_for_mysql_in_background(void)
	        goto already_dropped;
	}
							
	if (table->n_mysql_handles_opened > 0
				|| table->n_foreign_key_checks_running > 0) {
	if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
							drop->table_name)) {
		/* If the DROP fails for some table, we return, and let the
		main thread retry later */

		return(n_tables + n_tables_dropped);
	}

	n_tables_dropped++;

	row_drop_table_for_mysql_in_background(drop->table_name);

already_dropped:
	mutex_enter(&kernel_mutex);

@@ -1887,21 +1887,21 @@ row_get_background_drop_list_len_low(void)
}

/*************************************************************************
Adds a table to the list of tables which the master thread drops in
background. We need this on Unix because in ALTER TABLE MySQL may call
drop table even if the table has running queries on it. */
If a table is not yet in the drop list, adds the table to the list of tables
which the master thread drops in background. We need this on Unix because in
ALTER TABLE MySQL may call drop table even if the table has running queries on
it. Also, if there are running foreign key checks on the table, we drop the
table lazily. */
static
void
ibool
row_add_table_to_background_drop_list(
/*==================================*/
				/* out: TRUE if the table was not yet in the
				drop list, and was added there */
	dict_table_t*	table)	/* in: table */
{
	row_mysql_drop_t*	drop;
	
	drop = mem_alloc(sizeof(row_mysql_drop_t));

	drop->table_name = mem_strdup(table->name);

	mutex_enter(&kernel_mutex);

	if (!row_mysql_drop_list_inited) {
@@ -1910,6 +1910,25 @@ row_add_table_to_background_drop_list(
		row_mysql_drop_list_inited = TRUE;
	}
	
	/* Look if the table already is in the drop list */
	drop = UT_LIST_GET_FIRST(row_mysql_drop_list);

	while (drop != NULL) {
		if (strcmp(drop->table_name, table->name) == 0) {
			/* Already in the list */
			
			mutex_exit(&kernel_mutex);

			return(FALSE);
		}

		drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop);
	}

	drop = mem_alloc(sizeof(row_mysql_drop_t));

	drop->table_name = mem_strdup(table->name);

	UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
	
/*	fputs("InnoDB: Adding table ", stderr);
@@ -1917,6 +1936,8 @@ row_add_table_to_background_drop_list(
	fputs(" to background drop list\n", stderr); */

	mutex_exit(&kernel_mutex);

	return(TRUE);
}

/*************************************************************************
@@ -2151,25 +2172,37 @@ row_drop_table_for_mysql(
	}

	if (table->n_mysql_handles_opened > 0) {
		ibool	added;

		added = row_add_table_to_background_drop_list(table);

	        if (added) {
			ut_print_timestamp(stderr);
		fputs("	 InnoDB: Warning: MySQL is trying to drop table ",
			stderr);
fputs("	 InnoDB: Warning: MySQL is trying to drop table ", stderr);
			ut_print_name(stderr, table->name);
			fputs("\n"
"InnoDB: though there are still open handles to it.\n"
"InnoDB: Adding the table to the background drop queue.\n",
			stderr);
			
		row_add_table_to_background_drop_list(table);
			/* We return DB_SUCCESS to MySQL though the drop will
			happen lazily later */

			err = DB_SUCCESS;
		} else {
			/* The table is already in the background drop list */
			err = DB_ERROR;
		}

		goto funct_exit;
	}

	if (table->n_foreign_key_checks_running > 0) {
		ibool	added;

		added = row_add_table_to_background_drop_list(table);

		if (added) {
	        	ut_print_timestamp(stderr);
fputs("	 InnoDB: You are trying to drop table ", stderr);
		ut_print_name(stderr, table->name);
@@ -2178,9 +2211,14 @@ row_drop_table_for_mysql(
"InnoDB: Adding the table to the background drop queue.\n",
			stderr);

		row_add_table_to_background_drop_list(table);
			/* We return DB_SUCCESS to MySQL though the drop will
			happen lazily later */

			err = DB_SUCCESS;
		} else {
			/* The table is already in the background drop list */
			err = DB_ERROR;
		}

		goto funct_exit;
	}
+11 −3
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
# Sligtly updated by Monty
# Cleaned up again by Matt
# Fixed by Sergei
# List of failed cases (--force) backported from 4.1 by Joerg
# :-)

#++
@@ -202,6 +203,7 @@ MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
MYSQL_MANAGER_USER=root
NO_SLAVE=0
USER_TEST=
FAILED_CASES=

EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
@@ -1333,7 +1335,7 @@ run_testcase ()
	show_failed_diff $result_file
	$ECHO
	if [ x$FORCE != x1 ] ; then
	 $ECHO "Aborting. To continue, re-run with '--force'."
	 $ECHO "Aborting: $tname failed. To continue, re-run with '--force'."
	 $ECHO
         if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
	 then
@@ -1342,7 +1344,7 @@ run_testcase ()
   	 fi
	 exit 1
	fi

	FAILED_CASES="$FAILED_CASES $tname"
        if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
	then
	  mysql_restart
@@ -1485,4 +1487,10 @@ $ECHO
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
[ "$DO_GPROF" ] && gprof_collect # collect coverage information

if [ $TOT_FAIL -ne 0 ]; then
  $ECHO "mysql-test-run: *** Failing the test(s):$FAILED_CASES"
  $ECHO
  exit 1
else
  exit 0
fi
Loading