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

Commit284e21b

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
2 parents2d19d4e +39369b4 commit284e21b

File tree

9 files changed

+79
-30
lines changed

9 files changed

+79
-30
lines changed

‎doc/src/sgml/rules.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a;
862862
<command>UPDATE</command>, and <command>DELETE</command> commands on
863863
a view. These rules will rewrite the command, typically into a command
864864
that updates one or more tables, rather than views. That is the topic
865-
ofthe next section.
865+
of<xref linkend="rules-update">.
866866
</para>
867867

868868
<para>

‎src/backend/access/transam/twophase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ StandbyRecoverPreparedTransactions(bool overwriteOK)
18871887
TransactionIdsubxid=subxids[i];
18881888

18891889
Assert(TransactionIdFollows(subxid,xid));
1890-
SubTransSetParent(xid,subxid,overwriteOK);
1890+
SubTransSetParent(subxid,xid,overwriteOK);
18911891
}
18921892

18931893
pfree(buf);

‎src/backend/optimizer/plan/createplan.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,15 @@ use_physical_tlist(PlannerInfo *root, Path *path, int flags)
760760
if (rel->reloptkind!=RELOPT_BASEREL)
761761
return false;
762762

763+
/*
764+
* Also, don't do it to a CustomPath; the premise that we're extracting
765+
* columns from a simple physical tuple is unlikely to hold for those.
766+
* (When it does make sense, the custom path creator can set up the path's
767+
* pathtarget that way.)
768+
*/
769+
if (IsA(path,CustomPath))
770+
return false;
771+
763772
/*
764773
* Can't do it if any system columns or whole-row Vars are requested.
765774
* (This could possibly be fixed but would take some fragile assumptions

‎src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6214,7 +6214,7 @@ InitPostmasterDeathWatchHandle(void)
62146214
* write fd. That is taken care of in ClosePostmasterPorts().
62156215
*/
62166216
Assert(MyProcPid==PostmasterPid);
6217-
if (pipe(postmaster_alive_fds))
6217+
if (pipe(postmaster_alive_fds)<0)
62186218
ereport(FATAL,
62196219
(errcode_for_file_access(),
62206220
errmsg_internal("could not create pipe to monitor postmaster death: %m")));
@@ -6223,7 +6223,7 @@ InitPostmasterDeathWatchHandle(void)
62236223
* Set O_NONBLOCK to allow testing for the fd's presence with a read()
62246224
* call.
62256225
*/
6226-
if (fcntl(postmaster_alive_fds[POSTMASTER_FD_WATCH],F_SETFL,O_NONBLOCK))
6226+
if (fcntl(postmaster_alive_fds[POSTMASTER_FD_WATCH],F_SETFL,O_NONBLOCK)==-1)
62276227
ereport(FATAL,
62286228
(errcode_for_socket_access(),
62296229
errmsg_internal("could not set postmaster death monitoring pipe to nonblocking mode: %m")));

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ CheckPointReplicationOrigin(void)
566566
if (curstate->roident==InvalidRepOriginId)
567567
continue;
568568

569+
/* zero, to avoid uninitialized padding bytes */
570+
memset(&disk_state,0,sizeof(disk_state));
571+
569572
LWLockAcquire(&curstate->lock,LW_SHARED);
570573

571574
disk_state.roident=curstate->roident;

‎src/backend/storage/ipc/latch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ InitializeLatchSupport(void)
169169
*/
170170
if (pipe(pipefd)<0)
171171
elog(FATAL,"pipe() failed: %m");
172-
if (fcntl(pipefd[0],F_SETFL,O_NONBLOCK)<0)
172+
if (fcntl(pipefd[0],F_SETFL,O_NONBLOCK)==-1)
173173
elog(FATAL,"fcntl() failed on read-end of self-pipe: %m");
174-
if (fcntl(pipefd[1],F_SETFL,O_NONBLOCK)<0)
174+
if (fcntl(pipefd[1],F_SETFL,O_NONBLOCK)==-1)
175175
elog(FATAL,"fcntl() failed on write-end of self-pipe: %m");
176176

177177
selfpipe_readfd=pipefd[0];

‎src/bin/pg_test_fsync/pg_test_fsync.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include<sys/stat.h>
99
#include<sys/time.h>
10+
#include<fcntl.h>
1011
#include<time.h>
1112
#include<unistd.h>
1213
#include<signal.h>

