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

Commit 747b3f0

Browse files
author
Alexander Korotkov
committed
Merge branch 'PGPRO10' into PGPROEE10
2 parents 54996dd + 6ada0bd commit 747b3f0

File tree

190 files changed

+7924
-17938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+7924
-17938
lines changed

COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PostgreSQL Database Management System
22
(formerly known as Postgres, then as Postgres95)
33

4-
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
4+
Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
55

66
Portions Copyright (c) 1994, The Regents of the University of California
77

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
# GNUmakefile won't exist yet, so we catch that case as well.
1212

1313

14+
# AIX make defaults to building *every* target of the first rule. Start with
15+
# a single-target, empty rule to make the other targets non-default.
16+
all:
17+
1418
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
1519
@if [ ! -f GNUmakefile ] ; then \
1620
echo "You need to run the 'configure' program first. See the file"; \

config/c-compiler.m4

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,38 +96,72 @@ undefine([Ac_cachevar])dnl
9696
# PGAC_TYPE_128BIT_INT
9797
# ---------------------
9898
# Check if __int128 is a working 128 bit integer type, and if so
99-
# define PG_INT128_TYPE to that typename. This currently only detects
100-
# a GCC/clang extension, but support for different environments may be
101-
# added in the future.
99+
# define PG_INT128_TYPE to that typename, and define ALIGNOF_PG_INT128_TYPE
100+
# as its alignment requirement.
101+
#
102+
# This currently only detects a GCC/clang extension, but support for other
103+
# environments may be added in the future.
102104
#
103105
# For the moment we only test for support for 128bit math; support for
104106
# 128bit literals and snprintf is not required.
105107
AC_DEFUN([PGAC_TYPE_128BIT_INT],
106108
[AC_CACHE_CHECK([for __int128], [pgac_cv__128bit_int],
107109
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
108110
/*
111+
* We don't actually run this test, just link it to verify that any support
112+
* functions needed for __int128 are present.
113+
*
109114
* These are globals to discourage the compiler from folding all the
110115
* arithmetic tests down to compile-time constants. We do not have
111-
* convenient support for 64bit literals at this point...
116+
* convenient support for 128bit literals at this point...
112117
*/
113118
__int128 a = 48828125;
114-
__int128 b = 97656255;
119+
__int128 b = 97656250;
115120
],[
116121
__int128 c,d;
117122
a = (a << 12) + 1; /* 200000000001 */
118123
b = (b << 12) + 5; /* 400000000005 */
119-
/* use the most relevant arithmetic ops */
124+
/* try the most relevant arithmetic ops */
120125
c = a * b;
121126
d = (c + b) / b;
122-
/* return different values, to prevent optimizations */
127+
/* must use the results, else compiler may optimize arithmetic away */
123128
if (d != a+1)
124-
return 0;
125-
return 1;
129+
return 1;
126130
])],
127131
[pgac_cv__128bit_int=yes],
128132
[pgac_cv__128bit_int=no])])
129133
if test x"$pgac_cv__128bit_int" = xyes ; then
130-
AC_DEFINE(PG_INT128_TYPE, __int128, [Define to the name of a signed 128-bit integer type.])
134+
# Use of non-default alignment with __int128 tickles bugs in some compilers.
135+
# If not cross-compiling, we can test for bugs and disable use of __int128
136+
# with buggy compilers. If cross-compiling, hope for the best.
137+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83925
138+
AC_RUN_IFELSE([AC_LANG_PROGRAM([
139+
/* This must match the corresponding code in c.h: */
140+
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
141+
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
142+
#endif
143+
typedef __int128 int128a
144+
#if defined(pg_attribute_aligned)
145+
pg_attribute_aligned(8)
146+
#endif
147+
;
148+
int128a holder;
149+
void pass_by_val(void *buffer, int128a par) { holder = par; }
150+
],[
151+
long int i64 = 97656225L << 12;
152+
int128a q;
153+
pass_by_val(main, (int128a) i64);
154+
q = (int128a) i64;
155+
if (q != holder)
156+
return 1;
157+
])],
158+
[pgac_cv__128bit_int_bug=ok],
159+
[pgac_cv__128bit_int_bug=broken],
160+
[pgac_cv__128bit_int_bug="assuming ok"])
161+
if test x"$pgac_cv__128bit_int_bug" != xbroken ; then
162+
AC_DEFINE(PG_INT128_TYPE, __int128, [Define to the name of a signed 128-bit integer type.])
163+
AC_CHECK_ALIGNOF(PG_INT128_TYPE)
164+
fi
131165
fi])# PGAC_TYPE_128BIT_INT
132166

