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

Commit 5f853ee

Browse files
committed
Merge with master
2 parents 3a3bd25 + 6e22813 commit 5f853ee

File tree

753 files changed

+19229
-12561
lines changed

Some content is hidden

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

753 files changed

+19229
-12561
lines changed

GNUmakefile.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ distcheck: dist
128128
rm -rf $(distdir) $(dummy)
129129
@echo "Distribution integrity checks out."
130130

131+
headerscheck: submake-generated-headers
132+
$(top_srcdir)/src/tools/pginclude/headerscheck $(top_srcdir) $(abs_top_builddir)
133+
131134
cpluspluscheck: submake-generated-headers
132135
$(top_srcdir)/src/tools/pginclude/cpluspluscheck $(top_srcdir) $(abs_top_builddir)
133136

134-
.PHONY: dist distdir distcheck docs install-docs world check-world install-world installcheck-world
137+
.PHONY: dist distdir distcheck docs install-docs world check-world install-world installcheck-world headerscheck cpluspluscheck

config/programs.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ for pgac_rllib in $READLINE_ORDER ; do
179179
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
180180
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
181181
AC_TRY_LINK_FUNC([readline], [[
182-
# Older NetBSD, OpenBSD, and Irix have a broken linker that does not
182+
# Older NetBSD and OpenBSD have a broken linker that does not
183183
# recognize dependent libraries; assume curses is needed if we didn't
184184
# find any dependency.
185185
case $host_os in
186-
netbsd* | openbsd* | irix*)
186+
netbsd* | openbsd*)
187187
if test x"$pgac_lib" = x"" ; then
188188
pgac_lib=" -lcurses"
189189
fi ;;

configure

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11209,62 +11209,6 @@ if test "$ac_res" != no; then :
1120911209

1121011210
fi
1121111211

11212-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
11213-
$as_echo_n "checking for library containing crypt... " >&6; }
11214-
if ${ac_cv_search_crypt+:} false; then :
11215-
$as_echo_n "(cached) " >&6
11216-
else
11217-
ac_func_search_save_LIBS=$LIBS
11218-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11219-
/* end confdefs.h. */
11220-
11221-
/* Override any GCC internal prototype to avoid an error.
11222-
Use char because int might match the return type of a GCC
11223-
builtin and then its argument prototype would still apply. */
11224-
#ifdef __cplusplus
11225-
extern "C"
11226-
#endif
11227-
char crypt ();
11228-
int
11229-
main ()
11230-
{
11231-
return crypt ();
11232-
;
11233-
return 0;
11234-
}
11235-
_ACEOF
11236-
for ac_lib in '' crypt; do
11237-
if test -z "$ac_lib"; then
11238-
ac_res="none required"
11239-
else
11240-
ac_res=-l$ac_lib
11241-
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
11242-
fi
11243-
if ac_fn_c_try_link "$LINENO"; then :
11244-
ac_cv_search_crypt=$ac_res
11245-
fi
11246-
rm -f core conftest.err conftest.$ac_objext \
11247-
conftest$ac_exeext
11248-
if ${ac_cv_search_crypt+:} false; then :
11249-
break
11250-
fi
11251-
done
11252-
if ${ac_cv_search_crypt+:} false; then :
11253-
11254-
else
11255-
ac_cv_search_crypt=no
11256-
fi
11257-
rm conftest.$ac_ext
11258-
LIBS=$ac_func_search_save_LIBS
11259-
fi
11260-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_crypt" >&5
11261-
$as_echo "$ac_cv_search_crypt" >&6; }
11262-
ac_res=$ac_cv_search_crypt
11263-
if test "$ac_res" != no; then :
11264-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
11265-
11266-
fi
11267-
1126811212
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5
1126911213
$as_echo_n "checking for library containing shm_open... " >&6; }
1127011214
if ${ac_cv_search_shm_open+:} false; then :
@@ -11700,11 +11644,11 @@ return readline ();
1170011644
_ACEOF
1170111645
if ac_fn_c_try_link "$LINENO"; then :
1170211646

