Commit 88e8c2a0 authored by unknown's avatar unknown
Browse files

Merge hundin.mysql.fi:/home/heikki/mysql-4.1

into hundin.mysql.fi:/home/heikki/mysql-5.0


innobase/fil/fil0fil.c:
  Auto merged
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
ndb/src/ndbapi/ndberror.c:
  Auto merged
parents 3c56b9a5 ce22ebd0
Loading
Loading
Loading
Loading
+51 −19
Original line number Diff line number Diff line
@@ -2935,6 +2935,44 @@ fil_load_single_table_tablespace(
	mem_free(filepath);
}

/***************************************************************************
A fault-tolerant function that tries to read the next file name in the
directory. We retry 100 times if os_file_readdir_next_file() returns -1. The
idea is to read as much good data as we can and jump over bad data. */
static
int
fil_file_readdir_next_file(
/*=======================*/
				/* out: 0 if ok, -1 if error even after the
				retries, 1 if at the end of the directory */
	ulint*		err,	/* out: this is set to DB_ERROR if an error
				was encountered, otherwise not changed */
	const char*	dirname,/* in: directory name or path */
	os_file_dir_t	dir,	/* in: directory stream */
	os_file_stat_t*	info)	/* in/out: buffer where the info is returned */
{
	ulint	i;
	int	ret;

	for (i = 0; i < 100; i++) {
		ret = os_file_readdir_next_file(dirname, dir, info);

		if (ret != -1) {

			return(ret);
		}
		
		fprintf(stderr,
"InnoDB: Error: os_file_readdir_next_file() returned -1 in\n"
"InnoDB: directory %s\n"
"InnoDB: Crash recovery may have failed for some .ibd files!\n", dirname);

		*err = DB_ERROR;
	}

	return(-1);
}

/************************************************************************
At the server startup, if we need crash recovery, scans the database
directories under the MySQL datadir, looking for .ibd files. Those files are
@@ -2955,6 +2993,7 @@ fil_load_single_table_tablespaces(void)
	os_file_dir_t	dbdir;
	os_file_stat_t	dbinfo;
	os_file_stat_t	fileinfo;
	ulint		err 		= DB_SUCCESS;

	/* The datadir of MySQL is always the default directory of mysqld */

@@ -2970,7 +3009,7 @@ fil_load_single_table_tablespaces(void)
	/* Scan all directories under the datadir. They are the database
	directories of MySQL. */

	ret = os_file_readdir_next_file(fil_path_to_mysql_datadir, dir,
	ret = fil_file_readdir_next_file(&err, fil_path_to_mysql_datadir, dir,
								&dbinfo);
	while (ret == 0) {
		ulint len;
@@ -3008,7 +3047,7 @@ fil_load_single_table_tablespaces(void)
			/* We found a database directory; loop through it,
			looking for possible .ibd files in it */

			ret = os_file_readdir_next_file(dbpath, dbdir,
			ret = fil_file_readdir_next_file(&err, dbpath, dbdir,
								&fileinfo);
			while (ret == 0) {
				/* printf(
@@ -3030,7 +3069,8 @@ fil_load_single_table_tablespaces(void)
						dbinfo.name, fileinfo.name);
				}
next_file_item:
				ret = os_file_readdir_next_file(dbpath, dbdir,
				ret = fil_file_readdir_next_file(&err,
								dbpath, dbdir,
								&fileinfo);
			}

@@ -3039,27 +3079,19 @@ fil_load_single_table_tablespaces(void)
"InnoDB: Warning: could not close database directory ", stderr);
				ut_print_filename(stderr, dbpath);
				putc('\n', stderr);

				err = DB_ERROR;
			}
		}
		
next_datadir_item:
		ret = os_file_readdir_next_file(fil_path_to_mysql_datadir,
		ret = fil_file_readdir_next_file(&err,
						fil_path_to_mysql_datadir,
								dir, &dbinfo);
	}

	mem_free(dbpath);

	/* At the end of directory we should get 1 as the return value, -1
	if there was an error */
	if (ret != 1) {
		fprintf(stderr,
"InnoDB: Error: os_file_readdir_next_file returned %d in MySQL datadir\n",
							       ret);
		os_file_closedir(dir);

		return(DB_ERROR);
	}

	if (0 != os_file_closedir(dir)) {
		fprintf(stderr,
"InnoDB: Error: could not close MySQL datadir\n");
@@ -3067,7 +3099,7 @@ fil_load_single_table_tablespaces(void)
		return(DB_ERROR);
	}

	return(DB_SUCCESS);
	return(err);
}

/************************************************************************
+2 −2
Original line number Diff line number Diff line
@@ -7520,13 +7520,13 @@ void Dblqh::execSCAN_FRAGREQ(Signal* signal)
  ndbrequire(max_rows > 0 && max_rows <= MAX_PARALLEL_OP_PER_SCAN);
  if (!getFragmentrec(signal, fragId)) {
    errorCode = __LINE__;
    errorCode = 1231;
    goto error_handler;
  }//if
  // Verify scan type vs table type (both sides are boolean)
  if (rangeScan != DictTabInfo::isOrderedIndex(fragptr.p->tableType)) {
    errorCode = __LINE__;       // XXX fix
    errorCode = 1232;
    goto error_handler;
  }//if
  
+2 −0
Original line number Diff line number Diff line
@@ -356,6 +356,8 @@ ErrorBundle ErrorCodes[] = {
  { 1226, SE, "Table is being dropped" },
  { 1228, SE, "Cannot use drop table for drop index" },
  { 1229, SE, "Too long frm data supplied" },
  { 1231, SE, "Invalid table or index to scan" },
  { 1232, SE, "Invalid table or index to scan" },

  /**
   * FunctionNotImplemented