133167

config/perl.m4

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,19 @@ AC_DEFUN([PGAC_CHECK_PERL_EMBED_LDFLAGS],
8787
[AC_REQUIRE([PGAC_PATH_PERL])
8888
AC_MSG_CHECKING(for flags to link embedded Perl)
8989
if test "$PORTNAME" = "win32" ; then
90-
perl_lib=`basename $perl_archlibexp/CORE/perl[[5-9]]*.lib .lib`
91-
test -e "$perl_archlibexp/CORE/$perl_lib.lib" && perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
90+
perl_lib=`basename $perl_archlibexp/CORE/perl[[5-9]]*.lib .lib`
91+
if test -e "$perl_archlibexp/CORE/$perl_lib.lib"; then
92+
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
93+
else
94+
perl_lib=`basename $perl_archlibexp/CORE/libperl[[5-9]]*.a .a | sed 's/^lib//'`
95+
if test -e "$perl_archlibexp/CORE/lib$perl_lib.a"; then
96+
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
97+
fi
98+
fi
9299
else
93-
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
94-
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
95-
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"]`
100+
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
101+
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
102+
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"]`
96103
fi
97104
AC_SUBST(perl_embed_ldflags)dnl
98105
if test -z "$perl_embed_ldflags" ; then

configure

Lines changed: 108 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8111,12 +8111,19 @@ $as_echo "$perl_embed_ccflags" >&6; }
81118111
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flags to link embedded Perl" >&5
81128112
$as_echo_n "checking for flags to link embedded Perl... " >&6; }
81138113
if test "$PORTNAME" = "win32" ; then
8114-
perl_lib=`basename $perl_archlibexp/CORE/perl[5-9]*.lib .lib`
8115-
test -e "$perl_archlibexp/CORE/$perl_lib.lib" && perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
8114+
perl_lib=`basename $perl_archlibexp/CORE/perl[5-9]*.lib .lib`
8115+
if test -e "$perl_archlibexp/CORE/$perl_lib.lib"; then
8116+
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
8117+
else
8118+
perl_lib=`basename $perl_archlibexp/CORE/libperl[5-9]*.a .a | sed 's/^lib//'`
8119+
if test -e "$perl_archlibexp/CORE/lib$perl_lib.a"; then
8120+
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
8121+
fi
8122+
fi
81168123
else
8117-
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
8118-
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
8119-
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e "s/ -arch [-a-zA-Z0-9_]*//g"`
8124+
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
8125+
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
8126+
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e "s/ -arch [-a-zA-Z0-9_]*//g"`
81208127
fi
81218128
if test -z "$perl_embed_ldflags" ; then
81228129
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -15101,7 +15108,10 @@ _ACEOF
1510115108

1510215109
# Compute maximum alignment of any basic type.
1510315110
# We assume long's alignment is at least as strong as char, short, or int;
15104-
# but we must check long long (if it exists) and double.
15111+
# but we must check long long (if it is being used for int64) and double.
15112+
# Note that we intentionally do not consider any types wider than 64 bits,
15113+
# as allowing MAXIMUM_ALIGNOF to exceed 8 would be too much of a penalty
15114+
# for disk and memory space.
1510515115

1510615116
MAX_ALIGNOF=$ac_cv_alignof_long
1510715117
if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
@@ -15161,7 +15171,7 @@ _ACEOF
1516115171
fi
1516215172

1516315173

