 b1859cc7a5
			
		
	
	b1859cc7a5
	
	
	
		
			
			The test inserted 200k rows with autocommit enabled which made it very slow. Wrapping the inserts inside a transaction gives the test a significant speed boost.
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /**
 | |
|  * @file lots_of_row.cpp INSERT extremelly big number of rows
 | |
|  * - do INSERT of 100 rows in the loop 2000 times
 | |
|  * - do SELECT *
 | |
|  */
 | |
| 
 | |
| 
 | |
| #include <iostream>
 | |
| #include "testconnections.h"
 | |
| #include "sql_t1.h"
 | |
| 
 | |
| int main(int argc, char *argv[])
 | |
| {
 | |
|     TestConnections * Test = new TestConnections(argc, argv);
 | |
|     char sql[10240];
 | |
| 
 | |
|     Test->connect_maxscale();
 | |
|     create_t1(Test->conn_rwsplit);
 | |
| 
 | |
|     Test->tprintf("INSERTing data");
 | |
| 
 | |
|     Test->try_query(Test->conn_rwsplit, "BEGIN");
 | |
|     for (int i = 0; i < 2000; i++)
 | |
|     {
 | |
|         Test->set_timeout(20);
 | |
|         create_insert_string(sql, 100, i);
 | |
|         Test->try_query(Test->conn_rwsplit, sql);
 | |
|     }
 | |
|     Test->try_query(Test->conn_rwsplit, "COMMIT");
 | |
| 
 | |
|     Test->tprintf("done, syncing slaves");
 | |
|     Test->stop_timeout();
 | |
|     Test->repl->sync_slaves();
 | |
|     Test->tprintf("Trying SELECT");
 | |
|     Test->set_timeout(60);
 | |
|     Test->try_query(Test->conn_rwsplit, (char *) "SELECT * FROM t1");
 | |
| 
 | |
|     Test->check_maxscale_alive();
 | |
|     int rval = Test->global_result;
 | |
|     delete Test;
 | |
|     return rval;
 | |
| }
 | |
| 
 |