TPC-Council / HammerDB

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

call ash_fetch, error:can't read "public(cpucount)": no such element in array #637

Closed sm-shaw closed 10 months ago

sm-shaw commented 10 months ago

As referenced in the discussion #636 connecting to a Linux database running PostgreSQL from Windows and running the PostgreSQL metrics returns the following error.

Waiting for Connection to PostgreSQL for Database Metrics...
Metrics Connecting to host:razorbill port:5432
Metrics Connected
Starting Metrics, read 855 rows from pg_active_session_history
call ash_fetch, error:can't read "public(cpucount)": no such element in array

The fix is to update the source file pgmet.tcl in src/postgresql and modify the start of proc pg_HowManyProcessorsWindows from this:

 proc pg_HowManyProcessorsWindows {} {
        global S cpu_model
        set cpu_model [lindex [twapi::get_processor_info 0 -processorname] 1]

To this:

 proc pg_HowManyProcessorsWindows {} {
        global S cpu_model
    if [catch {package require twapi} ] { 
        set ::S(cpus) 1
    return
    }