15164-
# Check for extensions offering the integer scalar type __int128.
15174+
# Some compilers offer a 128-bit integer scalar type.
1516515175
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128" >&5
1516615176
$as_echo_n "checking for __int128... " >&6; }
1516715177
if ${pgac_cv__128bit_int+:} false; then :
@@ -15171,12 +15181,15 @@ else
1517115181
/* end confdefs.h. */
1517215182
1517315183
/*
15184+
* We don't actually run this test, just link it to verify that any support
15185+
* functions needed for __int128 are present.
15186+
*
1517415187
* These are globals to discourage the compiler from folding all the
1517515188
* arithmetic tests down to compile-time constants. We do not have
15176-
* convenient support for 64bit literals at this point...
15189+
* convenient support for 128bit literals at this point...
1517715190
*/
1517815191
__int128 a = 48828125;
15179-
__int128 b = 97656255;
15192+
__int128 b = 97656250;
1518015193
1518115194
int
1518215195
main ()
@@ -15185,13 +15198,12 @@ main ()
1518515198
__int128 c,d;
1518615199
a = (a << 12) + 1; /* 200000000001 */
1518715200
b = (b << 12) + 5; /* 400000000005 */
15188-
/* use the most relevant arithmetic ops */
15201+
/* try the most relevant arithmetic ops */
1518915202
c = a * b;
1519015203
d = (c + b) / b;
15191-
/* return different values, to prevent optimizations */
15204+
/* must use the results, else compiler may optimize arithmetic away */
1519215205
if (d != a+1)
15193-
return 0;
15194-
return 1;
15206+
return 1;
1519515207
1519615208
;
1519715209
return 0;
@@ -15208,9 +15220,92 @@ fi
1520815220
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int" >&5
1520915221
$as_echo "$pgac_cv__128bit_int" >&6; }
1521015222
if test x"$pgac_cv__128bit_int" = xyes ; then
15223+
# Use of non-default alignment with __int128 tickles bugs in some compilers.
15224+
# If not cross-compiling, we can test for bugs and disable use of __int128
15225+
# with buggy compilers. If cross-compiling, hope for the best.
15226+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83925
15227+
if test "$cross_compiling" = yes; then :
15228+
pgac_cv__128bit_int_bug="assuming ok"
15229+
else
15230+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15231+
/* end confdefs.h. */
15232+
15233+
/* This must match the corresponding code in c.h: */
15234+
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
15235+
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
15236+
#endif
15237+
typedef __int128 int128a
15238+
#if defined(pg_attribute_aligned)
15239+
pg_attribute_aligned(8)
15240+
#endif
15241+
;
15242+
int128a holder;
15243+
void pass_by_val(void *buffer, int128a par) { holder = par; }
15244+
15245+
int
15246+
main ()
15247+
{
15248+
15249+
long int i64 = 97656225L << 12;
15250+
int128a q;
15251+
pass_by_val(main, (int128a) i64);
15252+
q = (int128a) i64;
15253+
if (q != holder)
15254+
return 1;
15255+
15256+
;
15257+
return 0;
15258+
}
15259+
_ACEOF
15260+
if ac_fn_c_try_run "$LINENO"; then :
15261+
pgac_cv__128bit_int_bug=ok
15262+
else
15263+
pgac_cv__128bit_int_bug=broken
15264+
fi
15265+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
15266+
conftest.$ac_objext conftest.beam conftest.$ac_ext
15267+
fi
15268+
15269+
if test x"$pgac_cv__128bit_int_bug" != xbroken ; then
1521115270

1521215271
$as_echo "#define PG_INT128_TYPE __int128" >>confdefs.h
1521315272

