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

Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl

into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge

parents 39246e2f 7eec6c3f
Loading
Loading
Loading
Loading
+456 −440
Original line number Diff line number Diff line
@@ -129,8 +129,8 @@ static const char *mysql_universal_client_charset=
static char *default_charset;
static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace";
/* do we met VIEWs during tables scaning */
my_bool was_views= 0;
/* have we seen any VIEWs during table scanning? */
my_bool seen_views= 0;

const char *compatible_mode_names[]=
{
@@ -1388,7 +1388,7 @@ static uint dump_routines_for_db(char *db)
  ARGS
    table       - table name
    db          - db name
    table_type  - table type ie "InnoDB"
    table_type  - table type, e.g. "MyISAM" or "InnoDB", but also "VIEW"
    ignore_flag - what we must particularly ignore - see IGNORE_ defines above

  RETURN
@@ -1480,13 +1480,22 @@ static uint get_table_structure(char *table, char *db, char *table_type,
      }
      if (!opt_xml && opt_comments)
      {
      if (strcmp (table_type, "VIEW") == 0)         /* view */
        fprintf(sql_file, "\n--\n-- Temporary table structure for view %s\n--\n\n",
                result_table);
      else
        fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
                result_table);
        check_io(sql_file);
      }
      if (opt_drop)
      {
        fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", opt_quoted_table);
      /*
        Even if the "table" is a view, we do a DROP TABLE here.  The
        view-specific code below fills in the DROP VIEW.
       */
        fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
                opt_quoted_table);
        check_io(sql_file);
      }

@@ -1524,10 +1533,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
          {
            if (opt_drop)
            {
            /*
              We have already dropped any table of the same name
              above, so here we just drop the view.
             */

              fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
                      opt_quoted_table);
              fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n",
                      opt_quoted_table);
              check_io(sql_file);
            }

@@ -1554,7 +1566,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
        }
        mysql_free_result(result);

        was_views= 1;
        seen_views= 1;
        DBUG_RETURN(0);
      }

