Commit 2dd7ab29 authored by unknown's avatar unknown
Browse files

Merge lgrimmer@build.mysql.com:/home/bk/mysql-4.0

into mysql.com:/space/my/mysql-4.0

parents d758fc8e c7a29120
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -643,6 +643,7 @@ dict_init(void)
	rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);

	dict_foreign_err_file = os_file_create_tmpfile();
	ut_a(dict_foreign_err_file);
	mutex_create(&dict_foreign_err_mutex);
	mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
}
+2 −2
Original line number Diff line number Diff line
@@ -134,12 +134,12 @@ void
os_io_init_simple(void);
/*===================*/
/***************************************************************************
Creates a temporary file. In case of error, causes abnormal termination. */
Creates a temporary file. */

FILE*
os_file_create_tmpfile(void);
/*========================*/
				/* out: temporary file handle (never NULL) */
			/* out: temporary file handle, or NULL on error */
/********************************************************************
A simple function to open or create a file. */

+2 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ extern lint srv_conc_n_threads;

extern ibool	srv_fast_shutdown;

extern ibool	srv_innodb_status;

extern ibool	srv_use_doublewrite_buf;

extern ibool    srv_set_thread_priorities;
+1 −0
Original line number Diff line number Diff line
@@ -509,6 +509,7 @@ lock_sys_create(
	/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */

	lock_latest_err_file = os_file_create_tmpfile();
	ut_a(lock_latest_err_file);
}

/*************************************************************************
+58 −8
Original line number Diff line number Diff line
@@ -371,22 +371,72 @@ os_io_init_simple(void)
	}
}

#ifndef UNIV_HOTBACKUP
/*************************************************************************
Creates a temporary file. This function is defined in ha_innodb.cc. */

int
innobase_mysql_tmpfile(void);
/*========================*/
			/* out: temporary file descriptor, or < 0 on error */
#endif /* !UNIV_HOTBACKUP */

/***************************************************************************
Creates a temporary file. In case of error, causes abnormal termination. */
Creates a temporary file. */

FILE*
os_file_create_tmpfile(void)
/*========================*/
				/* out: temporary file handle (never NULL) */
			/* out: temporary file handle, or NULL on error */
{
	FILE*	file	= tmpfile();
	if (file == NULL) {
	FILE*	file	= NULL;
	int	fd	= -1;
#ifdef UNIV_HOTBACKUP
	int	tries;
	for (tries = 10; tries--; ) {
		char*	name = tempnam(fil_path_to_mysql_datadir, "ib");
		if (!name) {
			break;
		}

		fd = open(name,
# ifdef __WIN__
			O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
# endif /* __WIN__ */
			O_CREAT | O_EXCL | O_RDWR,
			S_IREAD | S_IWRITE);
		if (fd >= 0) {
# ifndef __WIN__
			unlink(name);
# endif /* !__WIN__ */
			free(name);
			break;
		}

		ut_print_timestamp(stderr);
		fputs("  InnoDB: Error: unable to create temporary file\n",
			stderr);
		os_file_handle_error(NULL, "tmpfile");
		ut_error;
		fprintf(stderr, "  InnoDB: Warning: "
			"unable to create temporary file %s, retrying\n",
			name);
		free(name);
	}
#else /* UNIV_HOTBACKUP */
	fd = innobase_mysql_tmpfile();
#endif /* UNIV_HOTBACKUP */

	if (fd >= 0) {
		file = fdopen(fd, "w+b");
	}

	if (!file) {
		ut_print_timestamp(stderr);
		fprintf(stderr,
			"  InnoDB: Error: unable to create temporary file;"
			" errno: %d\n", errno);
		if (fd >= 0) {
			close(fd);
		}
	}

	return(file);
}

Loading