‎src/port/noblock.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*-------------------------------------------------------------------------
22
*
33
* noblock.c
4-
* set a file descriptor as non-blocking
4+
* set a file descriptor asblocking ornon-blocking
55
*
66
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
@@ -17,11 +17,22 @@
1717
#include<fcntl.h>
1818

1919

20+
/*
21+
* Put socket into nonblock mode.
22+
* Returns true on success, false on failure.
23+
*/
2024
bool
2125
pg_set_noblock(pgsocketsock)
2226
{
2327
#if !defined(WIN32)
24-
return (fcntl(sock,F_SETFL,O_NONBLOCK)!=-1);
28+
intflags;
29+
30+
flags=fcntl(sock,F_GETFL);
31+
if (flags<0)
32+
return false;
33+
if (fcntl(sock,F_SETFL, (flags |O_NONBLOCK))==-1)
34+
return false;
35+
return true;
2536
#else
2637
unsigned longioctlsocket_ret=1;
2738

@@ -30,15 +41,20 @@ pg_set_noblock(pgsocket sock)
3041
#endif
3142
}
3243

33-
44+
/*
45+
* Put socket into blocking mode.
46+
* Returns true on success, false on failure.
47+
*/
3448
bool
3549
pg_set_block(pgsocketsock)
3650
{
3751
#if !defined(WIN32)
3852
intflags;
3953

4054
flags=fcntl(sock,F_GETFL);
41-
if (flags<0||fcntl(sock,F_SETFL, (long) (flags& ~O_NONBLOCK)))
55+
if (flags<0)
56+
return false;
57+
if (fcntl(sock,F_SETFL, (flags& ~O_NONBLOCK))==-1)
4258
return false;
4359
return true;
4460
#else

‎src/test/perl/PostgresNode.pm

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ our @EXPORT = qw(
101101

102102
our ($test_localhost,$test_pghost,$last_port_assigned,@all_nodes);
103103

104+
# Windows path to virtual file system root
105+
106+
our$vfs_path ='';
107+
if ($Config{osname}eq'msys')
108+
{
109+
$vfs_path =`cd / && pwd -W`;
110+
chomp$vfs_path;
111+
}
112+
104113
INIT
105114
{
106115

@@ -402,6 +411,7 @@ sub init
402411
openmy$conf,">>$pgdata/postgresql.conf";
403412
print$conf"\n# Added by PostgresNode.pm\n";
404413
print$conf"fsync = off\n";
414+
print$conf"restart_after_crash = off\n";
405415
print$conf"log_statement = all\n";
406416
print$conf"port =$port\n";
407417

@@ -441,7 +451,7 @@ A shortcut method to append to files like pg_hba.conf and postgresql.conf.
441451
Does no validation or sanity checking. Does not reload the configuration
442452
after writing.
443453
444-
A newline isNOTautomatically appended to the string.
454+
A newline is automatically appended to the string.
445455
446456
=cut
447457

@@ -451,7 +461,7 @@ sub append_conf
451461

452462
my$conffile =$self->data_dir .'/' .$filename;
453463

454-
TestLib::append_to_file($conffile,$str);
464+
TestLib::append_to_file($conffile,$str ."\n");
455465
}
456466

457467
=pod
@@ -636,18 +646,19 @@ sub start
636646
my$port =$self->port;
637647
my$pgdata =$self->data_dir;
638648
my$name =$self->name;
649+
BAIL_OUT("node\"$name\" is already running")ifdefined$self->{_pid};
639650
print("### Starting node\"$name\"\n");
640651
my$ret = TestLib::system_log('pg_ctl','-w','-D',$self->data_dir,'-l',
641652
$self->logfile,'start');
642653

643654
if ($ret != 0)
644655
{
645-
print"# pg_ctl failed; logfile:\n";
656+
print"# pg_ctlstartfailed; logfile:\n";
646657
print TestLib::slurp_file($self->logfile);
647-
BAIL_OUT("pg_ctl failed");
658+
BAIL_OUT("pg_ctlstartfailed");
648659
}
649660

650-
$self->_update_pid;
661+
$self->_update_pid(1);
651662
}
652663

653664
=pod
@@ -656,6 +667,10 @@ sub start
656667
657668
Stop the node using pg_ctl -m $mode and wait for it to stop.
658669
670+
Note: if the node is already known stopped, this does nothing.
671+
However, if we think it's running and it's not, it's important for
672+
this to fail. Otherwise, tests might fail to detect server crashes.
673+
659674
=cut
660675

661676
substop
@@ -667,9 +682,8 @@ sub stop
667682
$mode ='fast'unlessdefined$mode;
668683
returnunlessdefined$self->{_pid};
669684
print"### Stopping node\"$name\" using mode$mode\n";
670-
TestLib::system_log('pg_ctl','-D',$pgdata,'-m',$mode,'stop');
671-
$self->{_pid} =undef;
672-
$self->_update_pid;
685+
TestLib::system_or_bail('pg_ctl','-D',$pgdata,'-m',$mode,'stop');
686+
$self->_update_pid(0);
673687
}
674688

