mysqlbinlog.test
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:4k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. # We are using .opt file since we need small binlog size
  2. # Embedded server doesn't support binlogging
  3. -- source include/not_embedded.inc
  4. # we need this for getting fixed timestamps inside of this test
  5. set timestamp=1000000000;
  6. --disable_warnings
  7. drop table if exists t1,t2;
  8. --enable_warnings
  9. create table t1 (word varchar(20));
  10. create table t2 (id int auto_increment not null primary key);
  11. # simple test for simple statement and various events
  12. insert into t1 values ("abirvalg");
  13. insert into t2 values ();
  14. # Should be uncommented in 4.1
  15. # set @a:=1
  16. # insert into t2 values (@a);
  17. # test for load data and load data distributed among the several 
  18. # files (we need to fill up first binlog)
  19. load data infile '../../std_data/words.dat' into table t1;
  20. load data infile '../../std_data/words.dat' into table t1;
  21. load data infile '../../std_data/words.dat' into table t1;
  22. load data infile '../../std_data/words.dat' into table t1;
  23. load data infile '../../std_data/words.dat' into table t1;
  24. load data infile '../../std_data/words.dat' into table t1;
  25. # simple query to show more in second binlog
  26. insert into t1 values ("Alas");
  27. flush logs;
  28. # delimiters are for easier debugging in future
  29. --disable_query_log
  30. select "--- Local --" as "";
  31. --enable_query_log
  32. #
  33. # We should use --short-form everywhere because in other case output will
  34. # be time dependend. Better than nothing.
  35. #
  36. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  37. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000001 
  38. # this should not fail but shouldn't produce any working statements
  39. --disable_query_log
  40. select "--- Broken LOAD DATA --" as "";
  41. --enable_query_log
  42. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  43. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000002
  44. # this should show almost nothing
  45. --disable_query_log
  46. select "--- --database --" as "";
  47. --enable_query_log
  48. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  49. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
  50. # this test for position option
  51. --disable_query_log
  52. select "--- --position --" as "";
  53. --enable_query_log
  54. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  55. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
  56. # These are tests for remote binlog.
  57. # They should return the same as previous test.
  58. --disable_query_log
  59. select "--- Remote --" as "";
  60. --enable_query_log
  61. # This is broken now
  62. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  63. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
  64. # This is broken too
  65. --disable_query_log
  66. select "--- Broken LOAD DATA --" as "";
  67. --enable_query_log
  68. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  69. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
  70. # And this too ! (altough it is documented)
  71. --disable_query_log
  72. select "--- --database --" as "";
  73. --enable_query_log
  74. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  75. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
  76. # Strangely but this works
  77. --disable_query_log
  78. select "--- --position --" as "";
  79. --enable_query_log
  80. --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
  81. --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
  82. # clean up
  83. drop table t1, t2;
  84. # End of 4.1 tests