@@ -2053,6 +2065,12 @@ static void dump_table(char *table, char *db)
  */
  num_fields= get_table_structure(table, db, table_type, &ignore_flag);

  /*
    The "table" could be a view.  If so, we don't do anything here.
  */
  if (strcmp (table_type, "VIEW") == 0)
    return;

  /* Check --no-data flag */
  if (dFlag)
  {
@@ -2538,7 +2556,7 @@ static int dump_all_databases()
    if (dump_all_tables_in_db(row[0]))
      result=1;
  }
  if (was_views)
  if (seen_views)
  {
    if (mysql_query(sock, "SHOW DATABASES") ||
        !(tableres = mysql_store_result(sock)))
@@ -2567,7 +2585,7 @@ static int dump_databases(char **db_names)
    if (dump_all_tables_in_db(*db))
      result=1;
  }
  if (!result && was_views)
  if (!result && seen_views)
  {
    for (db= db_names ; *db ; db++)
    {
@@ -2741,8 +2759,6 @@ static my_bool dump_all_views_in_db(char *database)
  uint numrows;
  char table_buff[NAME_LEN*2+3];

  if (init_dumping(database))
    return 1;
  if (opt_xml)
    print_xml_tag1(md_result_file, "", "database name=", database, "\n");
  if (lock_tables)
@@ -2908,7 +2924,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
  }

  /* Dump each selected view */
  if (was_views)
  if (seen_views)
  {
    for(i=0; i < dump_tables.records; i++)
    {
@@ -3369,7 +3385,7 @@ static my_bool get_view_structure(char *table, char* db)

  if (!opt_xml && opt_comments)
  {
    fprintf(sql_file, "\n--\n-- View structure for view %s\n--\n\n",
    fprintf(sql_file, "\n--\n-- Final view structure for view %s\n--\n\n",
            result_table);
    check_io(sql_file);
  }
+38 −25
Original line number Diff line number Diff line
@@ -3699,6 +3699,37 @@ os_aio_posix_handle(
}
#endif

/**************************************************************************
Do a 'last millisecond' check that the page end is sensible;
reported page checksum errors from Linux seem to wipe over the page end. */
static
void
os_file_check_page_trailers(
/*========================*/
	byte*	combined_buf,	/* in: combined write buffer */
	ulint	total_len)	/* in: size of combined_buf, in bytes
				(a multiple of UNIV_PAGE_SIZE) */
{
	ulint	len;

	for (len = 0; len + UNIV_PAGE_SIZE <= total_len;
			len += UNIV_PAGE_SIZE) {
		byte*	buf = combined_buf + len;

		if (memcmp(buf + (FIL_PAGE_LSN + 4), buf + (UNIV_PAGE_SIZE
				- FIL_PAGE_END_LSN_OLD_CHKSUM + 4), 4)) {
		    	ut_print_timestamp(stderr);
		    	fprintf(stderr,
"  InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: Writing a block of %lu bytes, currently at offset %lu\n",
			(ulong)total_len, (ulong)len);
			buf_page_print(buf);
		    	fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
		}
	}
}

/**************************************************************************
Does simulated aio. This function should be called by an i/o-handler
thread. */
@@ -3736,7 +3767,6 @@ os_aio_simulated_handle(
	ibool		ret;
	ulint		n;
	ulint		i;
	ulint		len2;
	
	segment = os_aio_get_array_and_local_segment(&array, global_segment);
	
@@ -3944,32 +3974,15 @@ os_aio_simulated_handle(
				ut_error;
			}

			/* Do a 'last millisecond' check that the page end
			is sensible; reported page checksum errors from
			Linux seem to wipe over the page end */

			for (len2 = 0; len2 + UNIV_PAGE_SIZE <= total_len;
						len2 += UNIV_PAGE_SIZE) {
				if (mach_read_from_4(combined_buf + len2
						+ FIL_PAGE_LSN + 4)
				    != mach_read_from_4(combined_buf + len2
				    		+ UNIV_PAGE_SIZE
				    	- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
				    	ut_print_timestamp(stderr);
				    	fprintf(stderr,
"  InnoDB: ERROR: The page to be written seems corrupt!\n");
				    	fprintf(stderr,
"InnoDB: Writing a block of %lu bytes, currently writing at offset %lu\n",
					(ulong)total_len, (ulong)len2);
					buf_page_print(combined_buf + len2);
				    	fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
				}
			}
			os_file_check_page_trailers(combined_buf, total_len);
		}

		ret = os_file_write(slot->name, slot->file, combined_buf,
				slot->offset, slot->offset_high, total_len);

		if (array == os_aio_write_array) {
			os_file_check_page_trailers(combined_buf, total_len);
		}
	} else {
		ret = os_file_read(slot->file, combined_buf,
				slot->offset, slot->offset_high, total_len);
+10 −10
Original line number Diff line number Diff line
@@ -2570,14 +2570,14 @@ do not allow the discard. We also reserve the data dictionary latch. */
		}
	}
funct_exit:	
  	trx_commit_for_mysql(trx);

	row_mysql_unlock_data_dictionary(trx);

	if (graph) {
		que_graph_free(graph);
	}

  	trx_commit_for_mysql(trx);

	trx->op_info = "";

	return((int) err);
@@ -2707,10 +2707,10 @@ row_import_tablespace_for_mysql(
	}

funct_exit:	
	row_mysql_unlock_data_dictionary(trx);

  	trx_commit_for_mysql(trx);

	row_mysql_unlock_data_dictionary(trx);

	trx->op_info = "";

	return((int) err);
@@ -3398,6 +3398,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
	}
funct_exit:

  	trx_commit_for_mysql(trx);

	if (locked_dictionary) {
		row_mysql_unlock_data_dictionary(trx);	
	}
@@ -3408,8 +3410,6 @@ fputs(" InnoDB: You are trying to drop table ", stderr);

	que_graph_free(graph);
	
  	trx_commit_for_mysql(trx);

	trx->op_info = "";

#ifndef UNIV_HOTBACKUP
@@ -3488,10 +3488,10 @@ row_drop_database_for_mysql(
		}
	}

	row_mysql_unlock_data_dictionary(trx);
	
	trx_commit_for_mysql(trx);

	row_mysql_unlock_data_dictionary(trx);
	
	trx->op_info = "";

	return(err);
@@ -3905,6 +3905,8 @@ row_rename_table_for_mysql(
		}
	}
funct_exit:	
  	trx_commit_for_mysql(trx);

	if (!recovering_temp_table) {
		row_mysql_unlock_data_dictionary(trx);
	}
@@ -3917,8 +3919,6 @@ row_rename_table_for_mysql(
		mem_heap_free(heap);
	}
	
  	trx_commit_for_mysql(trx);

	trx->op_info = "";

	return((int) err);
+2 −1
Original line number Diff line number Diff line
@@ -1064,11 +1064,12 @@ row_sel_try_search_shortcut(
	ut_ad(plan->pcur.latch_mode == node->latch_mode);

	plan->n_rows_fetched++;
	ret = SEL_FOUND;
func_exit:
	if (UNIV_LIKELY_NULL(heap)) {
		mem_heap_free(heap);
	}
	return(SEL_FOUND);
	return(ret);
}

/*************************************************************************
+20 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ sub mtr_record_dead_children ();
sub mtr_exit ($);
sub sleep_until_file_created ($$$);
sub mtr_kill_processes ($);
sub mtr_kill_process ($$$$);

# static in C
sub spawn_impl ($$$$$$$$);
@@ -885,6 +886,25 @@ sub mtr_kill_processes ($) {
  }
}


sub mtr_kill_process ($$$$) {
  my $pid= shift;
  my $signal= shift;
  my $retries= shift;
  my $timeout= shift;

  while (1)
  {
    kill($signal, $pid);

    last unless kill (0, $pid) and $retries--;

    mtr_debug("Sleep $timeout second waiting for processes to die");

    sleep($timeout);
  }
}

##############################################################################
#
#  When we exit, we kill off all children
Loading