Fix t/027_local_blocks.pl test for older PG versions

pull/463/head
Artem Gavrilov 2024-05-27 12:35:03 +02:00
parent 60a03d1c94
commit ffd9685a6e
1 changed files with 13 additions and 6 deletions

View File

@ -70,9 +70,13 @@ is($stdout,'t',"Check: local_blks_hit should not be 0.");
trim($stdout); trim($stdout);
is($stdout,'t',"Check: local_blks_dirtied should not be 0."); is($stdout,'t',"Check: local_blks_dirtied should not be 0.");
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.local_blk_write_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO t1%\'', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']); if ($PGSM::PG_MAJOR_VERSION => 17)
trim($stdout); {
is($stdout,'t',"Check: local_blk_write_time should not be 0."); ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.local_blk_write_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%INSERT INTO t1%\'', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
trim($stdout);
is($stdout,'t',"Check: local_blk_write_time should not be 0.");
}
# Compare values for query 'SELECT * FROM t1' # Compare values for query 'SELECT * FROM t1'
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.local_blks_hit != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%FROM t1%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']); ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT PGSM.local_blks_hit != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%FROM t1%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
@ -80,9 +84,12 @@ trim($stdout);
is($stdout,'t',"Check: local_blks_hit should not be 0."); is($stdout,'t',"Check: local_blks_hit should not be 0.");
# TODO: Find a way how to bypass cache and ger real block reads # TODO: Find a way how to bypass cache and ger real block reads
# ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.local_blk_read_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%FROM t1%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']); # if ($PGSM::PG_MAJOR_VERSION => 17)
# trim($stdout); # {
# is($stdout,'t',"Check: local_blk_read_time should not be 0."); # ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.local_blk_read_time) != 0 FROM pg_stat_monitor AS PGSM WHERE PGSM.query LIKE \'%FROM t1%\';', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
# trim($stdout);
# is($stdout,'t',"Check: local_blk_read_time should not be 0.");
# }
# DROP EXTENSION # DROP EXTENSION
$stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_stat_monitor;', extra_params => ['-a']); $stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_stat_monitor;', extra_params => ['-a']);