Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0ccbac7

Browse files
committed
test fixes
1 parent 2d6bb1d commit 0ccbac7

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

contrib/postgres_fdw/t/001_bank_check.pl

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
my $master = get_new_node("master");
99
$master->init;
1010
$master->append_conf('postgresql.conf', qq(
11-
max_prepared_transactions = 10
11+
max_prepared_transactions = 30
1212
log_checkpoints = true
1313
postgres_fdw.use_tsdtm = on
1414
));
@@ -17,7 +17,7 @@
1717
my $shard1 = get_new_node("shard1");
1818
$shard1->init;
1919
$shard1->append_conf('postgresql.conf', qq(
20-
max_prepared_transactions = 10
20+
max_prepared_transactions = 300
2121
log_checkpoints = true
2222
shared_preload_libraries = 'pg_tsdtm'
2323
));
@@ -26,7 +26,7 @@
2626
my $shard2 = get_new_node("shard2");
2727
$shard2->init;
2828
$shard2->append_conf('postgresql.conf', qq(
29-
max_prepared_transactions = 10
29+
max_prepared_transactions = 300
3030
log_checkpoints = true
3131
shared_preload_libraries = 'pg_tsdtm'
3232
));
@@ -52,24 +52,30 @@
5252
diag("done $host $port");
5353
}
5454

55-
$shard1->psql('postgres', "insert into accounts select 2*id-1, 0 from generate_series(1, 1000) as id;");
56-
$shard2->psql('postgres', "insert into accounts select 2*id, 0 from generate_series(1, 1000) as id;");
55+
$shard1->psql('postgres', "insert into accounts select 2*id-1, 0 from generate_series(1, 10000) as id;");
56+
$shard2->psql('postgres', "insert into accounts select 2*id, 0 from generate_series(1, 10000) as id;");
57+
58+
diag( $master->connstr() );
59+
# sleep(3600);
5760

5861
###############################################################################
5962

6063
my ($err, $rc);
6164
my $seconds = 30;
62-
my $total = 0;
63-
my $oldtotal = 0;
65+
my $total = '0';
66+
my $oldtotal = '0';
6467
my $isolation_error = 0;
6568

66-
my $pgb_handle = $master->pgbench_async(-n, -c => 1, -T => $seconds, -f => "$TestLib::log_path/../../t/bank.pgb", 'postgres' );
69+
70+
$master->pgbench(-n, -c => 5, -t => 10, -f => "$TestLib::log_path/../../t/bank.pgb", 'postgres' );
71+
72+
my $pgb_handle = $master->pgbench_async(-n, -c => 5, -T => $seconds, -f => "$TestLib::log_path/../../t/bank.pgb", 'postgres' );
6773

6874
my $started = time();
6975
while (time() - $started < $seconds)
7076
{
7177
($rc, $total, $err) = $master->psql('postgres', "select sum(amount) from accounts");
72-
if ($oldtotal != $total)
78+
if ( ($total ne $oldtotal) and ($total ne '') )
7379
{
7480
$isolation_error = 1;
7581
$oldtotal = $total;

contrib/postgres_fdw/t/bank.pgb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\set id random(1, 2000)
1+
\set id random(1, 20000)
22

33
BEGIN;
44
UPDATE accounts SET amount = amount - 1 WHERE id = :id;

0 commit comments

Comments
 (0)