11703-
# Older NetBSD, OpenBSD, and Irix have a broken linker that does not
11647+
# Older NetBSD and OpenBSD have a broken linker that does not
1170411648
# recognize dependent libraries; assume curses is needed if we didn't
1170511649
# find any dependency.
1170611650
case $host_os in
11707-
netbsd* | openbsd* | irix*)
11651+
netbsd* | openbsd*)
1170811652
if test x"$pgac_lib" = x"" ; then
1170911653
pgac_lib=" -lcurses"
1171011654
fi ;;
@@ -12760,7 +12704,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
1276012704
fi
1276112705

1276212706

12763-
for ac_header in atomic.h copyfile.h crypt.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
12707+
for ac_header in atomic.h copyfile.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
1276412708
do :
1276512709
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1276612710
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -15143,7 +15087,7 @@ fi
1514315087
LIBS_including_readline="$LIBS"
1514415088
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
1514515089

15146-
for ac_func in cbrt clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale utime utimes wcstombs_l
15090+
for ac_func in cbrt clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memset_s memmove poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale utime utimes wcstombs_l
1514715091
do :
1514815092
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1514915093
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15782,27 +15726,27 @@ done
1578215726

1578315727
fi
1578415728

15785-
ac_fn_c_check_func "$LINENO" "crypt" "ac_cv_func_crypt"
15786-
if test "x$ac_cv_func_crypt" = xyes; then :
15787-
$as_echo "#define HAVE_CRYPT 1" >>confdefs.h
15729+
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
15730+
if test "x$ac_cv_func_dlopen" = xyes; then :
15731+
$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
1578815732

1578915733
else
1579015734
case " $LIBOBJS " in
15791-
*" crypt.$ac_objext "* ) ;;
15792-
*) LIBOBJS="$LIBOBJS crypt.$ac_objext"
15735+
*" dlopen.$ac_objext "* ) ;;
15736+
*) LIBOBJS="$LIBOBJS dlopen.$ac_objext"
1579315737
;;
1579415738
esac
1579515739

1579615740
fi
1579715741

15798-
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
15799-
if test "x$ac_cv_func_dlopen" = xyes; then :
15800-
$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
15742+
ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
15743+
if test "x$ac_cv_func_explicit_bzero" = xyes; then :
15744+
$as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h
1580115745

1580215746
else
1580315747
case " $LIBOBJS " in
15804-
*" dlopen.$ac_objext "* ) ;;
15805-
*) LIBOBJS="$LIBOBJS dlopen.$ac_objext"
15748+
*" explicit_bzero.$ac_objext "* ) ;;
15749+
*) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
1580615750
;;
1580715751
esac
1580815752

@@ -18686,13 +18630,13 @@ $as_echo "$XMLLINT" >&6; }
1868618630
fi
1868718631

1868818632

18689-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DocBook XML V4.2" >&5
18690-
$as_echo_n "checking for DocBook XML V4.2... " >&6; }
18633+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DocBook XML V4.5" >&5
18634+
$as_echo_n "checking for DocBook XML V4.5... " >&6; }
1869118635
if ${pgac_cv_check_docbook+:} false; then :
1869218636
$as_echo_n "(cached) " >&6
1869318637
else
1869418638
cat >conftest.xml <<EOF
18695-
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
18639+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
1869618640
<book>
1869718641
<title>test</title>
1869818642
<chapter>

