TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
545 stars 115 forks source link

Add check to vurun for pre-existing threads #644

Closed sm-shaw closed 7 months ago

sm-shaw commented 7 months ago

Fixes CLI error: Error: can't read "threadscreated(0)": no such variable and replaces with message: Error: Cannot call vurun with Virtual Users already active

Fix checks if threadscreated() array exists (unset by vudestroy) but thread names check is greater than 0 meaning threads remain running. If this is the case vurun returns and does not run. In most cases this will be because keepalive_margin is shorter than the time for a thread to finish and can be resolved by increasing keepalive_margin.

Example with fix:

Vuser 1:TEST RESULT : System achieved 12527 NOPM from 29070 MariaDB TPM
Vuser 1:Gathering timing data from Active Virtual Users...
29280 MariaDB tpm
Vuser 2:FINISHED SUCCESS
Vuser 1:Calculating timings...
Vuser 1:Writing timing data to /tmp/hdbxtprofile.log
Vuser 1:Starting purge: history list length 1919
1806 MariaDB tpm
doing vudestory
Transaction Counter thread running with threadid:tid0x7f85213ea700
Stopping Transaction Counter
Virtual Users remain running in background or shutting down, retry
Transaction Counter Started
doing vuset
Error: Virtual Users exist, destroy with vudestroy before changing settings
doing vucreate
Error: Virtual Users exist, destroy with vudestroy before creating
Transaction Counter thread running with threadid:tid0x7f85213ea700
doing vurun
Error: Cannot call vurun with Virtual Users already active
doing vudestory
Transaction Counter thread running with threadid:tid0x7f85213ea700
Stopping Transaction Counter
Virtual Users remain running in background or shutting down, retry
Transaction Counter thread already running with threadid:tid0x7f85213ea700
doing vuset
Error: Virtual Users exist, destroy with vudestroy before changing settings
doing vucreate
Error: Virtual Users exist, destroy with vudestroy before creating
Transaction Counter thread running with threadid:tid0x7f85213ea700
doing vurun
Error: Cannot call vurun with Virtual Users already active
doing vudestory
Transaction Counter thread running
Stopping Transaction Counter
0 MariaDB tpm
Virtual Users remain running in background or shutting down, retry
abondvt89 commented 7 months ago

Merging after reviews and approval of the three members of the code maintenance team.