diff --git a/config/mariadb.xml b/config/mariadb.xml
index 0233572b..6bd06377 100755
--- a/config/mariadb.xml
+++ b/config/mariadb.xml
@@ -23,6 +23,7 @@
innodb
false
false
+ false
false
diff --git a/config/mysql.xml b/config/mysql.xml
index 4bfcaae0..93ef1639 100755
--- a/config/mysql.xml
+++ b/config/mysql.xml
@@ -24,6 +24,7 @@
false
false
false
+ false
10000000
diff --git a/src/mariadb/mariaoltp.tcl b/src/mariadb/mariaoltp.tcl
index 6d46b435..54508ff4 100755
--- a/src/mariadb/mariaoltp.tcl
+++ b/src/mariadb/mariaoltp.tcl
@@ -1364,6 +1364,305 @@ mariaclose $mmaria_handler
}
}
+proc insert_maria_no_stored_procs { testtype timedtype } {
+ #No stored procedure code is different in arguments and whether output is printed
+ #for timed and test workloads and sync and async
+ #body is the same
+ #Build up procs so body is not repeated
+ #Replace existing stored proc calls with client version
+ if { $timedtype eq "sync" } {
+ set newordargs "#NEW ORDER
+ proc neword { maria_handler no_w_id w_id_input prepare RAISEERROR } \{
+ "
+ set payargs "#PAYMENT
+ proc payment { maria_handler p_w_id w_id_input prepare RAISEERROR } \{
+ "
+ set ostatargs "#ORDER_STATUS
+ proc ostat { maria_handler w_id prepare RAISEERROR } \{
+ "
+ set delivargs "#DELIVERY
+ proc delivery { maria_handler w_id prepare RAISEERROR } \{
+ "
+ set stockargs "#STOCK LEVEL
+ proc slev { maria_handler w_id stock_level_d_id prepare RAISEERROR } \{
+ "
+ } else {
+ set newordargs "#NEW ORDER
+ proc neword { maria_handler no_w_id w_id_input prepare RAISEERROR clientname} \{
+ "
+ set payargs "#PAYMENT
+ proc payment { maria_handler p_w_id w_id_input prepare RAISEERROR clientname} \{
+ "
+ set ostatargs "#ORDER_STATUS
+ proc ostat { maria_handler w_id prepare RAISEERROR clientname} \{
+ "
+ set delivargs "#DELIVERY
+ proc delivery { maria_handler w_id prepare RAISEERROR clientname} \{
+ "
+ set stockargs "#STOCK LEVEL
+ proc slev { maria_handler w_id stock_level_d_id prepare RAISEERROR clientname} \{
+ "
+ }
+
+ set newordbody {
+ global mariastatus
+ #open new order cursor
+ #2.4.1.2 select district id randomly from home warehouse where d_w_id = d_id
+ set no_d_id [ RandomNumber 1 10 ]
+ #2.4.1.2 Customer id randomly selected where c_d_id = d_id and c_w_id = w_id
+ set no_c_id [ RandomNumber 1 3000 ]
+ #2.4.1.3 Items in the order randomly selected from 5 to 15
+ set ol_cnt [ RandomNumber 5 15 ]
+ #2.4.1.6 order entry date O_ENTRY_D generated by SUT
+ set date [ gettimestamp ]
+ set no_max_w_id $w_id_input
+
+ set no_o_all_local 1
+ set cust_ware [ maria::sel $maria_handler "SELECT c_discount, c_last, c_credit, w_tax FROM customer, warehouse WHERE warehouse.w_id = $no_w_id AND customer.c_w_id = $no_w_id AND customer.c_d_id = $no_d_id AND customer.c_id = $no_c_id" -flatlist ]
+ lassign $cust_ware discount last credit wtax
+ mariaexec $maria_handler "start transaction"
+ set o_id_tax_list [ maria::sel $maria_handler "SELECT d_next_o_id, d_tax FROM district WHERE d_id = $no_d_id AND d_w_id = $no_w_id FOR UPDATE" -flatlist ]
+ lassign $o_id_tax_list next_o_id dtax
+ mariaexec $maria_handler "UPDATE district SET d_next_o_id = d_next_o_id + 1 WHERE d_id = $no_d_id AND d_w_id = $no_w_id"
+ set o_id [ lindex $o_id_tax_list 0 ]
+ set no_c_discount [ lindex $cust_ware 0 ]
+ set no_w_tax [ lindex $cust_ware 3 ]
+ set no_d_tax [ lindex $o_id_tax_list 1 ]
+ set rbk [ RandomNumber 1 99 ]
+ set loop_counter 1
+ while { $loop_counter <= $ol_cnt } {
+ if { ($loop_counter eq $ol_cnt) && $rbk eq 1 } {
+ set no_ol_i_id 100001
+ } else {
+ set no_ol_i_id [ RandomNumber 1 100000 ]
+ }
+ set x [ RandomNumber 1 100 ]
+ if { $x > 1 } {
+ set no_ol_supply_w_id $no_w_id
+ } else {
+ set no_ol_supply_w_id $no_w_id
+ set no_o_all_local 0
+ while { ($no_ol_supply_w_id eq $no_w_id) && ($no_max_w_id != 1) } {
+ set no_ol_supply_w_id [ RandomNumber 1 $no_max_w_id ]
+ }
+ }
+ set no_ol_quantity [ RandomNumber 1 10 ]
+ set price_name_data [ maria::sel $maria_handler "SELECT i_price, i_name, i_data FROM item WHERE i_id = $no_ol_i_id" -flatlist ]
+ if { [ llength $price_name_data ] eq 0 } {
+ maria::rollback $maria_handler
+ return
+ }
+ set quantity_data_dist [ maria::sel $maria_handler "SELECT s_quantity, s_data, s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_dist_05, s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10 FROM stock WHERE s_i_id = $no_ol_i_id AND s_w_id = $no_ol_supply_w_id" -flatlist ]
+ set no_i_price [ lindex $price_name_data 0 ]
+ set no_s_quantity [ lindex $quantity_data_dist 0 ]
+ if { $no_s_quantity > $no_ol_quantity } {
+ set no_s_quantity [ expr {$no_s_quantity - $no_ol_quantity} ]
+ } else {
+ set no_s_quantity [ expr {$no_s_quantity - $no_ol_quantity + 91} ]
+ }
+ mariaexec $maria_handler "UPDATE stock SET s_quantity = $no_s_quantity WHERE s_i_id = $no_ol_i_id AND s_w_id = $no_ol_supply_w_id"
+ set no_ol_amount [ expr {($no_ol_quantity * $no_i_price * ( 1 + $no_w_tax + $no_d_tax ) * ( 1 - $no_c_discount ))} ]
+ switch $no_d_id {
+ 1 { set no_ol_dist_info [ lindex $quantity_data_dist 2 ] }
+ 2 { set no_ol_dist_info [ lindex $quantity_data_dist 3 ] }
+ 3 { set no_ol_dist_info [ lindex $quantity_data_dist 4 ] }
+ 4 { set no_ol_dist_info [ lindex $quantity_data_dist 5 ] }
+ 5 { set no_ol_dist_info [ lindex $quantity_data_dist 6 ] }
+ 6 { set no_ol_dist_info [ lindex $quantity_data_dist 7 ] }
+ 7 { set no_ol_dist_info [ lindex $quantity_data_dist 8 ] }
+ 8 { set no_ol_dist_info [ lindex $quantity_data_dist 9 ] }
+ 9 { set no_ol_dist_info [ lindex $quantity_data_dist 10 ] }
+ 10 { set no_ol_dist_info [ lindex $quantity_data_dist 11 ] }
+ }
+ mariaexec $maria_handler "INSERT INTO order_line (ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_dist_info) VALUES ($o_id, $no_d_id, $no_w_id, $loop_counter, $no_ol_i_id, $no_ol_supply_w_id, $no_ol_quantity, $no_ol_amount, '$no_ol_dist_info')"
+ incr loop_counter
+ }
+ mariaexec $maria_handler "INSERT INTO orders (o_id, o_d_id, o_w_id, o_c_id, o_entry_d, o_ol_cnt, o_all_local) VALUES ($o_id, $no_d_id, $no_w_id, $no_c_id, $date, $ol_cnt, $no_o_all_local)"
+ mariaexec $maria_handler "INSERT INTO new_order (no_o_id, no_d_id, no_w_id) VALUES ($o_id, $no_d_id, $no_w_id)"
+ maria::commit $maria_handler
+ }
+ set paybody {
+ global mariastatus
+ #2.5.1.1 The home warehouse id remains the same for each terminal
+ #2.5.1.1 select district id randomly from home warehouse where d_w_id = d_id
+ set p_d_id [ RandomNumber 1 10 ]
+ #2.5.1.2 customer selected 60% of time by name and 40% of time by number
+ set x [ RandomNumber 1 100 ]
+ set y [ RandomNumber 1 100 ]
+ if { $x <= 85 } {
+ set p_c_d_id $p_d_id
+ set p_c_w_id $p_w_id
+ } else {
+ #use a remote warehouse
+ set p_c_d_id [ RandomNumber 1 10 ]
+ set p_c_w_id [ RandomNumber 1 $w_id_input ]
+ while { ($p_c_w_id == $p_w_id) && ($w_id_input != 1) } {
+ set p_c_w_id [ RandomNumber 1 $w_id_input ]
+ }
+ }
+ set nrnd [ NURand 255 0 999 123 ]
+ set name [ randname $nrnd ]
+ set p_c_id [ RandomNumber 1 3000 ]
+ if { $y <= 60 } {
+ #use customer name
+ #C_LAST is generated
+ set byname 1
+ } else {
+ #use customer number
+ set byname 0
+ set name {}
+ }
+ #2.5.1.3 random amount from 1 to 5000
+ set p_h_amount [ RandomNumber 1 5000 ]
+ #2.5.1.4 date selected from SUT
+ set h_date [ gettimestamp ]
+ #2.5.2.1 Payment Transaction
+ mariaexec $maria_handler "start transaction"
+ mariaexec $maria_handler "UPDATE warehouse SET w_ytd = w_ytd + $p_h_amount WHERE w_id = $p_w_id"
+ set w_address_list [ maria::sel $maria_handler "SELECT w_street_1, w_street_2, w_city, w_state, w_zip, w_name FROM warehouse WHERE w_id = $p_w_id" -flatlist ]
+ lassign $w_address_list p_w_street_1 p_w_street_2 p_w_city p_w_state p_w_zip p_w_name
+ set p_w_name [ lindex $w_address_list 5 ]
+ mariaexec $maria_handler "UPDATE district SET d_ytd = d_ytd + $p_h_amount WHERE d_w_id = $p_w_id AND d_id = $p_d_id"
+ set d_address_list [ maria::sel $maria_handler "SELECT d_street_1, d_street_2, d_city, d_state, d_zip, d_name FROM district WHERE d_w_id = $p_w_id AND d_id = $p_d_id" -flatlist ]
+ lassign $d_address_list p_d_street_1 p_d_street_2 p_d_city p_d_state p_d_zip p_d_name
+ set p_d_name [ lindex $d_address_list 5 ]
+ if { $byname } {
+ set namecnt [ maria::sel $maria_handler "SELECT count(c_id) FROM customer WHERE c_last = '$name' AND c_d_id = $p_c_d_id AND c_w_id = $p_c_w_id" -flatlist ]
+ set cust_list [ maria::sel $maria_handler "SELECT c_first, c_middle, c_id, c_street_1, c_street_2, c_city, c_state, c_zip, c_phone, c_credit, c_credit_lim, c_discount, c_balance, c_since FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_last = '$name' ORDER BY c_first" -list ]
+ if { [ expr {$namecnt % 2} ] eq 1 } {
+ set $namecnt [ expr {$namecnt + 1} ]
+ }
+ set cust_id_to_query [ lindex $cust_list [ expr {$namecnt / 2} ] ]
+ lassign $cust_id_to_query p_c_first p_c_middle p_c_id p_c_street_1 p_c_street_2 p_c_city p_c_state p_c_zip p_c_phone p_c_credit p_c_credit_lim p_c_discount p_c_balance p_c_since
+ set p_c_last $name
+ } else {
+ set cust_id_to_query [ maria::sel $maria_handler "SELECT c_first, c_middle, c_last, c_street_1, c_street_2, c_city, c_state, c_zip, c_phone, c_credit, c_credit_lim, c_discount, c_balance, c_since FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id" -flatlist ]
+ lassign $cust_id_to_query p_c_first p_c_middle p_c_last p_c_street_1 p_c_street_2 p_c_city p_c_state p_c_zip p_c_phone p_c_credit p_c_credit_lim p_c_discount p_c_balance p_c_since
+ }
+ if { $p_c_balance eq "" } { set p_c_balance 0 }
+ set p_c_balance [ expr {$p_c_balance + $p_h_amount} ]
+ if { $p_c_credit eq "BC" } {
+ set c_data [ join [ maria::sel $maria_handler "SELECT c_data FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id" -flatlist ]]
+ set h_data [ concat $p_w_name $p_d_name ]
+ set p_c_new_data [ concat p_c_id $p_c_id p_c_d_id $p_c_d_id p_c_w_id $p_c_w_id p_d_id $p_d_id p_w_id $p_w_id p_h_amount [ format %4.2f $p_h_amount ] h_date $h_date h_data $h_data ]
+ set p_c_new_data [ string range [ concat $p_c_new_data $c_data ] 1 [ expr 500 - [ string length $p_c_new_data ] ] ]
+ mariaexec $maria_handler "UPDATE customer SET c_balance = $p_c_balance, c_data = '$p_c_new_data' WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id"
+ } else {
+ mariaexec $maria_handler "UPDATE customer SET c_balance = $p_c_balance WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id"
+ set c_data ""
+ }
+ set h_data [ concat $p_w_name $p_d_name ]
+ mariaexec $maria_handler "INSERT INTO history (h_c_d_id, h_c_w_id, h_c_id, h_d_id, h_w_id, h_date, h_amount, h_data) VALUES ($p_c_d_id, $p_c_w_id, $p_c_id, $p_d_id, $p_w_id, $h_date, $p_h_amount, '$h_data')"
+ maria::commit $maria_handler
+ }
+ set ostatbody {
+ global mariastatus
+ #2.5.1.1 select district id randomly from home warehouse where d_w_id = d_id
+ set d_id [ RandomNumber 1 10 ]
+ set nrnd [ NURand 255 0 999 123 ]
+ set name [ randname $nrnd ]
+ set c_id [ RandomNumber 1 3000 ]
+ set y [ RandomNumber 1 100 ]
+ if { $y <= 60 } {
+ set byname 1
+ } else {
+ set byname 0
+ set name {}
+ }
+ mariaexec $maria_handler "start transaction"
+ if { $byname eq 1 } {
+ set namecnt [ list [ maria::sel $maria_handler "SELECT count(c_id) FROM customer WHERE c_last = '$name' AND c_d_id = $d_id AND c_w_id = $w_id" -list ]]
+ if { [ expr {$namecnt % 2} ] eq 1 } {
+ incr namecnt
+ }
+ set cust_list [ maria::sel $maria_handler "SELECT c_balance, c_first, c_middle, c_id FROM customer WHERE c_last = '$name' AND c_d_id = $d_id AND c_w_id = $w_id ORDER BY c_first" -list ]
+ set cust_id_to_query [ lindex $cust_list [ expr ($namecnt/2)-1 ] ]
+ } else {
+ set cust_id_to_query [ maria::sel $maria_handler "SELECT c_balance, c_first, c_middle, c_last FROM customer WHERE c_id = $c_id AND c_d_id = $d_id AND c_w_id = $w_id" -list ]
+ }
+ lassign $cust_id_to_query os_c_balance os_c_first os_c_middle os_c_last
+ set cust_orders [ maria::sel $maria_handler "SELECT o_id, o_carrier_id, o_entry_d FROM (SELECT o_id, o_carrier_id, o_entry_d FROM orders where o_d_id = $d_id AND o_w_id = $w_id and o_c_id = $c_id ORDER BY o_id DESC) AS sb LIMIT 1" -flatlist ]
+ if { [ llength $cust_orders ] eq 0 } {
+ set no_order_status "No orders for customer"
+ set o_id 0
+ } else {
+ lassign $cust_orders o_id o_carrier_id o_entry_d
+ }
+ set c_line [ maria::sel $maria_handler "SELECT ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_delivery_d FROM order_line WHERE ol_o_id = $o_id AND ol_d_id = $d_id AND ol_w_id = $w_id" -flatlist ]
+ foreach arr {os_ol_i_id_array os_ol_supply_w_id_array os_ol_quantity_array os_ol_amount_array os_ol_delivery_d_array os_ol_i_id_array } { set $arr "CSV," }
+ foreach {ol_i_id ol_supply_w_id ol_quantity ol_amount ol_delivery_d} $c_line {
+ lappend os_ol_i_id_array "$ol_i_id,"
+ lappend os_ol_supply_w_id_array "$ol_supply_w_id,"
+ lappend os_ol_quantity_array "$ol_quantity,"
+ lappend os_ol_amount_array "$ol_amount,"
+ lappend os_ol_delivery_d_array "$ol_delivery_d,"
+}
+ maria::commit $maria_handler
+}
+ set delivbody {
+ global mariastatus
+ set carrier_id [ RandomNumber 1 10 ]
+ set date [ gettimestamp ]
+ set loop_counter 1
+ mariaexec $maria_handler "start transaction"
+ while { $loop_counter <= 10 } {
+ set d_d_id $loop_counter
+ set no_o_id [ maria::sel $maria_handler "SELECT no_o_id FROM new_order WHERE no_w_id = $w_id AND no_d_id = $d_d_id LIMIT 1" -flatlist ]
+ if { $no_o_id eq "" } { break }
+ mariaexec $maria_handler "DELETE FROM new_order WHERE no_w_id = $w_id AND no_d_id = $d_d_id AND no_o_id = $no_o_id"
+ set o_c_id [ list [ maria::sel $maria_handler "SELECT o_c_id FROM orders WHERE o_id = $no_o_id AND o_d_id = $d_d_id AND o_w_id = $w_id" -list ]]
+ mariaexec $maria_handler "UPDATE orders SET o_carrier_id = $carrier_id WHERE o_id = $no_o_id AND o_d_id = $d_d_id AND o_w_id = $w_id"
+ mariaexec $maria_handler "UPDATE order_line SET ol_delivery_d = str_to_date($date,'%Y%m%d%H%i%s') WHERE ol_o_id = $no_o_id AND ol_d_id = $d_d_id AND ol_w_id = $w_id"
+ set d_ol_total [ list [ maria::sel $maria_handler "SELECT SUM(ol_amount) FROM order_line WHERE ol_o_id = $no_o_id AND ol_d_id = $d_d_id AND ol_w_id = $w_id" -list ]]
+ mariaexec $maria_handler "UPDATE customer SET c_balance = c_balance + $d_ol_total WHERE c_id = $o_c_id AND c_d_id = $d_d_id AND c_w_id = $w_id"
+ incr loop_counter
+ }
+ maria::commit $maria_handler
+ }
+ set stockbody {
+ global mariastatus
+ set threshold [ RandomNumber 10 20 ]
+ mariaexec $maria_handler "start transaction"
+ set d_next_o_id [ list [ maria::sel $maria_handler "SELECT d_next_o_id FROM district WHERE d_w_id=$w_id AND d_id=$stock_level_d_id" -list ]]
+ set stock_count [ list [ maria::sel $maria_handler "SELECT COUNT(DISTINCT (s_i_id)) FROM order_line, stock WHERE ol_w_id = $w_id AND ol_d_id = $stock_level_d_id AND (ol_o_id < $d_next_o_id) AND ol_o_id >= ($d_next_o_id - 20) AND s_w_id = $w_id AND s_i_id = ol_i_id AND s_quantity < $threshold" -list ]]
+ maria::commit $maria_handler
+ }
+ if { $testtype eq "test" } {
+ set newordtail {puts "$discount,$last,$credit,$dtax,$wtax,$next_o_id"
+ }
+ set paytail {puts "$p_c_id,$p_c_last,$p_w_street_1,$p_w_street_2,$p_w_city,$p_w_state,$p_w_zip,$p_d_street_1,$p_d_street_2,$p_d_city,$p_d_state,$p_d_zip,$p_c_first,$p_c_middle,$p_c_street_1,$p_c_street_2,$p_c_city,$p_c_state,$p_c_zip,$p_c_phone,$p_c_since,$p_c_credit,$p_c_credit_lim,$p_c_discount,$p_c_balance,$c_data"
+ }
+ set ostattail {puts "$c_id,$os_c_last,$os_c_first,$os_c_middle,$os_c_balance,$o_id,$o_entry_d,$o_carrier_id"
+ }
+ set delivtail {puts "$w_id $carrier_id $date"
+ }
+ set stocktail {puts "$stock_count"
+ }
+ } else {
+ foreach tl {newordtail paytail ostattail delivtail stocktail} { set $tl ""}
+ }
+ #Build procs for correct workload
+ append neword_no_sp $newordargs $newordbody $newordtail "\}"
+ append pay_no_sp $payargs $paybody $paytail "\}"
+ append ostat_no_sp $ostatargs $ostatbody $ostattail "\}"
+ append deliv_no_sp $delivargs $delivbody $delivtail "\}"
+ append stock_no_sp $stockargs $stockbody $stocktail "\}"
+
+ set index_sp_1 [.ed_mainFrame.mainwin.textFrame.left.text search -forwards "\#NEW ORDER" 1.0 ]
+ set index_sp_2 [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "proc prep_statement" end ]
+ #End of run loop is previous line
+ #CLI indexes are characters in the string and integers GUI indexes are based on lines and position. Move back 1 line
+ if { [ string is entier $index_sp_2 ] } {
+ set index_sp_2 [ expr $index_sp_2 - 10 ]
+ } else {
+ set index_sp_2 [ expr $index_sp_2 - 1 ]
+ }
+ #Delete stored procedures
+ .ed_mainFrame.mainwin.textFrame.left.text fastdelete $index_sp_1 $index_sp_2+1l
+ #Insert no stored procedures version
+ .ed_mainFrame.mainwin.textFrame.left.text fastinsert $index_sp_1 "$neword_no_sp \n\n $pay_no_sp \n\n $ostat_no_sp \n\n $deliv_no_sp \n\n $stock_no_sp \n\n"
+}
+
proc loadmariatpcc { } {
global _ED maria_ssl_options
upvar #0 dbdict dbdict
@@ -1689,6 +1988,10 @@ mariaclose $maria_handler
}
if { $maria_connect_pool } {
insert_mariaconnectpool_drivescript test sync
+} else {
+if { $maria_no_stored_procs } {
+insert_maria_no_stored_procs test sync
+}
}
}
@@ -2090,6 +2393,10 @@ mariaclose $maria_handler
}}
if { $maria_connect_pool } {
insert_mariaconnectpool_drivescript timed sync
+} else {
+if { $maria_no_stored_procs } {
+insert_maria_no_stored_procs timed sync
+}
}
} else {
#ASYNCHRONOUS TIMED SCRIPT
@@ -2556,6 +2863,10 @@ switch $myposition {
#Close bracket of fast insert must come directly after inserted code without newline
if { $maria_connect_pool } {
insert_mariaconnectpool_drivescript timed async
+} else {
+if { $maria_no_stored_procs } {
+insert_maria_no_stored_procs timed async
+}
}
}
}
diff --git a/src/mariadb/mariaopt.tcl b/src/mariadb/mariaopt.tcl
index 66d98970..863a8b82 100755
--- a/src/mariadb/mariaopt.tcl
+++ b/src/mariadb/mariaopt.tcl
@@ -384,7 +384,7 @@ proc configmariatpcc {option} {
#set variables to values in dict
setlocaltpccvars $configmariadb
- set tpccfields [ dict create tpcc {maria_user {.tpc.f1.e3 get} maria_pass {.tpc.f1.e4 get} maria_dbase {.tpc.f1.e5 get} maria_storage_engine {.tpc.f1.e6 get} maria_total_iterations {.tpc.f1.e14 get} maria_rampup {.tpc.f1.e17 get} maria_duration {.tpc.f1.e18 get} maria_async_client {.tpc.f1.e22 get} maria_async_delay {.tpc.f1.e23 get} maria_count_ware $maria_count_ware maria_num_vu $maria_num_vu maria_partition $maria_partition maria_driver $maria_driver maria_raiseerror $maria_raiseerror maria_keyandthink $maria_keyandthink maria_allwarehouse $maria_allwarehouse maria_timeprofile $maria_timeprofile maria_async_scale $maria_async_scale maria_async_verbose $maria_async_verbose maria_prepared $maria_prepared maria_connect_pool $maria_connect_pool maria_history_pk $maria_history_pk} ]
+ set tpccfields [ dict create tpcc {maria_user {.tpc.f1.e3 get} maria_pass {.tpc.f1.e4 get} maria_dbase {.tpc.f1.e5 get} maria_storage_engine {.tpc.f1.e6 get} maria_total_iterations {.tpc.f1.e14 get} maria_rampup {.tpc.f1.e17 get} maria_duration {.tpc.f1.e18 get} maria_async_client {.tpc.f1.e22 get} maria_async_delay {.tpc.f1.e23 get} maria_count_ware $maria_count_ware maria_num_vu $maria_num_vu maria_partition $maria_partition maria_driver $maria_driver maria_raiseerror $maria_raiseerror maria_keyandthink $maria_keyandthink maria_allwarehouse $maria_allwarehouse maria_timeprofile $maria_timeprofile maria_async_scale $maria_async_scale maria_async_verbose $maria_async_verbose maria_prepared $maria_prepared maria_no_stored_procs $maria_no_stored_procs maria_connect_pool $maria_connect_pool maria_history_pk $maria_history_pk} ]
if {![string match windows $::tcl_platform(platform)]} {
set platform "lin"
set mariaconn [ dict create connection {maria_host {.tpc.f1.e1 get} maria_port {.tpc.f1.e2 get} maria_socket {.tpc.f1.e2a get} maria_ssl_ca {.tpc.f1.e2d get} maria_ssl_cert {.tpc.f1.e2e get} maria_ssl_key {.tpc.f1.e2f get} maria_ssl_cipher {.tpc.f1.e2g get} maria_ssl $maria_ssl maria_ssl_two_way $maria_ssl_two_way maria_ssl_linux_capath $maria_ssl_linux_capath} ]
@@ -723,12 +723,36 @@ proc configmariatpcc {option} {
ttk::checkbutton $Name -text "" -variable maria_prepared -onvalue "true" -offvalue "false"
grid $Prompt -column 0 -row 27 -sticky e
grid $Name -column 1 -row 27 -sticky w
+ if { $maria_connect_pool } { set maria_prepared "true"
+ .tpc.f1.e16a configure -state disabled
+ }
+ bind .tpc.f1.e16a {
+ if { $maria_prepared eq "false" } {
+ set maria_no_stored_procs "false"
+ .tpc.f1.e16b configure -state disabled
+ } else {
+ if { $maria_connect_pool eq "false" } {
+ .tpc.f1.e16b configure -state normal
+ }
+ }
+ }
+ set Prompt $Parent.f1.p16b
+ ttk::label $Prompt -text "No Stored Procedures :"
+ set Name $Parent.f1.e16b
+ ttk::checkbutton $Name -text "" -variable maria_no_stored_procs -onvalue "true" -offvalue "false"
+ grid $Prompt -column 0 -row 28 -sticky e
+ grid $Name -column 1 -row 28 -sticky w
+ if { $maria_connect_pool || $maria_prepared } {
+ set maria_no_stored_procs "false"
+ .tpc.f1.e16b configure -state disabled
+ }
+
set Name $Parent.f1.e17
set Prompt $Parent.f1.p17
ttk::label $Prompt -text "Minutes of Rampup Time :"
ttk::entry $Name -width 30 -textvariable maria_rampup
- grid $Prompt -column 0 -row 28 -sticky e
- grid $Name -column 1 -row 28 -sticky ew
+ grid $Prompt -column 0 -row 29 -sticky e
+ grid $Name -column 1 -row 29 -sticky ew
if {$maria_driver == "test" } {
$Name configure -state disabled
@@ -738,8 +762,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p18
ttk::label $Prompt -text "Minutes for Test Duration :"
ttk::entry $Name -width 30 -textvariable maria_duration
- grid $Prompt -column 0 -row 29 -sticky e
- grid $Name -column 1 -row 29 -sticky ew
+ grid $Prompt -column 0 -row 30 -sticky e
+ grid $Name -column 1 -row 30 -sticky ew
if {$maria_driver == "test" } {
$Name configure -state disabled
@@ -749,8 +773,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p19
ttk::label $Prompt -text "Use All Warehouses :"
ttk::checkbutton $Name -text "" -variable maria_allwarehouse -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 30 -sticky e
- grid $Name -column 1 -row 30 -sticky ew
+ grid $Prompt -column 0 -row 31 -sticky e
+ grid $Name -column 1 -row 31 -sticky ew
if {$maria_driver == "test" } {
$Name configure -state disabled
@@ -760,8 +784,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p20
ttk::label $Prompt -text "Time Profile :"
ttk::checkbutton $Name -text "" -variable maria_timeprofile -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 31 -sticky e
- grid $Name -column 1 -row 31 -sticky ew
+ grid $Prompt -column 0 -row 32 -sticky e
+ grid $Name -column 1 -row 32 -sticky ew
if {$maria_driver == "test" } {
$Name configure -state disabled
@@ -771,8 +795,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p21
ttk::label $Prompt -text "Asynchronous Scaling :"
ttk::checkbutton $Name -text "" -variable maria_async_scale -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 32 -sticky e
- grid $Name -column 1 -row 32 -sticky ew
+ grid $Prompt -column 0 -row 33 -sticky e
+ grid $Name -column 1 -row 33 -sticky ew
if {$maria_driver == "test" } {
set maria_async_scale "false"
@@ -799,8 +823,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p22
ttk::label $Prompt -text "Asynch Clients per Virtual User :"
ttk::entry $Name -width 30 -textvariable maria_async_client
- grid $Prompt -column 0 -row 33 -sticky e
- grid $Name -column 1 -row 33 -sticky ew
+ grid $Prompt -column 0 -row 34 -sticky e
+ grid $Name -column 1 -row 34 -sticky ew
if {$maria_driver == "test" || $maria_async_scale == "false" } {
$Name configure -state disabled
@@ -810,8 +834,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p23
ttk::label $Prompt -text "Asynch Client Login Delay :"
ttk::entry $Name -width 30 -textvariable maria_async_delay
- grid $Prompt -column 0 -row 34 -sticky e
- grid $Name -column 1 -row 34 -sticky ew
+ grid $Prompt -column 0 -row 35 -sticky e
+ grid $Name -column 1 -row 35 -sticky ew
if {$maria_driver == "test" || $maria_async_scale == "false" } {
$Name configure -state disabled
@@ -821,8 +845,8 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p24
ttk::label $Prompt -text "Asynchronous Verbose :"
ttk::checkbutton $Name -text "" -variable maria_async_verbose -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 35 -sticky e
- grid $Name -column 1 -row 35 -sticky ew
+ grid $Prompt -column 0 -row 36 -sticky e
+ grid $Name -column 1 -row 36 -sticky ew
if {$maria_driver == "test" || $maria_async_scale == "false" } {
set maria_async_verbose "false"
@@ -833,8 +857,27 @@ proc configmariatpcc {option} {
set Prompt $Parent.f1.p25
ttk::label $Prompt -text "XML Connect Pool :"
ttk::checkbutton $Name -text "" -variable maria_connect_pool -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 36 -sticky e
- grid $Name -column 1 -row 36 -sticky ew
+ grid $Prompt -column 0 -row 37 -sticky e
+ grid $Name -column 1 -row 37 -sticky ew
+
+ if {$maria_connect_pool == "true" } {
+ set maria_prepared "true"
+ set maria_no_stored_procs "false"
+ }
+
+ bind .tpc.f1.e25 {
+ if { $maria_connect_pool eq "false" } {
+ set maria_prepared "true"
+ set maria_no_stored_procs "false"
+ .tpc.f1.e16a configure -state disabled
+ if { $maria_prepared eq "true" } {
+ .tpc.f1.e16b configure -state disabled
+ }
+ } else {
+ set maria_no_stored_procs "false"
+ .tpc.f1.e16a configure -state normal
+ }
+ }
}
#This is the Cancel button variables stay as before
diff --git a/src/mysql/mysqloltp.tcl b/src/mysql/mysqloltp.tcl
index 287aaf6f..46a1aedd 100755
--- a/src/mysql/mysqloltp.tcl
+++ b/src/mysql/mysqloltp.tcl
@@ -1342,6 +1342,305 @@ mysqlclose $mmysql_handler
}
}
+proc insert_mysql_no_stored_procs { testtype timedtype } {
+ #No stored procedure code is different in arguments and whether output is printed
+ #for timed and test workloads and sync and async
+ #body is the same
+ #Build up procs so body is not repeated
+ #Replace existing stored proc calls with client version
+ if { $timedtype eq "sync" } {
+ set newordargs "#NEW ORDER
+ proc neword { mysql_handler no_w_id w_id_input prepare RAISEERROR } \{
+ "
+ set payargs "#PAYMENT
+ proc payment { mysql_handler p_w_id w_id_input prepare RAISEERROR } \{
+ "
+ set ostatargs "#ORDER_STATUS
+ proc ostat { mysql_handler w_id prepare RAISEERROR } \{
+ "
+ set delivargs "#DELIVERY
+ proc delivery { mysql_handler w_id prepare RAISEERROR } \{
+ "
+ set stockargs "#STOCK LEVEL
+ proc slev { mysql_handler w_id stock_level_d_id prepare RAISEERROR } \{
+ "
+ } else {
+ set newordargs "#NEW ORDER
+ proc neword { mysql_handler no_w_id w_id_input prepare RAISEERROR clientname} \{
+ "
+ set payargs "#PAYMENT
+ proc payment { mysql_handler p_w_id w_id_input prepare RAISEERROR clientname} \{
+ "
+ set ostatargs "#ORDER_STATUS
+ proc ostat { mysql_handler w_id prepare RAISEERROR clientname} \{
+ "
+ set delivargs "#DELIVERY
+ proc delivery { mysql_handler w_id prepare RAISEERROR clientname} \{
+ "
+ set stockargs "#STOCK LEVEL
+ proc slev { mysql_handler w_id stock_level_d_id prepare RAISEERROR clientname} \{
+ "
+ }
+
+ set newordbody {
+ global mysqlstatus
+ #open new order cursor
+ #2.4.1.2 select district id randomly from home warehouse where d_w_id = d_id
+ set no_d_id [ RandomNumber 1 10 ]
+ #2.4.1.2 Customer id randomly selected where c_d_id = d_id and c_w_id = w_id
+ set no_c_id [ RandomNumber 1 3000 ]
+ #2.4.1.3 Items in the order randomly selected from 5 to 15
+ set ol_cnt [ RandomNumber 5 15 ]
+ #2.4.1.6 order entry date O_ENTRY_D generated by SUT
+ set date [ gettimestamp ]
+ set no_max_w_id $w_id_input
+
+ set no_o_all_local 1
+ set cust_ware [ mysql::sel $mysql_handler "SELECT c_discount, c_last, c_credit, w_tax FROM customer, warehouse WHERE warehouse.w_id = $no_w_id AND customer.c_w_id = $no_w_id AND customer.c_d_id = $no_d_id AND customer.c_id = $no_c_id" -flatlist ]
+ lassign $cust_ware discount last credit wtax
+ mysqlexec $mysql_handler "start transaction"
+ set o_id_tax_list [ mysql::sel $mysql_handler "SELECT d_next_o_id, d_tax FROM district WHERE d_id = $no_d_id AND d_w_id = $no_w_id FOR UPDATE" -flatlist ]
+ lassign $o_id_tax_list next_o_id dtax
+ mysqlexec $mysql_handler "UPDATE district SET d_next_o_id = d_next_o_id + 1 WHERE d_id = $no_d_id AND d_w_id = $no_w_id"
+ set o_id [ lindex $o_id_tax_list 0 ]
+ set no_c_discount [ lindex $cust_ware 0 ]
+ set no_w_tax [ lindex $cust_ware 3 ]
+ set no_d_tax [ lindex $o_id_tax_list 1 ]
+ set rbk [ RandomNumber 1 99 ]
+ set loop_counter 1
+ while { $loop_counter <= $ol_cnt } {
+ if { ($loop_counter eq $ol_cnt) && $rbk eq 1 } {
+ set no_ol_i_id 100001
+ } else {
+ set no_ol_i_id [ RandomNumber 1 100000 ]
+ }
+ set x [ RandomNumber 1 100 ]
+ if { $x > 1 } {
+ set no_ol_supply_w_id $no_w_id
+ } else {
+ set no_ol_supply_w_id $no_w_id
+ set no_o_all_local 0
+ while { ($no_ol_supply_w_id eq $no_w_id) && ($no_max_w_id != 1) } {
+ set no_ol_supply_w_id [ RandomNumber 1 $no_max_w_id ]
+ }
+ }
+ set no_ol_quantity [ RandomNumber 1 10 ]
+ set price_name_data [ mysql::sel $mysql_handler "SELECT i_price, i_name, i_data FROM item WHERE i_id = $no_ol_i_id" -flatlist ]
+ if { [ llength $price_name_data ] eq 0 } {
+ mysql::rollback $mysql_handler
+ return
+ }
+ set quantity_data_dist [ mysql::sel $mysql_handler "SELECT s_quantity, s_data, s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_dist_05, s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10 FROM stock WHERE s_i_id = $no_ol_i_id AND s_w_id = $no_ol_supply_w_id" -flatlist ]
+ set no_i_price [ lindex $price_name_data 0 ]
+ set no_s_quantity [ lindex $quantity_data_dist 0 ]
+ if { $no_s_quantity > $no_ol_quantity } {
+ set no_s_quantity [ expr {$no_s_quantity - $no_ol_quantity} ]
+ } else {
+ set no_s_quantity [ expr {$no_s_quantity - $no_ol_quantity + 91} ]
+ }
+ mysqlexec $mysql_handler "UPDATE stock SET s_quantity = $no_s_quantity WHERE s_i_id = $no_ol_i_id AND s_w_id = $no_ol_supply_w_id"
+ set no_ol_amount [ expr {($no_ol_quantity * $no_i_price * ( 1 + $no_w_tax + $no_d_tax ) * ( 1 - $no_c_discount ))} ]
+ switch $no_d_id {
+ 1 { set no_ol_dist_info [ lindex $quantity_data_dist 2 ] }
+ 2 { set no_ol_dist_info [ lindex $quantity_data_dist 3 ] }
+ 3 { set no_ol_dist_info [ lindex $quantity_data_dist 4 ] }
+ 4 { set no_ol_dist_info [ lindex $quantity_data_dist 5 ] }
+ 5 { set no_ol_dist_info [ lindex $quantity_data_dist 6 ] }
+ 6 { set no_ol_dist_info [ lindex $quantity_data_dist 7 ] }
+ 7 { set no_ol_dist_info [ lindex $quantity_data_dist 8 ] }
+ 8 { set no_ol_dist_info [ lindex $quantity_data_dist 9 ] }
+ 9 { set no_ol_dist_info [ lindex $quantity_data_dist 10 ] }
+ 10 { set no_ol_dist_info [ lindex $quantity_data_dist 11 ] }
+ }
+ mysqlexec $mysql_handler "INSERT INTO order_line (ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_dist_info) VALUES ($o_id, $no_d_id, $no_w_id, $loop_counter, $no_ol_i_id, $no_ol_supply_w_id, $no_ol_quantity, $no_ol_amount, '$no_ol_dist_info')"
+ incr loop_counter
+ }
+ mysqlexec $mysql_handler "INSERT INTO orders (o_id, o_d_id, o_w_id, o_c_id, o_entry_d, o_ol_cnt, o_all_local) VALUES ($o_id, $no_d_id, $no_w_id, $no_c_id, $date, $ol_cnt, $no_o_all_local)"
+ mysqlexec $mysql_handler "INSERT INTO new_order (no_o_id, no_d_id, no_w_id) VALUES ($o_id, $no_d_id, $no_w_id)"
+ mysql::commit $mysql_handler
+ }
+ set paybody {
+ global mysqlstatus
+ #2.5.1.1 The home warehouse id remains the same for each terminal
+ #2.5.1.1 select district id randomly from home warehouse where d_w_id = d_id
+ set p_d_id [ RandomNumber 1 10 ]
+ #2.5.1.2 customer selected 60% of time by name and 40% of time by number
+ set x [ RandomNumber 1 100 ]
+ set y [ RandomNumber 1 100 ]
+ if { $x <= 85 } {
+ set p_c_d_id $p_d_id
+ set p_c_w_id $p_w_id
+ } else {
+ #use a remote warehouse
+ set p_c_d_id [ RandomNumber 1 10 ]
+ set p_c_w_id [ RandomNumber 1 $w_id_input ]
+ while { ($p_c_w_id == $p_w_id) && ($w_id_input != 1) } {
+ set p_c_w_id [ RandomNumber 1 $w_id_input ]
+ }
+ }
+ set nrnd [ NURand 255 0 999 123 ]
+ set name [ randname $nrnd ]
+ set p_c_id [ RandomNumber 1 3000 ]
+ if { $y <= 60 } {
+ #use customer name
+ #C_LAST is generated
+ set byname 1
+ } else {
+ #use customer number
+ set byname 0
+ set name {}
+ }
+ #2.5.1.3 random amount from 1 to 5000
+ set p_h_amount [ RandomNumber 1 5000 ]
+ #2.5.1.4 date selected from SUT
+ set h_date [ gettimestamp ]
+ #2.5.2.1 Payment Transaction
+ mysqlexec $mysql_handler "start transaction"
+ mysqlexec $mysql_handler "UPDATE warehouse SET w_ytd = w_ytd + $p_h_amount WHERE w_id = $p_w_id"
+ set w_address_list [ mysql::sel $mysql_handler "SELECT w_street_1, w_street_2, w_city, w_state, w_zip, w_name FROM warehouse WHERE w_id = $p_w_id" -flatlist ]
+ lassign $w_address_list p_w_street_1 p_w_street_2 p_w_city p_w_state p_w_zip p_w_name
+ set p_w_name [ lindex $w_address_list 5 ]
+ mysqlexec $mysql_handler "UPDATE district SET d_ytd = d_ytd + $p_h_amount WHERE d_w_id = $p_w_id AND d_id = $p_d_id"
+ set d_address_list [ mysql::sel $mysql_handler "SELECT d_street_1, d_street_2, d_city, d_state, d_zip, d_name FROM district WHERE d_w_id = $p_w_id AND d_id = $p_d_id" -flatlist ]
+ lassign $d_address_list p_d_street_1 p_d_street_2 p_d_city p_d_state p_d_zip p_d_name
+ set p_d_name [ lindex $d_address_list 5 ]
+ if { $byname } {
+ set namecnt [ mysql::sel $mysql_handler "SELECT count(c_id) FROM customer WHERE c_last = '$name' AND c_d_id = $p_c_d_id AND c_w_id = $p_c_w_id" -flatlist ]
+ set cust_list [ mysql::sel $mysql_handler "SELECT c_first, c_middle, c_id, c_street_1, c_street_2, c_city, c_state, c_zip, c_phone, c_credit, c_credit_lim, c_discount, c_balance, c_since FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_last = '$name' ORDER BY c_first" -list ]
+ if { [ expr {$namecnt % 2} ] eq 1 } {
+ set $namecnt [ expr {$namecnt + 1} ]
+ }
+ set cust_id_to_query [ lindex $cust_list [ expr {$namecnt / 2} ] ]
+ lassign $cust_id_to_query p_c_first p_c_middle p_c_id p_c_street_1 p_c_street_2 p_c_city p_c_state p_c_zip p_c_phone p_c_credit p_c_credit_lim p_c_discount p_c_balance p_c_since
+ set p_c_last $name
+ } else {
+ set cust_id_to_query [ mysql::sel $mysql_handler "SELECT c_first, c_middle, c_last, c_street_1, c_street_2, c_city, c_state, c_zip, c_phone, c_credit, c_credit_lim, c_discount, c_balance, c_since FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id" -flatlist ]
+ lassign $cust_id_to_query p_c_first p_c_middle p_c_last p_c_street_1 p_c_street_2 p_c_city p_c_state p_c_zip p_c_phone p_c_credit p_c_credit_lim p_c_discount p_c_balance p_c_since
+ }
+ if { $p_c_balance eq "" } { set p_c_balance 0 }
+ set p_c_balance [ expr {$p_c_balance + $p_h_amount} ]
+ if { $p_c_credit eq "BC" } {
+ set c_data [ join [ mysql::sel $mysql_handler "SELECT c_data FROM customer WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id" -flatlist ]]
+ set h_data [ concat $p_w_name $p_d_name ]
+ set p_c_new_data [ concat p_c_id $p_c_id p_c_d_id $p_c_d_id p_c_w_id $p_c_w_id p_d_id $p_d_id p_w_id $p_w_id p_h_amount [ format %4.2f $p_h_amount ] h_date $h_date h_data $h_data ]
+ set p_c_new_data [ string range [ concat $p_c_new_data $c_data ] 1 [ expr 500 - [ string length $p_c_new_data ] ] ]
+ mysqlexec $mysql_handler "UPDATE customer SET c_balance = $p_c_balance, c_data = '$p_c_new_data' WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id"
+ } else {
+ mysqlexec $mysql_handler "UPDATE customer SET c_balance = $p_c_balance WHERE c_w_id = $p_c_w_id AND c_d_id = $p_c_d_id AND c_id = $p_c_id"
+ set c_data ""
+ }
+ set h_data [ concat $p_w_name $p_d_name ]
+ mysqlexec $mysql_handler "INSERT INTO history (h_c_d_id, h_c_w_id, h_c_id, h_d_id, h_w_id, h_date, h_amount, h_data) VALUES ($p_c_d_id, $p_c_w_id, $p_c_id, $p_d_id, $p_w_id, $h_date, $p_h_amount, '$h_data')"
+ mysql::commit $mysql_handler
+ }
+ set ostatbody {
+ global mysqlstatus
+ #2.5.1.1 select district id randomly from home warehouse where d_w_id = d_id
+ set d_id [ RandomNumber 1 10 ]
+ set nrnd [ NURand 255 0 999 123 ]
+ set name [ randname $nrnd ]
+ set c_id [ RandomNumber 1 3000 ]
+ set y [ RandomNumber 1 100 ]
+ if { $y <= 60 } {
+ set byname 1
+ } else {
+ set byname 0
+ set name {}
+ }
+ mysqlexec $mysql_handler "start transaction"
+ if { $byname eq 1 } {
+ set namecnt [ list [ mysql::sel $mysql_handler "SELECT count(c_id) FROM customer WHERE c_last = '$name' AND c_d_id = $d_id AND c_w_id = $w_id" -list ]]
+ if { [ expr {$namecnt % 2} ] eq 1 } {
+ incr namecnt
+ }
+ set cust_list [ mysql::sel $mysql_handler "SELECT c_balance, c_first, c_middle, c_id FROM customer WHERE c_last = '$name' AND c_d_id = $d_id AND c_w_id = $w_id ORDER BY c_first" -list ]
+ set cust_id_to_query [ lindex $cust_list [ expr ($namecnt/2)-1 ] ]
+ } else {
+ set cust_id_to_query [ mysql::sel $mysql_handler "SELECT c_balance, c_first, c_middle, c_last FROM customer WHERE c_id = $c_id AND c_d_id = $d_id AND c_w_id = $w_id" -list ]
+ }
+ lassign $cust_id_to_query os_c_balance os_c_first os_c_middle os_c_last
+ set cust_orders [ mysql::sel $mysql_handler "SELECT o_id, o_carrier_id, o_entry_d FROM (SELECT o_id, o_carrier_id, o_entry_d FROM orders where o_d_id = $d_id AND o_w_id = $w_id and o_c_id = $c_id ORDER BY o_id DESC) AS sb LIMIT 1" -flatlist ]
+ if { [ llength $cust_orders ] eq 0 } {
+ set no_order_status "No orders for customer"
+ set o_id 0
+ } else {
+ lassign $cust_orders o_id o_carrier_id o_entry_d
+ }
+ set c_line [ mysql::sel $mysql_handler "SELECT ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_delivery_d FROM order_line WHERE ol_o_id = $o_id AND ol_d_id = $d_id AND ol_w_id = $w_id" -flatlist ]
+ foreach arr {os_ol_i_id_array os_ol_supply_w_id_array os_ol_quantity_array os_ol_amount_array os_ol_delivery_d_array os_ol_i_id_array } { set $arr "CSV," }
+ foreach {ol_i_id ol_supply_w_id ol_quantity ol_amount ol_delivery_d} $c_line {
+ lappend os_ol_i_id_array "$ol_i_id,"
+ lappend os_ol_supply_w_id_array "$ol_supply_w_id,"
+ lappend os_ol_quantity_array "$ol_quantity,"
+ lappend os_ol_amount_array "$ol_amount,"
+ lappend os_ol_delivery_d_array "$ol_delivery_d,"
+ }
+ mysql::commit $mysql_handler
+ }
+ set delivbody {
+ global mysqlstatus
+ set carrier_id [ RandomNumber 1 10 ]
+ set date [ gettimestamp ]
+ set loop_counter 1
+ mysqlexec $mysql_handler "start transaction"
+ while { $loop_counter <= 10 } {
+ set d_d_id $loop_counter
+ set no_o_id [ mysql::sel $mysql_handler "SELECT no_o_id FROM new_order WHERE no_w_id = $w_id AND no_d_id = $d_d_id LIMIT 1" -flatlist ]
+ if { $no_o_id eq "" } { break }
+ mysqlexec $mysql_handler "DELETE FROM new_order WHERE no_w_id = $w_id AND no_d_id = $d_d_id AND no_o_id = $no_o_id"
+ set o_c_id [ list [ mysql::sel $mysql_handler "SELECT o_c_id FROM orders WHERE o_id = $no_o_id AND o_d_id = $d_d_id AND o_w_id = $w_id" -list ]]
+ mysqlexec $mysql_handler "UPDATE orders SET o_carrier_id = $carrier_id WHERE o_id = $no_o_id AND o_d_id = $d_d_id AND o_w_id = $w_id"
+ mysqlexec $mysql_handler "UPDATE order_line SET ol_delivery_d = str_to_date($date,'%Y%m%d%H%i%s') WHERE ol_o_id = $no_o_id AND ol_d_id = $d_d_id AND ol_w_id = $w_id"
+ set d_ol_total [ list [ mysql::sel $mysql_handler "SELECT SUM(ol_amount) FROM order_line WHERE ol_o_id = $no_o_id AND ol_d_id = $d_d_id AND ol_w_id = $w_id" -list ]]
+ mysqlexec $mysql_handler "UPDATE customer SET c_balance = c_balance + $d_ol_total WHERE c_id = $o_c_id AND c_d_id = $d_d_id AND c_w_id = $w_id"
+ incr loop_counter
+ }
+ mysql::commit $mysql_handler
+ }
+ set stockbody {
+ global mysqlstatus
+ set threshold [ RandomNumber 10 20 ]
+ mysqlexec $mysql_handler "start transaction"
+ set d_next_o_id [ list [ mysql::sel $mysql_handler "SELECT d_next_o_id FROM district WHERE d_w_id=$w_id AND d_id=$stock_level_d_id" -list ]]
+ set stock_count [ list [ mysql::sel $mysql_handler "SELECT COUNT(DISTINCT (s_i_id)) FROM order_line, stock WHERE ol_w_id = $w_id AND ol_d_id = $stock_level_d_id AND (ol_o_id < $d_next_o_id) AND ol_o_id >= ($d_next_o_id - 20) AND s_w_id = $w_id AND s_i_id = ol_i_id AND s_quantity < $threshold" -list ]]
+ mysql::commit $mysql_handler
+ }
+ if { $testtype eq "test" } {
+ set newordtail {puts "$discount,$last,$credit,$dtax,$wtax,$next_o_id"
+ }
+ set paytail {puts "$p_c_id,$p_c_last,$p_w_street_1,$p_w_street_2,$p_w_city,$p_w_state,$p_w_zip,$p_d_street_1,$p_d_street_2,$p_d_city,$p_d_state,$p_d_zip,$p_c_first,$p_c_middle,$p_c_street_1,$p_c_street_2,$p_c_city,$p_c_state,$p_c_zip,$p_c_phone,$p_c_since,$p_c_credit,$p_c_credit_lim,$p_c_discount,$p_c_balance,$c_data"
+ }
+ set ostattail {puts "$c_id,$os_c_last,$os_c_first,$os_c_middle,$os_c_balance,$o_id,$o_entry_d,$o_carrier_id"
+ }
+ set delivtail {puts "$w_id $carrier_id $date"
+ }
+ set stocktail {puts "$stock_count"
+ }
+ } else {
+ foreach tl {newordtail paytail ostattail delivtail stocktail} { set $tl ""}
+ }
+ #Build procs for correct workload
+ append neword_no_sp $newordargs $newordbody $newordtail "\}"
+ append pay_no_sp $payargs $paybody $paytail "\}"
+ append ostat_no_sp $ostatargs $ostatbody $ostattail "\}"
+ append deliv_no_sp $delivargs $delivbody $delivtail "\}"
+ append stock_no_sp $stockargs $stockbody $stocktail "\}"
+
+ set index_sp_1 [.ed_mainFrame.mainwin.textFrame.left.text search -forwards "\#NEW ORDER" 1.0 ]
+ set index_sp_2 [.ed_mainFrame.mainwin.textFrame.left.text search -backwards "proc prep_statement" end ]
+ #End of run loop is previous line
+ #CLI indexes are characters in the string and integers GUI indexes are based on lines and position. Move back 1 line
+ if { [ string is entier $index_sp_2 ] } {
+ set index_sp_2 [ expr $index_sp_2 - 10 ]
+ } else {
+ set index_sp_2 [ expr $index_sp_2 - 1 ]
+ }
+ #Delete stored procedures
+ .ed_mainFrame.mainwin.textFrame.left.text fastdelete $index_sp_1 $index_sp_2+1l
+ #Insert no stored procedures version
+ .ed_mainFrame.mainwin.textFrame.left.text fastinsert $index_sp_1 "$neword_no_sp \n\n $pay_no_sp \n\n $ostat_no_sp \n\n $deliv_no_sp \n\n $stock_no_sp \n\n"
+}
+
proc loadmysqltpcc { } {
global _ED mysql_ssl_options
upvar #0 dbdict dbdict
@@ -1654,6 +1953,10 @@ mysqlclose $mysql_handler
}
if { $mysql_connect_pool } {
insert_mysqlconnectpool_drivescript test sync
+ } else {
+ if { $mysql_no_stored_procs } {
+ insert_mysql_no_stored_procs test sync
+}
}
}
@@ -2039,6 +2342,10 @@ mysqlclose $mysql_handler
}}
if { $mysql_connect_pool } {
insert_mysqlconnectpool_drivescript timed sync
+ } else {
+ if { $mysql_no_stored_procs } {
+ insert_mysql_no_stored_procs timed sync
+}
}
} else {
#ASYNCHRONOUS TIMED SCRIPT
@@ -2491,6 +2798,10 @@ switch $myposition {
#Close bracket of fast insert must come directly after inserted code without newline
if { $mysql_connect_pool } {
insert_mysqlconnectpool_drivescript timed async
+} else {
+if { $mysql_no_stored_procs } {
+insert_mysql_no_stored_procs timed async
+}
}
}
}
diff --git a/src/mysql/mysqlopt.tcl b/src/mysql/mysqlopt.tcl
index 13138394..aba1a077 100755
--- a/src/mysql/mysqlopt.tcl
+++ b/src/mysql/mysqlopt.tcl
@@ -372,7 +372,7 @@ proc configmysqltpcc {option} {
upvar #0 configmysql configmysql
#set variables to values in dict
setlocaltpccvars $configmysql
- set tpccfields [ dict create tpcc {mysql_user {.tpc.f1.e3 get} mysql_pass {.tpc.f1.e4 get} mysql_dbase {.tpc.f1.e5 get} mysql_storage_engine {.tpc.f1.e6 get} mysql_total_iterations {.tpc.f1.e14 get} mysql_rampup {.tpc.f1.e17 get} mysql_duration {.tpc.f1.e18 get} mysql_async_client {.tpc.f1.e22 get} mysql_async_delay {.tpc.f1.e23 get} mysql_count_ware $mysql_count_ware mysql_num_vu $mysql_num_vu mysql_partition $mysql_partition mysql_driver $mysql_driver mysql_raiseerror $mysql_raiseerror mysql_keyandthink $mysql_keyandthink mysql_allwarehouse $mysql_allwarehouse mysql_timeprofile $mysql_timeprofile mysql_async_scale $mysql_async_scale mysql_async_verbose $mysql_async_verbose mysql_prepared $mysql_prepared mysql_connect_pool $mysql_connect_pool mysql_history_pk $mysql_history_pk} ]
+ set tpccfields [ dict create tpcc {mysql_user {.tpc.f1.e3 get} mysql_pass {.tpc.f1.e4 get} mysql_dbase {.tpc.f1.e5 get} mysql_storage_engine {.tpc.f1.e6 get} mysql_total_iterations {.tpc.f1.e14 get} mysql_rampup {.tpc.f1.e17 get} mysql_duration {.tpc.f1.e18 get} mysql_async_client {.tpc.f1.e22 get} mysql_async_delay {.tpc.f1.e23 get} mysql_count_ware $mysql_count_ware mysql_num_vu $mysql_num_vu mysql_partition $mysql_partition mysql_driver $mysql_driver mysql_raiseerror $mysql_raiseerror mysql_keyandthink $mysql_keyandthink mysql_allwarehouse $mysql_allwarehouse mysql_timeprofile $mysql_timeprofile mysql_async_scale $mysql_async_scale mysql_async_verbose $mysql_async_verbose mysql_prepared $mysql_prepared mysql_no_stored_procs $mysql_no_stored_procs mysql_connect_pool $mysql_connect_pool mysql_history_pk $mysql_history_pk} ]
if {![string match windows $::tcl_platform(platform)]} {
set platform "lin"
set mysqlconn [ dict create connection {mysql_host {.tpc.f1.e1 get} mysql_port {.tpc.f1.e2 get} mysql_socket {.tpc.f1.e2a get} mysql_ssl_ca {.tpc.f1.e2d get} mysql_ssl_cert {.tpc.f1.e2e get} mysql_ssl_key {.tpc.f1.e2f get} mysql_ssl_cipher {.tpc.f1.e2g get} mysql_ssl $mysql_ssl mysql_ssl_two_way $mysql_ssl_two_way mysql_ssl_linux_capath $mysql_ssl_linux_capath} ]
@@ -693,12 +693,36 @@ proc configmysqltpcc {option} {
ttk::checkbutton $Name -text "" -variable mysql_prepared -onvalue "true" -offvalue "false"
grid $Prompt -column 0 -row 27 -sticky e
grid $Name -column 1 -row 27 -sticky w
+ if { $mysql_connect_pool } { set mysql_prepared "true"
+ .tpc.f1.e16a configure -state disabled
+ }
+ bind .tpc.f1.e16a {
+ if { $mysql_prepared eq "false" } {
+ set mysql_no_stored_procs "false"
+ .tpc.f1.e16b configure -state disabled
+ } else {
+ if { $mysql_connect_pool eq "false" } {
+ .tpc.f1.e16b configure -state normal
+ }
+ }
+ }
+ set Prompt $Parent.f1.p16b
+ ttk::label $Prompt -text "No Stored Procedures :"
+ set Name $Parent.f1.e16b
+ ttk::checkbutton $Name -text "" -variable mysql_no_stored_procs -onvalue "true" -offvalue "false"
+ grid $Prompt -column 0 -row 28 -sticky e
+ grid $Name -column 1 -row 28 -sticky w
+ if { $mysql_connect_pool || $mysql_prepared } {
+ set mysql_no_stored_procs "false"
+ .tpc.f1.e16b configure -state disabled
+ }
+
set Name $Parent.f1.e17
set Prompt $Parent.f1.p17
ttk::label $Prompt -text "Minutes of Rampup Time :"
ttk::entry $Name -width 30 -textvariable mysql_rampup
- grid $Prompt -column 0 -row 28 -sticky e
- grid $Name -column 1 -row 28 -sticky ew
+ grid $Prompt -column 0 -row 29 -sticky e
+ grid $Name -column 1 -row 29 -sticky ew
if {$mysql_driver == "test" } {
$Name configure -state disabled
}
@@ -706,8 +730,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p18
ttk::label $Prompt -text "Minutes for Test Duration :"
ttk::entry $Name -width 30 -textvariable mysql_duration
- grid $Prompt -column 0 -row 29 -sticky e
- grid $Name -column 1 -row 29 -sticky ew
+ grid $Prompt -column 0 -row 30 -sticky e
+ grid $Name -column 1 -row 30 -sticky ew
if {$mysql_driver == "test" } {
$Name configure -state disabled
}
@@ -715,8 +739,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p19
ttk::label $Prompt -text "Use All Warehouses :"
ttk::checkbutton $Name -text "" -variable mysql_allwarehouse -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 30 -sticky e
- grid $Name -column 1 -row 30 -sticky ew
+ grid $Prompt -column 0 -row 31 -sticky e
+ grid $Name -column 1 -row 31 -sticky ew
if {$mysql_driver == "test" } {
$Name configure -state disabled
}
@@ -724,8 +748,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p20
ttk::label $Prompt -text "Time Profile :"
ttk::checkbutton $Name -text "" -variable mysql_timeprofile -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 31 -sticky e
- grid $Name -column 1 -row 31 -sticky ew
+ grid $Prompt -column 0 -row 32 -sticky e
+ grid $Name -column 1 -row 32 -sticky ew
if {$mysql_driver == "test" } {
$Name configure -state disabled
}
@@ -733,8 +757,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p21
ttk::label $Prompt -text "Asynchronous Scaling :"
ttk::checkbutton $Name -text "" -variable mysql_async_scale -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 32 -sticky e
- grid $Name -column 1 -row 32 -sticky ew
+ grid $Prompt -column 0 -row 33 -sticky e
+ grid $Name -column 1 -row 33 -sticky ew
if {$mysql_driver == "test" } {
set mysql_async_scale "false"
$Name configure -state disabled
@@ -758,8 +782,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p22
ttk::label $Prompt -text "Asynch Clients per Virtual User :"
ttk::entry $Name -width 30 -textvariable mysql_async_client
- grid $Prompt -column 0 -row 33 -sticky e
- grid $Name -column 1 -row 33 -sticky ew
+ grid $Prompt -column 0 -row 34 -sticky e
+ grid $Name -column 1 -row 34 -sticky ew
if {$mysql_driver == "test" || $mysql_async_scale == "false" } {
$Name configure -state disabled
}
@@ -767,8 +791,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p23
ttk::label $Prompt -text "Asynch Client Login Delay :"
ttk::entry $Name -width 30 -textvariable mysql_async_delay
- grid $Prompt -column 0 -row 34 -sticky e
- grid $Name -column 1 -row 34 -sticky ew
+ grid $Prompt -column 0 -row 35 -sticky e
+ grid $Name -column 1 -row 35 -sticky ew
if {$mysql_driver == "test" || $mysql_async_scale == "false" } {
$Name configure -state disabled
}
@@ -776,8 +800,8 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p24
ttk::label $Prompt -text "Asynchronous Verbose :"
ttk::checkbutton $Name -text "" -variable mysql_async_verbose -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 35 -sticky e
- grid $Name -column 1 -row 35 -sticky ew
+ grid $Prompt -column 0 -row 36 -sticky e
+ grid $Name -column 1 -row 36 -sticky ew
if {$mysql_driver == "test" || $mysql_async_scale == "false" } {
set mysql_async_verbose "false"
$Name configure -state disabled
@@ -786,8 +810,27 @@ proc configmysqltpcc {option} {
set Prompt $Parent.f1.p25
ttk::label $Prompt -text "XML Connect Pool :"
ttk::checkbutton $Name -text "" -variable mysql_connect_pool -onvalue "true" -offvalue "false"
- grid $Prompt -column 0 -row 36 -sticky e
- grid $Name -column 1 -row 36 -sticky ew
+ grid $Prompt -column 0 -row 37 -sticky e
+ grid $Name -column 1 -row 37 -sticky ew
+
+ if {$mysql_connect_pool == "true" } {
+ set mysql_prepared "true"
+ set mysql_no_stored_procs "false"
+ }
+
+ bind .tpc.f1.e25 {
+ if { $mysql_connect_pool eq "false" } {
+ set mysql_prepared "true"
+ set mysql_no_stored_procs "false"
+ .tpc.f1.e16a configure -state disabled
+ if { $mysql_prepared eq "true" } {
+ .tpc.f1.e16b configure -state disabled
+ }
+ } else {
+ set mysql_no_stored_procs "false"
+ .tpc.f1.e16a configure -state normal
+ }
+ }
}
#This is the Cancel button variables stay as before
set Name $Parent.b2