configure.in

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,6 @@ AC_SEARCH_LIBS(dlopen, dl)
11181118
AC_SEARCH_LIBS(socket, [socket ws2_32])
11191119
AC_SEARCH_LIBS(shl_load, dld)
11201120
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
1121-
AC_SEARCH_LIBS(crypt, crypt)
11221121
AC_SEARCH_LIBS(shm_open, rt)
11231122
AC_SEARCH_LIBS(shm_unlink, rt)
11241123
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
@@ -1273,7 +1272,6 @@ AC_HEADER_STDBOOL
12731272
AC_CHECK_HEADERS(m4_normalize([
12741273
atomic.h
12751274
copyfile.h
1276-
crypt.h
12771275
fp_class.h
12781276
getopt.h
12791277
ieeefp.h
@@ -1596,6 +1594,7 @@ AC_CHECK_FUNCS(m4_normalize([
15961594
getpeerucred
15971595
getrlimit
15981596
mbstowcs_l
1597+
memset_s
15991598
memmove
16001599
poll
16011600
posix_fallocate
@@ -1692,8 +1691,8 @@ else
16921691
fi
16931692

16941693
AC_REPLACE_FUNCS(m4_normalize([
1695-
crypt
16961694
dlopen
1695+
explicit_bzero
16971696
fls
16981697
getopt
16991698
getrusage
@@ -2257,7 +2256,7 @@ fi
22572256
# Check for DocBook and tools
22582257
#
22592258
PGAC_PATH_XMLLINT
2260-
PGAC_CHECK_DOCBOOK(4.2)
2259+
PGAC_CHECK_DOCBOOK(4.5)
22612260
PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
22622261
PGAC_PATH_PROGS(XSLTPROC, xsltproc)
22632262
PGAC_PATH_PROGS(FOP, fop)

contrib/amcheck/verify_nbtree.c

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "lib/bloomfilter.h"
3636
#include "miscadmin.h"
3737
#include "storage/lmgr.h"
38+
#include "storage/smgr.h"
3839
#include "utils/memutils.h"
3940
#include "utils/snapmgr.h"
4041

@@ -128,6 +129,7 @@ PG_FUNCTION_INFO_V1(bt_index_parent_check);
128129
static void bt_index_check_internal(Oid indrelid, bool parentcheck,
129130
bool heapallindexed, bool rootdescend);
130131
static inline void btree_index_checkable(Relation rel);
132+
static inline bool btree_index_mainfork_expected(Relation rel);
131133
static void bt_check_every_level(Relation rel, Relation heaprel,
132134
bool heapkeyspace, bool readonly, bool heapallindexed,
133135
bool rootdescend);
@@ -225,7 +227,6 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
225227
Oid heapid;
226228
Relation indrel;
227229
Relation heaprel;
228-
bool heapkeyspace;
229230
LOCKMODE lockmode;
230231

231232
if (parentcheck)
@@ -275,10 +276,22 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
275276
/* Relation suitable for checking as B-Tree? */
276277
btree_index_checkable(indrel);
277278

278-
/* Check index, possibly against table it is an index on */
279-
heapkeyspace = _bt_heapkeyspace(indrel);
280-
bt_check_every_level(indrel, heaprel, heapkeyspace, parentcheck,
281-
heapallindexed, rootdescend);
279+
if (btree_index_mainfork_expected(indrel))
280+
{
281+
bool heapkeyspace;
282+
283+
RelationOpenSmgr(indrel);
284+
if (!smgrexists(indrel->rd_smgr, MAIN_FORKNUM))
285+
ereport(ERROR,
286+
(errcode(ERRCODE_INDEX_CORRUPTED),
287+
errmsg("index \"%s\" lacks a main relation fork",
288+
RelationGetRelationName(indrel))));
289+
290+
/* Check index, possibly against table it is an index on */
291+
heapkeyspace = _bt_heapkeyspace(indrel);
292+
bt_check_every_level(indrel, heaprel, heapkeyspace, parentcheck,
293+
heapallindexed, rootdescend);
294+
}
282295

283296
/*
284297
* Release locks early. That's ok here because nothing in the called
@@ -324,6 +337,28 @@ btree_index_checkable(Relation rel)
324337
errdetail("Index is not valid.")));
325338
}
326339

340+
/*
341+
* Check if B-Tree index relation should have a file for its main relation
342+
* fork. Verification uses this to skip unlogged indexes when in hot standby
343+
* mode, where there is simply nothing to verify.
344+
*
345+
* NB: Caller should call btree_index_checkable() before calling here.
346+
*/
347+
static inline bool
348+
btree_index_mainfork_expected(Relation rel)
349+
{
350+
if (rel->rd_rel->relpersistence != RELPERSISTENCE_UNLOGGED ||
351+
!RecoveryInProgress())
352+
return true;
353+
354+
ereport(NOTICE,
355+
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
356+
errmsg("cannot verify unlogged index \"%s\" during recovery, skipping",
357+
RelationGetRelationName(rel))));
358+
359+
return false;
360+
}
361+
327362
/*
328363
* Main entry point for B-Tree SQL-callable functions. Walks the B-Tree in
329364
* logical order, verifying invariants as it goes. Optionally, verification

contrib/bloom/blutils.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ _PG_init(void)
6060
/* Option for length of signature */
6161
add_int_reloption(bl_relopt_kind, "length",
6262
"Length of signature in bits",
63-
DEFAULT_BLOOM_LENGTH, 1, MAX_BLOOM_LENGTH);
63+
DEFAULT_BLOOM_LENGTH, 1, MAX_BLOOM_LENGTH,
64+
AccessExclusiveLock);
6465
bl_relopt_tab[0].optname = "length";
6566
bl_relopt_tab[0].opttype = RELOPT_TYPE_INT;
6667
bl_relopt_tab[0].offset = offsetof(BloomOptions, bloomLength);
@@ -71,7 +72,8 @@ _PG_init(void)
7172
snprintf(buf, sizeof(buf), "col%d", i + 1);
7273
add_int_reloption(bl_relopt_kind, buf,
7374
"Number of bits generated for each index column",
74-
DEFAULT_BLOOM_BITS, 1, MAX_BLOOM_BITS);
75+
DEFAULT_BLOOM_BITS, 1, MAX_BLOOM_BITS,
76+
AccessExclusiveLock);
7577
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
7678
buf);
7779
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;

contrib/bloom/expected/bloom.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CREATE TABLE tst (
55
);
66
INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,2000) i;
77
CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);
8+
ALTER INDEX bloomidx SET (length=80);
89
SET enable_seqscan=on;
910
SET enable_bitmapscan=off;
1011
SET enable_indexscan=off;

contrib/bloom/sql/bloom.sql

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

88
INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,2000) i;
99
CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);
10+
ALTER INDEX bloomidx SET (length=80);
1011

1112
SET enable_seqscan=on;
1213
SET enable_bitmapscan=off;

contrib/fuzzystrmatch/dmetaphone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS)
191191
(v = (t*)repalloc((v),((n)*sizeof(t))))
192192

