Commit a8a6fdee authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/data0/bk/mysql-5.1

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt


mysql-test/r/show_check.result:
  Auto merged
sql/log.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
parents 79afa8ad 767cb0b4
Loading
Loading
Loading
Loading
+455 −439
Original line number Diff line number Diff line
@@ -133,8 +133,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[]=
{
  "MYSQL323", "MYSQL40", "POSTGRESQL", "ORACLE", "MSSQL", "DB2",
@@ -1528,7 +1528,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
@@ -1620,13 +1620,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);
      }

@@ -1664,10 +1673,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);
            }

@@ -1694,7 +1706,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);
      }

@@ -2199,6 +2211,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)
  {
@@ -2808,7 +2826,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)))
@@ -2837,7 +2855,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++)
    {
@@ -3019,8 +3037,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)
@@ -3174,7 +3190,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
  }

  /* Dump each selected view */
  if (was_views)
  if (seen_views)
  {
    for (pos= dump_tables; pos < end; pos++)
      get_view_structure(*pos, db);
@@ -3638,7 +3654,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);
  }
+3 −7
Original line number Diff line number Diff line
@@ -228,15 +228,11 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT * FROM mysqltest1.t7;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
--echo -------- switch to slave --------
sync_slave_with_master;
SELECT * FROM mysqltest1.t7;
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log

###############################################################
# Cases with LOCK/UNLOCK
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events;
select * from t1;
drop table t1;
+36 −0
Original line number Diff line number Diff line
#
# Copyright 2006 MySQL. All rights reserved.
#
# Test to check for the different version of truncating a table.
# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
# the behaviour of each possible value for BINLOG_FORMAT.
#
# Author(s): Mats Kindahl

--source include/have_row_based.inc
--source include/master-slave.inc

let $format = STATEMENT;
let $stmt   = TRUNCATE TABLE;
--source extra/rpl_tests/rpl_truncate_helper.test

let $format = MIXED;
let $stmt   = TRUNCATE TABLE;
--source extra/rpl_tests/rpl_truncate_helper.test

let $format = ROW;
let $stmt   = TRUNCATE TABLE;
--source extra/rpl_tests/rpl_truncate_helper.test

let $format = STATEMENT;
let $stmt   = DELETE FROM;
--source extra/rpl_tests/rpl_truncate_helper.test

let $format = MIXED;
let $stmt   = DELETE FROM;
--source extra/rpl_tests/rpl_truncate_helper.test

let $format = ROW;
let $stmt   = DELETE FROM;
--source extra/rpl_tests/rpl_truncate_helper.test
+41 −0
Original line number Diff line number Diff line

--disable_query_log
--disable_warnings
connection slave;
STOP SLAVE;
connection master;
DROP TABLE IF EXISTS t1;
RESET MASTER;
connection slave;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
--enable_warnings
--enable_query_log

--echo **** On Master ****
connection master;
eval SET SESSION BINLOG_FORMAT=$format;
eval SET GLOBAL  BINLOG_FORMAT=$format;

eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
INSERT INTO t1 VALUES (1,1), (2,2);
SELECT * FROM t1;
--echo **** On Slave ****
sync_slave_with_master;
INSERT INTO t1 VALUE (3,3);
SELECT * FROM t1;
--echo **** On Master ****
connection master;
eval $stmt t1;
SELECT * FROM t1;
--echo **** On Slave ****
sync_slave_with_master;
# Should be empty
SELECT * FROM t1;
--echo **** On Master ****
connection master;
DROP TABLE t1;
--replace_result $SERVER_VERSION SERVER_VERSION
--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
Loading