You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.5 KiB

  1. --source include/have_debug.inc
  2. let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
  3. mkdir $targetdir;
  4. CREATE TABLE t1(i int) ENGINE INNODB;
  5. INSERT into t1 values(1);
  6. CREATE TABLE t2(i int) ENGINE INNODB;
  7. INSERT INTO t2 values(2);
  8. CREATE TABLE t3(i int) ENGINE INNODB;
  9. CREATE TABLE t4(i int) ENGINE INNODB;
  10. CREATE TABLE t5(i int) ENGINE INNODB;
  11. INSERT INTO t5 VALUES(5);
  12. CREATE TABLE a(a int) ENGINE INNODB;
  13. INSERT INTO a values(1);
  14. CREATE TABLE b(b CHAR(1)) ENGINE INNODB;
  15. INSERT INTO b VALUES('b');
  16. CREATE TABLE a1(a1 int) ENGINE INNODB;
  17. INSERT INTO a1 VALUES(1);
  18. CREATE TABLE b1(b1 CHAR(2)) ENGINE INNODB;
  19. INSERT INTO b1 VALUES('b1');
  20. # Test renames before of after copying tablespaces
  21. --let before_copy_test_t1=RENAME TABLE test.t1 TO test.t1_renamed
  22. --let after_copy_test_t2=RENAME TABLE test.t2 TO test.t2_renamed
  23. --let after_copy_test_t3=BEGIN NOT ATOMIC RENAME TABLE test.t3 TO test.t3_tmp; INSERT INTO test.t3_tmp VALUES(3); RENAME TABLE test.t3_tmp TO test.t3; END
  24. --let before_copy_test_t4=RENAME TABLE test.t4 TO test.t4_tmp
  25. --let after_copy_test_t4=RENAME TABLE test.t4_tmp TO test.t4
  26. --let after_copy_test_t5=BEGIN NOT ATOMIC RENAME TABLE test.t5 TO test.t6; CREATE TABLE test.t5(i int) ENGINE INNODB; END
  27. # Test circular renames
  28. --let before_copy_test_b=RENAME TABLE test.a to test.tmp, test.b to test.a, test.tmp to test.b
  29. --let after_copy_test_b1=RENAME TABLE test.a1 to test.tmp, test.b1 to test.a1, test.tmp to test.b1
  30. --disable_result_log
  31. exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
  32. --enable_result_log
  33. --let before_copy_test_t1=''
  34. --let after_copy_test_t2=''
  35. --let before_copy_test_a=''
  36. --let after_copy_test_a1=''
  37. echo # xtrabackup prepare;
  38. --disable_result_log
  39. exec $XTRABACKUP --prepare --target-dir=$targetdir;
  40. -- source include/restart_and_restore.inc
  41. --enable_result_log
  42. # the table was renamed from t1 to t1_renamed
  43. # make sure t1 does not exist, and t1_renamed does.
  44. CREATE TABLE t1(i int);
  45. DROP TABLE t1;
  46. SELECT * from t1_renamed;
  47. DROP TABLE t1_renamed;
  48. CREATE TABLE t2(i int);
  49. DROP TABLE t2;
  50. SELECT * from t2_renamed;
  51. DROP TABLE t2_renamed;
  52. #rename to itself
  53. SELECT * from t3;
  54. DROP TABLE t3;
  55. SELECT * from t4;
  56. DROP TABLE t4;
  57. # For circular renames , make sure intermediate tables do not exist
  58. CREATE TABLE tmp(i int);
  59. DROP TABLE tmp;
  60. SELECT * FROM a;
  61. SELECT * FROM b;
  62. SELECT * FROM a1;
  63. SELECT * FROM b1;
  64. DROP TABLE a,b,a1,b1;
  65. SELECT * from t5;
  66. DROP TABLE t5;
  67. SELECT * from t6;
  68. DROP TABLE t6;
  69. rmdir $targetdir;