15273+
# The cast to long int works around a bug in the HP C Compiler,
15274+
# see AC_CHECK_SIZEOF for more information.
15275+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of PG_INT128_TYPE" >&5
15276+
$as_echo_n "checking alignment of PG_INT128_TYPE... " >&6; }
15277+
if ${ac_cv_alignof_PG_INT128_TYPE+:} false; then :
15278+
$as_echo_n "(cached) " >&6
15279+
else
15280+
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_PG_INT128_TYPE" "$ac_includes_default
15281+
#ifndef offsetof
15282+
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
15283+
#endif
15284+
typedef struct { char x; PG_INT128_TYPE y; } ac__type_alignof_;"; then :
15285+
15286+
else
15287+
if test "$ac_cv_type_PG_INT128_TYPE" = yes; then
15288+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
15289+
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
15290+
as_fn_error 77 "cannot compute alignment of PG_INT128_TYPE
15291+
See \`config.log' for more details" "$LINENO" 5; }
15292+
else
15293+
ac_cv_alignof_PG_INT128_TYPE=0
15294+
fi
15295+
fi
15296+
15297+
fi
15298+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_PG_INT128_TYPE" >&5
15299+
$as_echo "$ac_cv_alignof_PG_INT128_TYPE" >&6; }
15300+
15301+
15302+
15303+
cat >>confdefs.h <<_ACEOF
15304+
#define ALIGNOF_PG_INT128_TYPE $ac_cv_alignof_PG_INT128_TYPE
15305+
_ACEOF
15306+
15307+
15308+
fi
1521415309
fi
1521515310

1521615311
# Check for various atomic operations now that we have checked how to declare

configure.in

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ if test "$with_openssl" = yes ; then
11291129
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
11301130
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
11311131
else
1132-
AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1133-
AC_SEARCH_LIBS(SSL_new, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
1132+
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
1133+
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
11341134
fi
11351135
AC_CHECK_FUNCS([SSL_get_current_compression])
11361136
# Functions introduced in OpenSSL 1.1.0. We used to check for
@@ -1331,6 +1331,12 @@ fi
13311331

13321332
if test "$with_bonjour" = yes ; then
13331333
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
1334+
dnl At some point we might add something like
1335+
dnl AC_SEARCH_LIBS(DNSServiceRegister, dns_sd)
1336+
dnl but right now, what that would mainly accomplish is to encourage
1337+
dnl people to try to use the avahi implementation, which does not work.
1338+
dnl If you want to use Apple's own Bonjour code on another platform,
1339+
dnl just add -ldns_sd to LIBS manually.
13341340
fi
13351341

13361342
# for contrib/uuid-ossp
@@ -1864,7 +1870,10 @@ AC_CHECK_ALIGNOF(double)
18641870

18651871
# Compute maximum alignment of any basic type.
18661872
# We assume long's alignment is at least as strong as char, short, or int;
1867-
# but we must check long long (if it exists) and double.
1873+
# but we must check long long (if it is being used for int64) and double.
1874+
# Note that we intentionally do not consider any types wider than 64 bits,
1875+
# as allowing MAXIMUM_ALIGNOF to exceed 8 would be too much of a penalty
1876+
# for disk and memory space.
18681877

18691878
MAX_ALIGNOF=$ac_cv_alignof_long
18701879
if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
@@ -1881,7 +1890,7 @@ AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignme
18811890
AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [],
18821891
[#include <stdio.h>])
18831892

1884-
# Check for extensions offering the integer scalar type __int128.
1893+
# Some compilers offer a 128-bit integer scalar type.
18851894
PGAC_TYPE_128BIT_INT
18861895

18871896
# Check for various atomic operations now that we have checked how to declare

contrib/bloom/t/001_wal.pl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ sub test_index_replay
3232
);
3333

3434
# Run test queries and compare their result
35-
my $master_result = $node_master->psql("postgres", $queries);
36-
my $standby_result = $node_standby->psql("postgres", $queries);
35+
my $master_result = $node_master->safe_psql("postgres", $queries);
36+
my $standby_result = $node_standby->safe_psql("postgres", $queries);
3737

3838
is($master_result, $standby_result, "$test_name: query result matches");
3939
}
@@ -54,12 +54,12 @@ sub test_index_replay
5454
$node_standby->start;
5555

5656
# Create some bloom index on master
57-
$node_master->psql("postgres", "CREATE EXTENSION bloom;");
58-
$node_master->psql("postgres", "CREATE TABLE tst (i int4, t text);");
59-
$node_master->psql("postgres",
57+
$node_master->safe_psql("postgres", "CREATE EXTENSION bloom;");
58+
$node_master->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);");
59+
$node_master->safe_psql("postgres",
6060
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;"
6161
);
62-
$node_master->psql("postgres",
62+
$node_master->safe_psql("postgres",
6363
"CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);");
6464

6565
# Test that queries give same result
@@ -68,12 +68,12 @@ sub test_index_replay
6868
# Run 10 cycles of table modification. Run test queries after each modification.
6969
for my $i (1 .. 10)
7070
{
71-
$node_master->psql("postgres", "DELETE FROM tst WHERE i = $i;");
71+
$node_master->safe_psql("postgres", "DELETE FROM tst WHERE i = $i;");
7272
test_index_replay("delete $i");
73-
$node_master->psql("postgres", "VACUUM tst;");
73+
$node_master->safe_psql("postgres", "VACUUM tst;");
7474
test_index_replay("vacuum $i");
7575
my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000);
76-
$node_master->psql("postgres",
76+
$node_master->safe_psql("postgres",
7777
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;"
7878
);
7979
test_index_replay("insert $i");

0 commit comments

Comments
 (0)