675689
=pod
@@ -687,7 +701,7 @@ sub reload
687701
my$pgdata =$self->data_dir;
688702
my$name =$self->name;
689703
print"### Reloading node\"$name\"\n";
690-
TestLib::system_log('pg_ctl','-D',$pgdata,'reload');
704+
TestLib::system_or_bail('pg_ctl','-D',$pgdata,'reload');
691705
}
692706

693707
=pod
@@ -706,9 +720,9 @@ sub restart
706720
my$logfile =$self->logfile;
707721
my$name =$self->name;
708722
print"### Restarting node\"$name\"\n";
709-
TestLib::system_log('pg_ctl','-D',$pgdata,'-w','-l',$logfile,
710-
'restart');
711-
$self->_update_pid;
723+
TestLib::system_or_bail('pg_ctl','-D',$pgdata,'-w','-l',$logfile,
724+
'restart');
725+
$self->_update_pid(1);
712726
}
713727

714728
=pod
@@ -727,7 +741,8 @@ sub promote
727741
my$logfile =$self->logfile;
728742
my$name =$self->name;
729743
print"### Promoting node\"$name\"\n";
730-
TestLib::system_log('pg_ctl','-D',$pgdata,'-l',$logfile,'promote');
744+
TestLib::system_or_bail('pg_ctl','-D',$pgdata,'-l',$logfile,
745+
'promote');
731746
}
732747

733748
# Internal routine to enable streaming replication on a standby node.
@@ -749,7 +764,7 @@ standby_mode=on
749764
subenable_restoring
750765
{
751766
my ($self,$root_node) =@_;
752-
my$path =$root_node->archive_dir;
767+
my$path =$vfs_path .$root_node->archive_dir;
753768
my$name =$self->name;
754769

755770
print"### Enabling WAL restore for node\"$name\"\n";
@@ -777,7 +792,7 @@ standby_mode = on
777792
subenable_archiving
778793
{
779794
my ($self) =@_;
780-
my$path =$self->archive_dir;
795+
my$path =$vfs_path.$self->archive_dir;
781796
my$name =$self->name;
782797

783798
print"### Enabling WAL archiving for node\"$name\"\n";
@@ -805,22 +820,26 @@ archive_command = '$copy_command'
805820
# Internal method
806821
sub_update_pid
807822
{
808-
my$self =shift;
823+
my($self,$is_running) =@_;
809824
my$name =$self->name;
810825

811826
# If we can open the PID file, read its first line and that's the PID we
812-
# want. If the file cannot be opened, presumably the server is not
813-
# running; don't be noisy in that case.
814-
if (openmy$pidfile,$self->data_dir ."/postmaster.pid")
827+
# want.
828+
if (openmy$pidfile,'<',$self->data_dir ."/postmaster.pid")
815829
{
816830
chomp($self->{_pid} = <$pidfile>);
817831
print"# Postmaster PID for node\"$name\" is$self->{_pid}\n";
818832
close$pidfile;
833+
834+
# If we found a pidfile when there shouldn't be one, complain.
835+
BAIL_OUT("postmaster.pid unexpectedly present")unless$is_running;
819836
return;
820837
}
821838

822839
$self->{_pid} =undef;
823-
print"# No postmaster PID\n";
840+
print"# No postmaster PID for node\"$name\"\n";
841+
# Complain if we expected to find a pidfile.
842+
BAIL_OUT("postmaster.pid unexpectedly not present")if$is_running;
824843
}
825844

826845
=pod
@@ -961,6 +980,7 @@ sub safe_psql
961980
print"\n#### End standard error\n";
962981
}
963982

983+
$stdout =~s/\r//gif$TestLib::windows_os;
964984
return$stdout;
965985
}
966986

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp