From ebc5143889c8bfd39f6c8d333ede58cef66db516 Mon Sep 17 00:00:00 2001 From: Jiang-Hua Date: Wed, 13 Apr 2022 04:41:32 +0800 Subject: [PATCH] Save/load configuration to SQLite DB (#336) * Save/load parameter to SQLite * updated code indentation and comment Co-authored-by: Your Name --- config/generic.xml | 3 + src/db2/db2opt.tcl | 6 ++ src/generic/gencli.tcl | 18 ++++ src/generic/gened.tcl | 12 +++ src/generic/geninit.tcl | 52 ++++++++++-- src/generic/geninitcli.tcl | 49 +++++++++-- src/generic/geninitws.tcl | 47 +++++++++-- src/generic/genws.tcl | 15 ++++ src/generic/genxml.tcl | 150 ++++++++++++++++++++++++++++++++++ src/mariadb/mariaopt.tcl | 6 ++ src/mssqlserver/mssqlsopt.tcl | 5 ++ src/mysql/mysqlopt.tcl | 6 ++ src/oracle/oraopt.tcl | 6 ++ src/postgresql/pgopt.tcl | 7 ++ 14 files changed, 363 insertions(+), 19 deletions(-) diff --git a/config/generic.xml b/config/generic.xml index 470839c2..94c33b10 100755 --- a/config/generic.xml +++ b/config/generic.xml @@ -5,6 +5,9 @@ auto auto + + TMP + true diff --git a/src/db2/db2opt.tcl b/src/db2/db2opt.tcl index bde9c842..7d86e784 100755 --- a/src/db2/db2opt.tcl +++ b/src/db2/db2opt.tcl @@ -121,6 +121,7 @@ proc countdb2opts { bm } { if { $bm eq "TPC-C" } { ttk::button $Name -command { copyfieldstoconfig configdb2 [ subst $db2optsfields ] tpcc + Dict2SQLite "db2" $configdb2 unset db2optsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -138,6 +139,7 @@ proc countdb2opts { bm } { } else { ttk::button $Name -command { copyfieldstoconfig configdb2 [ subst $db2optsfields ] tpch + Dict2SQLite "db2" $configdb2 unset db2optsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -492,6 +494,7 @@ proc configdb2tpcc {option} { if {$db2_monreport >= $db2_duration} { set db2_monreport 0 } ttk::button $Name -command { copyfieldstoconfig configdb2 [ subst $db2fields ] tpcc + Dict2SQLite "db2" $configdb2 unset db2fields destroy .tpc loadtpcc @@ -502,6 +505,7 @@ proc configdb2tpcc {option} { set db2_count_ware [ verify_warehouse $db2_count_ware 100000 ] set db2_num_vu [ verify_build_threads $db2_num_vu $db2_count_ware 1024 ] copyfieldstoconfig configdb2 [ subst $db2fields ] tpcc + Dict2SQLite "db2" $configdb2 unset db2fields destroy .tpc } -text {OK} @@ -723,6 +727,7 @@ proc configdb2tpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configdb2 [ subst $db2fields ] tpch + Dict2SQLite "db2" $configdb2 unset db2fields destroy .db2tpch loadtpch @@ -732,6 +737,7 @@ proc configdb2tpch {option} { ttk::button $Name -command { set db2_num_tpch_threads [ verify_build_threads $db2_num_tpch_threads 512 512 ] copyfieldstoconfig configdb2 [ subst $db2fields ] tpch + Dict2SQLite "db2" $configdb2 unset db2fields destroy .db2tpch } -text {OK} diff --git a/src/generic/gencli.tcl b/src/generic/gencli.tcl index 43359240..0cfb99f0 100755 --- a/src/generic/gencli.tcl +++ b/src/generic/gencli.tcl @@ -529,6 +529,8 @@ proc diset { args } { putscli "Failed to set Dictionary value: $message" } else { putscli "Changed $dct:$key2 from $previous to [ concat $val ] for $rdbms" + #Save new value to SQLite + SQLiteUpdateKeyValue $key $dct $key2 $val remote_command [ concat diset $dct $key2 [ list \{$val\} ]] }} } else { @@ -603,6 +605,7 @@ proc dbset { args } { set rdbms [ lindex $dbl $ind ] remote_command [ concat dbset db $val ] putscli "Database set to $rdbms" + SQLiteUpdateKeyValue "generic" "benchmark" "rdbms" $rdbms } } bm { @@ -623,6 +626,7 @@ proc dbset { args } { set bm $dicttoup remote_command [ concat dbset bm $dicttoup ] putscli "Benchmark set to $toup for $rdbms" + SQLiteUpdateKeyValue "generic" "benchmark" "bm" $bm } } else { putscli "Unknown benchmark $toup, choose one from $posswkl2 (or compatible names $posswkl)" @@ -827,6 +831,17 @@ proc loadscript {} { putscli "Error:script failed to load" } remote_command [ concat loadscript ] + #Save dict(all config) to SQLite, if need group saving, uncomment + #upvar #0 dbdict dbdict + #foreach { key } [ dict keys $dbdict ] { + # if { [ dict get $dbdict $key name ] eq $rdbms } { + # set dbname $key + # set dictname config$key + # upvar #0 $dictname $dictname + # break + # } + #} + #Dict2SQLite $dbname [ dict get [ set $dictname ] ] } proc clearscript {} { @@ -918,6 +933,7 @@ proc buildschema {} { foreach { key } [ dict keys $dbdict ] { if { [ dict get $dbdict $key name ] eq $rdbms } { set dictname config$key + #set dbname $key upvar #0 $dictname $dictname break } @@ -981,6 +997,8 @@ proc buildschema {} { puts "Error: $message" } } + #Save dict(all config) to SQLite, if need group saving, uncomment + #Dict2SQLite $dbname [ dict get [ set $dictname ] ] } proc vurun {} { diff --git a/src/generic/gened.tcl b/src/generic/gened.tcl index 31865603..6bdd9e53 100755 --- a/src/generic/gened.tcl +++ b/src/generic/gened.tcl @@ -3034,6 +3034,18 @@ proc select_rdbms { preselect } { tk_messageBox -title "Confirm Benchmark" -message "[ regsub -all {(TP)(C)(-[CH])} $bm {\1RO\2\3} ] for $rdbms" remote_command [ concat vuser_bench_ops $rdbms $bm ] remote_command disable_bm_menu + + #Change the default database + #If only submit rdbms&bm to SQLite, uncomment the following + #SQLiteUpdateKeyValue "generic" "benchmark" "rdbms" $rdbms + #SQLiteUpdateKeyValue "generic" "benchmark" "bm" $bm + dict set genericdict "benchmark" "rdbms" $rdbms + dict set genericdict "benchmark" "bm" $bm + Dict2SQLite "generic" $genericdict + + #Change the order of databases in dbdict. If need, uncomment + #set dbdict [ SetKeyAsFirst $dbdict [ string tolower $rdbms ] ] + #Dict2SQLite "database" $dbdict } } -text OK grid $Parent.f1.ok -column 2 -row 8 -padx 3 -pady 3 -sticky e diff --git a/src/generic/geninit.tcl b/src/generic/geninit.tcl index 352e6651..fcd9241b 100755 --- a/src/generic/geninit.tcl +++ b/src/generic/geninit.tcl @@ -1,23 +1,61 @@ -#Load database config -set dbdict [ ::XML::To_Dict config/database.xml ] -#Change TPROC-x terminology to working TPC-x -set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] +package require sqlite3 + +#Get generic config data +set genericdict [ ::XML::To_Dict config/generic.xml ] + +#Get global variable sqlitedb_dir from generic.xml +if { [ dict exists $genericdict sqlitedb sqlitedb_dir ] } { + set sqlitedb_dir [ dict get $genericdict sqlitedb sqlitedb_dir ] +} else { + set sqlitedb_dir "" +} + +#Load database config from SQLite database.db +set dbdict [ SQLite2Dict "database" ] + +if { $dbdict eq "" } { + #Load database config from database.xml + set dbdict [ ::XML::To_Dict config/database.xml ] + + #Change TPROC-x terminology to working TPC-x + set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] + + #Save XML content to SQLite - database.db + Dict2SQLite "database" $dbdict +} + #Start the GUI using database config ed_start_gui $dbdict $icons $iconalt wm positionfrom . raise .ed_mainFrame + #Load database details in dict named configdbname foreach { key } [ dict keys $dbdict ] { set dictname config$key - set $dictname [ ::XML::To_Dict config/$key.xml ] + set dbconfdict [ SQLite2Dict $key ] + if { $dbconfdict eq "" } { + set dbconfdict [ ::XML::To_Dict config/$key.xml ] + Dict2SQLite $key $dbconfdict + } + set $dictname $dbconfdict set prefix [ dict get $dbdict $key prefix ] lappend dbsrclist "$key/$prefix\opt.tcl" "$key/$prefix\oltp.tcl" "$key/$prefix\olap.tcl" "$key/$prefix\otc.tcl" "$key/$prefix\met.tcl" } + #Get generic config data -set genericdict [ ::XML::To_Dict config/generic.xml ] -get_xml_data +set genericdictdb [ SQLite2Dict "generic" ] +if { $genericdictdb eq "" } { + Dict2SQLite "generic" $genericdict +} else { + set genericdict $genericdictdb +} + +#get_xml_data +set_globle_config $genericdict + #Make generics global tsv::set application genericdict $genericdict #Complete GUI using database config disable_bm_menu guid_init + diff --git a/src/generic/geninitcli.tcl b/src/generic/geninitcli.tcl index 0316a50c..a2d99ec7 100755 --- a/src/generic/geninitcli.tcl +++ b/src/generic/geninitcli.tcl @@ -1,16 +1,53 @@ -#Load database config -set dbdict [ ::XML::To_Dict config/database.xml ] -set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] +package require sqlite3 + +#Get generic config data +set genericdict [ ::XML::To_Dict config/generic.xml ] + +#Get global variable sqlitedb_dir from generic.xml +if { [ dict exists $genericdict sqlitedb sqlitedb_dir ] } { + set sqlitedb_dir [ dict get $genericdict sqlitedb sqlitedb_dir ] +} else { + set sqlitedb_dir "" +} + +#Load database config from SQLite database.db +set dbdict [ SQLite2Dict "database" ] +if { $dbdict eq "" } { + #Load database config from database.xml + set dbdict [ ::XML::To_Dict config/database.xml ] + + #Change TPROC-x terminology to working TPC-x + set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] + + #Save XML content to SQLite - database.db + Dict2SQLite "database" $dbdict +} + #Load database details in dict named configdbname foreach { key } [ dict keys $dbdict ] { set dictname config$key - set $dictname [ ::XML::To_Dict config/$key.xml ] + set dbconfdict [ SQLite2Dict $key ] + if { $dbconfdict eq "" } { + set dbconfdict [ ::XML::To_Dict config/$key.xml ] + Dict2SQLite $key $dbconfdict + } + set $dictname $dbconfdict set prefix [ dict get $dbdict $key prefix ] lappend dbsrclist "$key/$prefix\opt.tcl" "$key/$prefix\oltp.tcl" "$key/$prefix\olap.tcl" "$key/$prefix\otc.tcl" } + #Get generic config data -set genericdict [ ::XML::To_Dict config/generic.xml ] -get_xml_data +set genericdictdb [ SQLite2Dict "generic" ] +if { $genericdictdb eq "" } { + Dict2SQLite "generic" $genericdict +} else { + set genericdict $genericdictdb +} + +#get_xml_data +set_globle_config $genericdict + #Make generics global tsv::set application genericdict $genericdict guid_init + diff --git a/src/generic/geninitws.tcl b/src/generic/geninitws.tcl index 0316a50c..037ef19a 100755 --- a/src/generic/geninitws.tcl +++ b/src/generic/geninitws.tcl @@ -1,16 +1,51 @@ -#Load database config -set dbdict [ ::XML::To_Dict config/database.xml ] -set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] +package require sqlite3 + +#Get generic config data +set genericdict [ ::XML::To_Dict config/generic.xml ] + +#Get global variable sqlitedb_dir from generic.xml +if { [ dict exists $genericdict sqlitedb sqlitedb_dir ] } { + set sqlitedb_dir [ dict get $genericdict sqlitedb sqlitedb_dir ] +} else { + set sqlitedb_dir "" +} + +#Load database config from SQLite database.db +set dbdict [ SQLite2Dict "database" ] +if { $dbdict eq "" } { + #Load database config from database.xml + set dbdict [ ::XML::To_Dict config/database.xml ] + + #Change TPROC-x terminology to working TPC-x + set dbdict [ regsub -all {(TP)(RO)(C-[CH])} $dbdict {\1\3} ] + + #Save XML content to SQLite - database.db + Dict2SQLite "database" $dbdict +} + #Load database details in dict named configdbname foreach { key } [ dict keys $dbdict ] { set dictname config$key - set $dictname [ ::XML::To_Dict config/$key.xml ] + set dbconfdict [ SQLite2Dict $key ] + if { $dbconfdict eq "" } { + set dbconfdict [ ::XML::To_Dict config/$key.xml ] + Dict2SQLite $key $dbconfdict + } + set $dictname $dbconfdict set prefix [ dict get $dbdict $key prefix ] lappend dbsrclist "$key/$prefix\opt.tcl" "$key/$prefix\oltp.tcl" "$key/$prefix\olap.tcl" "$key/$prefix\otc.tcl" } + #Get generic config data -set genericdict [ ::XML::To_Dict config/generic.xml ] -get_xml_data +set genericdict [ SQLite2Dict "generic" ] +if { $genericdict eq "" } { + set genericdict [ ::XML::To_Dict config/generic.xml ] + Dict2SQLite "generic" $genericdict +} +#get_xml_data +set_globle_config $genericdict + #Make generics global tsv::set application genericdict $genericdict guid_init + diff --git a/src/generic/genws.tcl b/src/generic/genws.tcl index 988a999f..2f865ebe 100755 --- a/src/generic/genws.tcl +++ b/src/generic/genws.tcl @@ -741,6 +741,14 @@ proc diset { args } { set body [ subst { "dict": "$dct", "key": "$key2", "value": "$val" } ] set res [rest::post http://localhost:$ws_port/diset $body ] putscli $res + + #Save new value to SQLite + upvar #0 dbdict dbdict + foreach { key } [ dict keys $dbdict ] { + if { [ dict get $dbdict $key name ] eq $rdbms } { + SQLiteUpdateKeyValue $key $dct $key2 $val + } + } } } @@ -910,6 +918,13 @@ proc dbset { args } { set body [ subst { "$opt": "$val" } ] set res [rest::post http://localhost:$ws_port/dbset $body ] putscli $res + + #Save new setting to SQLite + if { $opt eq "db" } { + SQLiteUpdateKeyValue "generic" "benchmark" "rdbms" $val + } elseif { $opt eq "bm" } { + SQLiteUpdateKeyValue "generic" "benchmark" "bm" $val + } } } diff --git a/src/generic/genxml.tcl b/src/generic/genxml.tcl index a6d6117a..f6b75cd6 100755 --- a/src/generic/genxml.tcl +++ b/src/generic/genxml.tcl @@ -48,3 +48,153 @@ proc xmlopts {} { global rdbms puts "This function to write out XML data for database $rdbms" } + +proc set_globle_config {genericdict} { + global rdbms bm virtual_users maxvuser delayms conpause ntimes suppo optlog apmode apduration apsequence unique_log_name no_log_buffer log_timestamps interval hostname id agent_hostname agent_id highlight gen_count_ware gen_scale_fact gen_directory gen_num_vu + + if { $genericdict eq "" } { + puts "Error: empty genericdict" + } + + dict for {key attributes} $genericdict { + set tablename $key + dict for {subkey subattributes} $attributes { + set myvariable $subkey + switch $myvariable { + user_delay { set myvariable delayms } + repeat_delay { set myvariable conpause } + iterations { set myvariable ntimes } + show_output { set myvariable suppo } + log_to_temp { set myvariable optlog } + refresh_rate { set myvariable interval } + autopilot_mode { set myvariable apmode } + autopilot_duration { set myvariable apduration } + autopilot_sequence { set myvariable apsequence } + } + set [ set myvariable ] $subattributes + } + } +} + +proc Dict2SQLite {dbname dbdict} { + set sqlitedb [ CheckSQLiteDB $dbname ] + + if [catch {sqlite3 hdb $sqlitedb} message ] { + puts "Error initializing SQLite database : $message" + return + } else { + catch {hdb timeout 30000} + #puts "Initializing SQLite database : $sqlitedb" + if { $sqlitedb ne "" } { + dict for {key attributes} $dbdict { + set tablename $key + set sqlcmd "DROP TABLE $tablename" + catch {hdb eval $sqlcmd} + set sqlcmd "CREATE TABLE $tablename\(key TEXT, val TEXT)" + if [catch {hdb eval $sqlcmd} message ] { + puts "Error creating $tablename table in $sqlitedb : $message" + return + } + dict for {subkey subattributes} $attributes { + set sqlcmd "INSERT INTO $tablename\(key, val) VALUES(\'$subkey\', \'$subattributes\')" + hdb eval $sqlcmd + #puts "sqlcmd: $sqlcmd\n" + } + } + } + } +} + +proc SQLiteUpdateKeyValue {dbname table keyname value} { + set sqlitedb [ CheckSQLiteDB $dbname ] + + if [catch {sqlite3 hdb $sqlitedb} message ] { + puts "Error initializing SQLite database : $message" + return + } else { + catch {hdb timeout 30000} + if { $sqlitedb ne "" } { + set sqlcmd "UPDATE $table SET val = \'$value\' WHERE key = \'$keyname\'" + if [catch {hdb eval $sqlcmd} message ] { + puts "Error creating $tablename table in $sqlitedb : $message" + return + } + } + } + return +} + +proc SQLite2Dict {dbname} { + set sqlitedb [ CheckSQLiteDB $dbname ] + + if { $sqlitedb eq "" || ![file exists $sqlitedb] } { + #puts "No $sqlitedb found." + return + } + + if [catch {sqlite3 hdb $sqlitedb} message ] { + puts "Error initializing SQLite database : $message" + return + } else { + catch {hdb timeout 30000} + set sqlcmd "SELECT tbl_name FROM sqlite_master WHERE type=table" + catch {hdb eval $sqlcmd} + if [catch {set tbllist [ hdb eval {SELECT name FROM sqlite_master WHERE type='table'}]} message ] { + puts "Error querying table name in SQLite on-disk database : $message" + return + } else { + set maindict [ dict create ] + foreach tbl $tbllist { + set subdict [ dict create ] + set sqlcmd "SELECT key, val FROM $tbl" + hdb eval $sqlcmd { + dict append subdict $key $val + } + dict append maindict $tbl $subdict + } + return $maindict + } + } +} + +proc CheckSQLiteDB {dbname} { + global sqlitedb_dir + + if {$sqlitedb_dir eq ""} { + puts "Parameter sqlitedb_dir in generic.xml is empty. Use temp directory." + set sqlitedb_dir "TMP" + } + + if {$sqlitedb_dir ne "TMP"} { + if {(![file exists $sqlitedb_dir]) || + (![file readable $sqlitedb_dir]) || + (![file writable $sqlitedb_dir])} { + puts "Access $sqlitedb_dir exception. Use temp directory." + set tmpdir [ findtempdir ] + } else { + set tmpdir $sqlitedb_dir + } + } else { + set tmpdir [ findtempdir ] + } + + if { $tmpdir != "notmpdir" } { + set sqlitedb [ file join $tmpdir "$dbname\.db" ] + } else { + puts "Error Database Directory set to TMP but couldn't find temp directory" + return + } + + return $sqlitedb +} + +proc SetKeyAsFirst { olddict keyname } { + if { [ dict exists $olddict $keyname ] } { + set val [ dict get $olddict $keyname ] + dict remove $olddict $keyname + set newdict [ dict create $keyname $val ] + return [ dict merge $newdict $olddict ] + } else { + return + } +} \ No newline at end of file diff --git a/src/mariadb/mariaopt.tcl b/src/mariadb/mariaopt.tcl index 207e2d30..c19ef1b8 100755 --- a/src/mariadb/mariaopt.tcl +++ b/src/mariadb/mariaopt.tcl @@ -329,6 +329,7 @@ proc countmariaopts { bm } { if { $bm eq "TPC-C" } { ttk::button $Name -command { copyfieldstoconfig configmariadb [ subst $mariaoptsfields ] tpcc + Dict2SQLite "mariadb" $configmariadb unset mariaoptsfields check_maria_ssl $configmariadb if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" @@ -347,6 +348,7 @@ proc countmariaopts { bm } { } else { ttk::button $Name -command { copyfieldstoconfig configmariadb [ subst $mariaoptsfields ] tpch + Dict2SQLite "mariadb" $configmariadb unset mariaoptsfields check_maria_ssl $configmariadb if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" @@ -837,6 +839,7 @@ proc configmariatpcc {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmariadb [ subst $mariafields ] tpcc + Dict2SQLite "mariadb" $configmariadb unset mariafields check_maria_ssl $configmariadb destroy .tpc @@ -848,6 +851,7 @@ proc configmariatpcc {option} { set maria_count_ware [ verify_warehouse $maria_count_ware 100000 ] set maria_num_vu [ verify_build_threads $maria_num_vu $maria_count_ware 1024 ] copyfieldstoconfig configmariadb [ subst $mariafields ] tpcc + Dict2SQLite "mariadb" $configmariadb unset mariafields check_maria_ssl $configmariadb destroy .tpc @@ -1218,6 +1222,7 @@ proc configmariatpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmariadb [ subst $mariafields ] tpch + Dict2SQLite "mariadb" $configmariadb unset mariafields check_maria_ssl $configmariadb destroy .mytpch @@ -1228,6 +1233,7 @@ proc configmariatpch {option} { ttk::button $Name -command { set maria_num_tpch_threads [ verify_build_threads $maria_num_tpch_threads 512 512 ] copyfieldstoconfig configmariadb [ subst $mariafields ] tpch + Dict2SQLite "mariadb" $configmariadb unset mariafields check_maria_ssl $configmariadb destroy .mytpch diff --git a/src/mssqlserver/mssqlsopt.tcl b/src/mssqlserver/mssqlsopt.tcl index 5642f3c6..35cb06de 100755 --- a/src/mssqlserver/mssqlsopt.tcl +++ b/src/mssqlserver/mssqlsopt.tcl @@ -188,6 +188,7 @@ proc countmssqlsopts { bm } { set Name $Parent.b1 ttk::button $Name -command { copyfieldstoconfig configmssqlserver [ subst $mssqloptsfields ] tpcc + Dict2SQLite "mssqlserver" $configmssqlserver unset mssqloptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -617,6 +618,7 @@ proc configmssqlstpcc {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmssqlserver [ subst $mssqlsfields ] tpcc + Dict2SQLite "mssqlserver" $configmssqlserver unset mssqlsfields destroy .tpc loadtpcc @@ -627,6 +629,7 @@ proc configmssqlstpcc {option} { set mssqls_count_ware [ verify_warehouse $mssqls_count_ware 100000 ] set mssqls_num_vu [ verify_build_threads $mssqls_num_vu $mssqls_count_ware 1024 ] copyfieldstoconfig configmssqlserver [ subst $mssqlsfields ] tpcc + Dict2SQLite "mssqlserver" $configmssqlserver unset mssqlsfields destroy .tpc } -text {OK} @@ -920,6 +923,7 @@ proc configmssqlstpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmssqlserver [ subst $mssqlsfields ] tpch + Dict2SQLite "mssqlserver" $configmssqlserver unset mssqlsfields destroy .mssqlstpch loadtpch @@ -929,6 +933,7 @@ proc configmssqlstpch {option} { ttk::button $Name -command { set mssqls_num_tpch_threads [ verify_build_threads $mssqls_num_tpch_threads 512 512 ] copyfieldstoconfig configmssqlserver [ subst $mssqlsfields ] tpch + Dict2SQLite "mssqlserver" $configmssqlserver unset mssqlsfields destroy .mssqlstpch } -text {OK} diff --git a/src/mysql/mysqlopt.tcl b/src/mysql/mysqlopt.tcl index 88dbde1c..a51457a5 100755 --- a/src/mysql/mysqlopt.tcl +++ b/src/mysql/mysqlopt.tcl @@ -134,6 +134,7 @@ proc countmysqlopts { bm } { if { $bm eq "TPC-C" } { ttk::button $Name -command { copyfieldstoconfig configmysql [ subst $myoptsfields ] tpcc + Dict2SQLite "mysql" $configmysql unset myoptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -151,6 +152,7 @@ proc countmysqlopts { bm } { } else { ttk::button $Name -command { copyfieldstoconfig configmysql [ subst $myoptsfields ] tpch + Dict2SQLite "mysql" $configmysql unset myoptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -485,6 +487,7 @@ proc configmysqltpcc {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmysql [ subst $myfields ] tpcc + Dict2SQLite "mysql" $configmysql unset myfields destroy .tpc loadtpcc @@ -495,6 +498,7 @@ proc configmysqltpcc {option} { set mysql_count_ware [ verify_warehouse $mysql_count_ware 100000 ] set mysql_num_vu [ verify_build_threads $mysql_num_vu $mysql_count_ware 1024 ] copyfieldstoconfig configmysql [ subst $myfields ] tpcc + Dict2SQLite "mysql" $configmysql unset myfields destroy .tpc } -text {OK} @@ -723,6 +727,7 @@ proc configmysqltpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configmysql [ subst $myfields ] tpch + Dict2SQLite "mysql" $configmysql unset myfields destroy .mytpch loadtpch @@ -732,6 +737,7 @@ proc configmysqltpch {option} { ttk::button $Name -command { set mysql_num_tpch_threads [ verify_build_threads $mysql_num_tpch_threads 512 512 ] copyfieldstoconfig configmysql [ subst $myfields ] tpch + Dict2SQLite "mysql" $configmysql unset myfields destroy .mytpch } -text {OK} diff --git a/src/oracle/oraopt.tcl b/src/oracle/oraopt.tcl index 289e31a9..176d3e24 100755 --- a/src/oracle/oraopt.tcl +++ b/src/oracle/oraopt.tcl @@ -150,6 +150,7 @@ proc countoraopts { bm } { } else { copyfieldstoconfig configoracle [ subst $oraoptsfields ] tpch } + Dict2SQLite "oracle" $configoracle unset oraoptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -574,6 +575,7 @@ proc configoratpcc {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configoracle [ subst $orafields ] tpcc + Dict2SQLite "oracle" $configoracle unset orafields destroy .tpc loadtpcc @@ -584,6 +586,7 @@ proc configoratpcc {option} { set count_ware [ verify_warehouse $count_ware 100000 ] set num_vu [ verify_build_threads $num_vu $count_ware 1024 ] copyfieldstoconfig configoracle [ subst $orafields ] tpcc + Dict2SQLite "oracle" $configoracle unset orafields destroy .tpc } -text {OK} @@ -848,6 +851,7 @@ proc configoratpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configoracle [ subst $orafields ] tpch + Dict2SQLite "oracle" $configoracle unset orafields destroy .tpch loadtpch @@ -857,6 +861,7 @@ proc configoratpch {option} { ttk::button $Name -command { set num_tpch_threads [ verify_build_threads $num_tpch_threads 512 512 ] copyfieldstoconfig configoracle [ subst $orafields ] tpch + Dict2SQLite "oracle" $configoracle unset orafields destroy .tpch } -text {OK} @@ -937,6 +942,7 @@ proc metoraopts {} { set agent_id [.metric.f1.e1 get] set agent_hostname [.metric.f1.e2 get] copyfieldstoconfig configoracle [ subst $oraoptsfields ] tpcc + Dict2SQLite "oracle" $configoracle unset oraoptsfields catch "destroy .metric" if { ![string is integer -strict $agent_id] } { diff --git a/src/postgresql/pgopt.tcl b/src/postgresql/pgopt.tcl index 2086a943..0a0102d2 100755 --- a/src/postgresql/pgopt.tcl +++ b/src/postgresql/pgopt.tcl @@ -157,6 +157,7 @@ proc countpgopts { bm } { if { $bm eq "TPC-C" } { ttk::button $Name -command { copyfieldstoconfig configpostgresql [ subst $pgoptsfields ] tpcc + Dict2SQLite "postgresql" $configpostgresql unset pgoptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" dict set genericdict transaction_counter tc_refresh_rate 10 @@ -174,6 +175,7 @@ proc countpgopts { bm } { } else { ttk::button $Name -command { copyfieldstoconfig configpostgresql [ subst $pgoptsfields ] tpch + Dict2SQLite "postgresql" $configpostgresql unset pgoptsfields if { ($interval >= 60) || ($interval <= 0) } { tk_messageBox -message "Refresh rate must be more than 0 secs and less than 60 secs" @@ -614,6 +616,7 @@ proc configpgtpcc {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configpostgresql [ subst $pgfields ] tpcc + Dict2SQLite "postgresql" $configpostgresql unset pgfields destroy .tpc loadtpcc @@ -624,6 +627,7 @@ proc configpgtpcc {option} { set pg_count_ware [ verify_warehouse $pg_count_ware 100000 ] set pg_num_vu [ verify_build_threads $pg_num_vu $pg_count_ware 1024 ] copyfieldstoconfig configpostgresql [ subst $pgfields ] tpcc + Dict2SQLite "postgresql" $configpostgresql unset pgfields destroy .tpc } -text {OK} @@ -914,6 +918,7 @@ proc configpgtpch {option} { "drive" { ttk::button $Name -command { copyfieldstoconfig configpostgresql [ subst $pgfields ] tpch + Dict2SQLite "postgresql" $configpostgresql unset pgfields destroy .pgtpch loadtpch @@ -923,6 +928,7 @@ proc configpgtpch {option} { ttk::button $Name -command { set pg_num_tpch_threads [ verify_build_threads $pg_num_tpch_threads 512 512 ] copyfieldstoconfig configpostgresql [ subst $pgfields ] tpch + Dict2SQLite "postgresql" $configpostgresql unset pgfields destroy .pgtpch } -text {OK} @@ -1054,6 +1060,7 @@ proc metpgopts {} { copyfieldstoconfig configpostgresql [ subst $pgoptsfields ] tpch unset pgoptsfields } + Dict2SQLite "postgresql" $configpostgresql catch "destroy .metric" if { ![string is integer -strict $agent_id] } { tk_messageBox -message "Agent id must be an integer"