193193
/*
194-
* Don't do pfree - it seems to cause a segv sometimes - which might have just
194+
* Don't do pfree - it seems to cause a SIGSEGV sometimes - which might have just
195195
* been caused by reloading the module in development.
196196
* So we rely on context cleanup - Tom Lane says pfree shouldn't be necessary
197197
* in a case like this.

contrib/hstore/hstore_op.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,8 @@ hstore_slice_to_hstore(PG_FUNCTION_ARGS)
682682
}
683683

684684
/*
685-
* we don't use uniquePairs here because we know that the pairs list is
686-
* already sorted and uniq'ed.
685+
* we don't use hstoreUniquePairs here because we know that the pairs list
686+
* is already sorted and uniq'ed.
687687
*/
688688

689689
out = hstorePairs(out_pairs, out_count, bufsiz);

contrib/intarray/_int_gist.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@ g_int_consistent(PG_FUNCTION_ARGS)
9696
retval = inner_int_contains(query,
9797
(ArrayType *) DatumGetPointer(entry->key));
9898
else
99-
retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
100-
query);
99+
{
100+
/*
101+
* Unfortunately, because empty arrays could be anywhere in
102+
* the index, we must search the whole tree.
103+
*/
104+
retval = true;
105+
}
101106
break;
102107
default:
103108
retval = false;

contrib/intarray/_int_tool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ resize_intArrayType(ArrayType *a, int num)
256256
if (num <= 0)
257257
{
258258
Assert(num == 0);
259-
ARR_NDIM(a) = 0;
259+
a = construct_empty_array(INT4OID);
260260
return a;
261261
}
262262

contrib/intarray/_intbig_gist.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,13 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
567567
}
568568
}
569569
else
570-
retval = _intbig_overlap((GISTTYPE *) DatumGetPointer(entry->key), query);
570+
{
571+
/*
572+
* Unfortunately, because empty arrays could be anywhere in
573+
* the index, we must search the whole tree.
574+
*/
575+
retval = true;
576+
}
571577
break;
572578
default:
573579
retval = false;

0 commit comments

Comments
 (0)