################################################################################ # # # Variable Name: sql_low_priority_updates # # Scope: GLOBAL & SESSION # # Access Type: Dynamic # # Data Type: BOOLEAN # # Default Value: 1 TRUE # # Values: 1 TRUE, 0 FALSE # # # # # # Creation Date: 2008-02-25 # # Author: Sharique Abdullah # # # # Description: Test Cases of Dynamic System Variable sql_low_priority_updates # # that checks behavior of this variable in the following ways # # * Functionality based on different values # # # # Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # # # ################################################################################ --source include/not_embedded.inc ################################################################ # sql_low_priority_updates was renamed to low_priority_updates # ################################################################ --echo ** Setup ** --echo # # Setup # --echo ** Connecting con0 using root ** connect (con0,localhost,root,,); --echo ** Connecting con1 using root ** connect (con1,localhost,root,,); --echo ** Connection default ** connection default; SET @global_low_priority_updates = @@GLOBAL.low_priority_updates; SET @session_low_priority_updates = @@SESSION.low_priority_updates; # # Create Table # CREATE TABLE t1 (a varchar(100)); create view v1 as select * from t1; --echo '#--------------------FN_DYNVARS_160_01-------------------------#' # # Value ON # --echo ** Connection con0 ** connection con0; SET SESSION low_priority_updates = ON; --echo ** Connection con1 ** connection con1; SET SESSION low_priority_updates = ON; --echo ** Connection default ** connection default; SET SESSION low_priority_updates = ON; INSERT INTO t1 VALUES('1'); INSERT INTO t1 VALUES('2'); INSERT INTO t1 VALUES('3'); INSERT INTO t1 VALUES('4'); INSERT INTO t1 VALUES('5'); INSERT INTO t1 VALUES('6'); LOCK TABLE v1 WRITE; --echo ** Connection con1 ** connection con1; --echo ** Asynchronous Execution ** delimiter |; send UPDATE t1 SET a = CONCAT(a,"-updated");| delimiter ;| --echo ** Connection con0 ** connection con0; let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Waiting for table level lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")'; --source include/wait_condition.inc --echo ** Asynchronous Execution ** delimiter |; send LOCK TABLE t1 READ; SELECT * FROM t1; UNLOCK TABLES;| delimiter ;| --echo ** Connection default ** connection default; let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Waiting for table level lock'; --source include/wait_condition.inc UNLOCK TABLES; --echo ** Connection con0 ** connection con0; --echo ** Asynchronous Result ** reap; --echo Expected values of a without -updated; --echo ** Connection default ** connection default; DELETE FROM t1; --echo '#--------------------FN_DYNVARS_160_02-------------------------#' # # Value ON # --echo ** Connection con0 ** connection con0; SET SESSION low_priority_updates = OFF; --echo ** Connection con1 ** connection con1; reap; SET SESSION low_priority_updates = OFF; --echo ** Connection default** connection default; SET SESSION low_priority_updates = OFF; INSERT INTO t1 VALUES('1'); INSERT INTO t1 VALUES('2'); INSERT INTO t1 VALUES('3'); INSERT INTO t1 VALUES('4'); INSERT INTO t1 VALUES('5'); INSERT INTO t1 VALUES('6'); LOCK TABLE v1 WRITE; --echo ** Connection con1 ** connection con1; --echo ** Asynchronous Execution ** delimiter |; send UPDATE t1 SET a = CONCAT(a,"-updated");| delimiter ;| --echo ** Connection con0 ** connection con0; let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Waiting for table level lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")'; --source include/wait_condition.inc --echo ** Asynchronous Execution ** delimiter |; send LOCK TABLE t1 READ; SELECT * FROM t1; UNLOCK TABLES;| delimiter ;| --echo ** Connection default ** connection default; let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Waiting for table level lock'; --source include/wait_condition.inc UNLOCK TABLES; --echo ** Connection con0 ** connection con0; --echo ** Asynchronous Result ** reap; --echo Expected values of a with -updated; --echo ** Connection default** connection default; DELETE FROM t1; --echo '#--------------------FN_DYNVARS_160_03-------------------------#' # # Session data integrity check & GLOBAL Value check # --echo ** Connecting con_int1 using root ** connect (con_int1,localhost,root,,); --echo ** Connection con_int1 ** connection con_int1; SELECT @@SESSION.low_priority_updates; --echo 1 / TRUE Expected SET SESSION low_priority_updates = FALSE; --echo ** Connecting con_int2 using root ** connect (con_int2,localhost,root,,); --echo ** Connection con_int2 ** connection con_int2; SELECT @@SESSION.low_priority_updates; --echo 1 / TRUE Expected SET SESSION low_priority_updates = TRUE; --echo ** Connection con_int1 ** connection con_int1; SELECT @@SESSION.low_priority_updates; --echo 0 / FALSE Expected --echo ** Connection con_int2 ** connection con_int2; SELECT @@SESSION.low_priority_updates; --echo 1 / TRUE Expected --echo ** Connection default ** connection default; --echo Disconnecting Connections con_int1, con_int2 disconnect con_int1; disconnect con_int2; # # Cleanup # --echo ** Connection default ** connection default; --echo Disconnecting Connections con0, con1 disconnect con0; disconnect con1; drop view v1; DROP TABLE t1; SET @@GLOBAL.low_priority_updates = @global_low_priority_updates; SET @@SESSION.low_priority_updates = @session_low_priority_updates;