PG-574: Verify 026_shared_blocks.pl TAP test case. (#363)
1) Added the Group by clause to make sure that bucket change doesn't have any impact on aggregates of queries. 2) Updated column names where required. 3) Updated pgbench parameters to reduce the time taken by test case, around 70-80% decrease in time taken by test case.pull/364/head
parent
80608394a2
commit
fa0ee037a2
|
@ -26,7 +26,7 @@ my $pgdata = $node->data_dir;
|
||||||
$node->append_conf('postgresql.conf', "shared_preload_libraries = 'pg_stat_statements,pg_stat_monitor'");
|
$node->append_conf('postgresql.conf', "shared_preload_libraries = 'pg_stat_statements,pg_stat_monitor'");
|
||||||
# Set bucket duration to 3600 seconds so bucket doesn't change.
|
# Set bucket duration to 3600 seconds so bucket doesn't change.
|
||||||
$node->append_conf('postgresql.conf', "pg_stat_statements.track_utility = off");
|
$node->append_conf('postgresql.conf', "pg_stat_statements.track_utility = off");
|
||||||
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_bucket_time = 1800");
|
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_bucket_time = 360000");
|
||||||
$node->append_conf('postgresql.conf', "track_io_timing = on");
|
$node->append_conf('postgresql.conf', "track_io_timing = on");
|
||||||
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_track_utility = no");
|
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_track_utility = no");
|
||||||
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_normalized_query = yes");
|
$node->append_conf('postgresql.conf', "pg_stat_monitor.pgsm_normalized_query = yes");
|
||||||
|
@ -67,10 +67,10 @@ PGSM::append_to_file($stdout);
|
||||||
|
|
||||||
my $port = $node->port;
|
my $port = $node->port;
|
||||||
|
|
||||||
my $out = system ("pgbench -i -s 100 -p $port postgres");
|
my $out = system ("pgbench -i -s 20 -p $port postgres");
|
||||||
ok($cmdret == 0, "Perform pgbench init");
|
ok($cmdret == 0, "Perform pgbench init");
|
||||||
|
|
||||||
$out = system ("pgbench -c 10 -j 2 -t 10000 -p $port postgres");
|
$out = system ("pgbench -c 10 -j 2 -t 2000 -p $port postgres");
|
||||||
ok($cmdret == 0, "Run pgbench");
|
ok($cmdret == 0, "Run pgbench");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', "DELETE FROM pgbench_accounts WHERE aid % 9 = 1;", extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', "DELETE FROM pgbench_accounts WHERE aid % 9 = 1;", extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
|
@ -82,82 +82,85 @@ ok($cmdret == 0, "Run pgbench");
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,130) AS query, calls, rows, total_exec_time,min_exec_time,max_exec_time,mean_exec_time,stddev_exec_time FROM pg_stat_statements WHERE query LIKE \'%bench%\' ORDER BY query,calls DESC;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,130) AS query, calls, rows, total_exec_time,min_exec_time,max_exec_time,mean_exec_time,stddev_exec_time FROM pg_stat_statements WHERE query LIKE \'%bench%\' ORDER BY query,calls DESC;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
PGSM::append_to_debug_file($stdout);
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,130) AS query, calls, rows_retrieved, total_exec_time, min_exec_time, max_exec_time, mean_exec_time,stddev_exec_time, cpu_user_time, cpu_sys_time FROM pg_stat_monitor WHERE query LIKE \'%bench%\' ORDER BY query,calls DESC;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,130) AS query, calls, rows, total_exec_time, min_exec_time, max_exec_time, mean_exec_time,stddev_exec_time, cpu_user_time, cpu_sys_time FROM pg_stat_monitor WHERE query LIKE \'%bench%\' ORDER BY query,calls DESC;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
PGSM::append_to_debug_file($stdout);
|
PGSM::append_to_debug_file($stdout);
|
||||||
PGSM::append_to_debug_file("--------");
|
PGSM::append_to_debug_file("--------");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,130) AS query, calls, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, blk_read_time, blk_write_time FROM pg_stat_monitor WHERE query LIKE \'%bench%\' ORDER BY query,calls DESC;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
# Compare values for query 'DELETE FROM pgbench_accounts WHERE $1 = $2'
|
# Compare values for query 'DELETE FROM pgbench_accounts WHERE $1 = $2'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_hit != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_hit) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_read != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_read) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_dirtied != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_dirtied) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_written != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_written) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_read_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_read_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_write_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_write_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
||||||
|
|
||||||
# Compare values for query 'INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP)'
|
# Compare values for query 'INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP)'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_hit != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_hit) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_read != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_read) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_dirtied != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_dirtied) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_written != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_written) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_read_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_read_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_write_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_write_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
||||||
|
|
||||||
# Compare values for query 'UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2'
|
# Compare values for query 'UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_hit != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_hit) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
is($stdout,'t',"Check: shared_blks_hit should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_read != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_read) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
is($stdout,'t',"Check: shared_blks_read should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_dirtied != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_dirtied) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
is($stdout,'t',"Check: shared_blks_dirtied should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.shared_blks_written != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.shared_blks_written) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
is($stdout,'t',"Check: shared_blks_written should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_read_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_read_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
is($stdout,'t',"Check: blk_read_time should not be 0.");
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.blk_write_time != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres','SELECT SUM(PGSM.blk_write_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts SET abalance%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
is($stdout,'t',"Check: blk_write_time should not be 0.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue