Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1b8aa1

Browse files
committed
Use HASH_BLOBS for xidhash.
This caused BufFile errors on buildfarm member sungazer, and SIGSEGV waspossible. Conditions for reaching those symptoms were more frequent onbig-endian systems.Discussion:https://postgr.es/m/20201129214441.GA691200@rfd.leadboat.com
1 parent73aae45 commita1b8aa1

File tree

3 files changed

+112
-3
lines changed

3 files changed

+112
-3
lines changed

‎src/backend/replication/logical/worker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ apply_handle_stream_start(StringInfo s)
776776
hash_ctl.entrysize=sizeof(StreamXidHash);
777777
hash_ctl.hcxt=ApplyContext;
778778
xidhash=hash_create("StreamXidHash",1024,&hash_ctl,
779-
HASH_ELEM |HASH_CONTEXT);
779+
HASH_ELEM |HASH_BLOBS |HASH_CONTEXT);
780780
}
781781

782782
/* open the spool file for this transaction */

‎src/test/perl/PostgresNode.pm

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,93 @@ sub psql
15651565

15661566
=pod
15671567
1568+
=item$node->background_psql($dbname, \$stdin, \$stdout, $timer, %params) => harness
1569+
1570+
InvokeB<psql> onB<$dbname> and return an IPC::Run harness object, which the
1571+
caller may use to send input toB<psql>. The process's stdin is sourced from
1572+
the $stdin scalar reference, and its stdout and stderr go to the $stdout
1573+
scalar reference. This allows the caller to act on other parts of the system
1574+
while idling this backend.
1575+
1576+
The specified timer object is attached to the harness, as well. It's caller's
1577+
responsibility to select the timeout length, and to restart the timer after
1578+
each command if the timeout is per-command.
1579+
1580+
psql is invoked in tuples-only unaligned mode with reading ofB<.psqlrc>
1581+
disabled. That may be overridden by passing extra psql parameters.
1582+
1583+
Dies on failure to invoke psql, or if psql fails to connect. Errors occurring
1584+
later are the caller's problem. psql runs with on_error_stop by default so
1585+
that it will stop running sql and return 3 if passed SQL results in an error.
1586+
1587+
Be sure to "finish" the harness when done with it.
1588+
1589+
=over
1590+
1591+
=itemon_error_stop => 1
1592+
1593+
By default, theB<psql> method invokes theB<psql> program with ON_ERROR_STOP=1
1594+
set, so SQL execution is stopped at the first error and exit code 3 is
1595+
returned. SetB<on_error_stop> to 0 to ignore errors instead.
1596+
1597+
=itemreplication =>B<value>
1598+
1599+
If set, addB<replication=value> to the conninfo string.
1600+
Passing the literal valueC<database> results in a logical replication
1601+
connection.
1602+
1603+
=itemextra_params => ['--single-transaction']
1604+
1605+
If given, it must be an array reference containing additional parameters toB<psql>.
1606+
1607+
=back
1608+
1609+
=cut
1610+
1611+
subbackground_psql
1612+
{
1613+
my ($self,$dbname,$stdin,$stdout,$timer,%params) =@_;
1614+
1615+
my$replication =$params{replication};
1616+
1617+
my@psql_params = (
1618+
'psql',
1619+
'-XAtq',
1620+
'-d',
1621+
$self->connstr($dbname)
1622+
. (defined$replication ?" replication=$replication" :""),
1623+
'-f',
1624+
'-');
1625+
1626+
$params{on_error_stop} = 1unlessdefined$params{on_error_stop};
1627+
1628+
push@psql_params,'-v','ON_ERROR_STOP=1'if$params{on_error_stop};
1629+
push@psql_params, @{$params{extra_params} }
1630+
ifdefined$params{extra_params};
1631+
1632+
# Ensure there is no data waiting to be sent:
1633+
$$stdin =""ifref($stdin);
1634+
# IPC::Run would otherwise append to existing contents:
1635+
$$stdout =""ifref($stdout);
1636+
1637+
my$harness = IPC::Run::start \@psql_params,
1638+
'<',$stdin,'>',$stdout,$timer;
1639+
1640+
# Request some output, and pump until we see it. This means that psql
1641+
# connection failures are caught here, relieving callers of the need to
1642+
# handle those. (Right now, we have no particularly good handling for
1643+
# errors anyway, but that might be added later.)
1644+
my$banner ="background_psql: ready";
1645+
$$stdin ="\\echo$banner\n";
1646+
pump$harnessuntil$$stdout =~/$banner/ ||$timer->is_expired;
1647+
1648+
die"psql startup timed out"if$timer->is_expired;
1649+
1650+
return$harness;
1651+
}
1652+
1653+
=pod
1654+
15681655
=item$node->interactive_psql($dbname, \$stdin, \$stdout, $timer, %params) => harness
15691656
15701657
InvokeB<psql> onB<$dbname> and return an IPC::Run harness object,

‎src/test/subscription/t/015_stream.pl

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,37 @@
4646
$node_subscriber->safe_psql('postgres',"SELECT count(*), count(c), count(d = 999) FROM test_tab");
4747
is($result,qq(2|2|2),'check initial data was copied to subscriber');
4848

49-
# Insert, update and delete enough rows to exceed the 64kB limit.
50-
$node_publisher->safe_psql('postgres',q{
49+
# Interleave a pair of transactions, each exceeding the 64kB limit.
50+
my$in ='';
51+
my$out ='';
52+
53+
my$timer = IPC::Run::timeout(180);
54+
55+
my$h =$node_publisher->background_psql('postgres', \$in, \$out,$timer,
56+
on_error_stop=> 0);
57+
58+
$in .=q{
5159
BEGIN;
5260
INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5000) s(i);
5361
UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
5462
DELETE FROM test_tab WHERE mod(a,3) = 0;
63+
};
64+
$h->pump_nb;
65+
66+
$node_publisher->safe_psql(
67+
'postgres',q{
68+
BEGIN;
69+
INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(5001, 9999) s(i);
70+
DELETE FROM test_tab WHERE a > 5000;
5571
COMMIT;
5672
});
5773

74+
$in .=q{
75+
COMMIT;
76+
\q
77+
};
78+
$h->finish;# errors make the next test fail, so ignore them here
79+
5880
$node_publisher->wait_for_catchup($appname);
5981

6082
$result =

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp