consistent_snapshot.test
Upload User: romrleung
Upload Date: 2022-05-23
Package Size: 18897k
Code Size: 1k
Category:

MySQL

Development Platform:

Visual C++

  1. -- source include/have_innodb.inc
  2. --disable_warnings
  3. drop table if exists t1;
  4. --enable_warnings
  5. connect (con1,localhost,root,,);
  6. connect (con2,localhost,root,,);
  7. ### Test 1:
  8. ### - While a consistent snapshot transaction is executed,
  9. ###   no external inserts should be visible to the transaction.
  10. connection con1;
  11. create table t1 (a int) engine=innodb;
  12. start transaction with consistent snapshot;
  13. connection con2;
  14. insert into t1 values(1);
  15. connection con1;
  16. select * from t1; # if consistent snapshot was set as expected, we
  17. # should see nothing.
  18. commit;
  19. ### Test 2:
  20. ### - For any non-consistent snapshot transaction, external
  21. ###   committed inserts should be visible to the transaction.
  22. delete from t1;
  23. start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
  24. connection con2;
  25. insert into t1 values(1);
  26. connection con1;
  27. select * from t1; # if consistent snapshot was not set, as expected, we
  28. # should see 1.
  29. commit;
  30. drop table t1;
  31. # End of 4.1 tests