Skip to content

Commit 48404a1

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
Conflicts: configure configure.in
2 parents 448ff3b + 221d63c commit 48404a1

File tree

206 files changed

+15179
-10808
lines changed

Some content is hidden

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

206 files changed

+15179
-10808
lines changed

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for PostgreSQL 9.6.beta.3.
3+
# Generated by GNU Autoconf 2.69 for PostgreSQL 9.6.beta.4.
44
#
55
# Report bugs to <pgsql-bugs@postgresql.org>.
66
#
@@ -582,8 +582,8 @@ MAKEFLAGS=
582582
# Identity of this package.
583583
PACKAGE_NAME='PostgrePro'
584584
PACKAGE_TARNAME='postgrespro'
585-
PACKAGE_VERSION='9.6.beta.3'
586-
PACKAGE_STRING='PostgresPro 9.6.beta.3'
585+
PACKAGE_VERSION='9.6.beta.4'
586+
PACKAGE_STRING='PostgresPro 9.6.beta.4'
587587
PACKAGE_BUGREPORT='bugs@postgrespro.ru'
588588
PACKAGE_URL=''
589589

@@ -1398,7 +1398,7 @@ if test "$ac_init_help" = "long"; then
13981398
# Omit some internal or obsolete options to make the list less imposing.
13991399
# This message is too long to be a string in the A/UX 3.1 sh.
14001400
cat <<_ACEOF
1401-
\`configure' configures PostgreSQL 9.6.beta.3 to adapt to many kinds of systems.
1401+
\`configure' configures PostgreSQL 9.6.beta.4 to adapt to many kinds of systems.
14021402
14031403
Usage: $0 [OPTION]... [VAR=VALUE]...
14041404
@@ -1463,7 +1463,7 @@ fi
14631463

14641464
if test -n "$ac_init_help"; then
14651465
case $ac_init_help in
1466-
short | recursive ) echo "Configuration of PostgreSQL 9.6.beta.3:";;
1466+
short | recursive ) echo "Configuration of PostgreSQL 9.6.beta.4:";;
14671467
esac
14681468
cat <<\_ACEOF
14691469
@@ -1615,7 +1615,7 @@ fi
16151615
test -n "$ac_init_help" && exit $ac_status
16161616
if $ac_init_version; then
16171617
cat <<\_ACEOF
1618-
PostgreSQL configure 9.6.beta.3
1618+
PostgreSQL configure 9.6.beta.4
16191619
generated by GNU Autoconf 2.69
16201620
16211621
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2326,7 +2326,7 @@ cat >config.log <<_ACEOF
23262326
This file contains any messages produced by compilers while
23272327
running configure, to aid debugging if configure makes a mistake.
23282328
2329-
It was created by PostgreSQL $as_me 9.6.beta.3, which was
2329+
It was created by PostgreSQL $as_me 9.6.beta.4, which was
23302330
generated by GNU Autoconf 2.69. Invocation command line was
23312331
23322332
$ $0 $@
@@ -16433,7 +16433,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1643316433
# report actual input values of CONFIG_FILES etc. instead of their
1643416434
# values after options handling.
1643516435
ac_log="
16436-
This file was extended by PostgreSQL $as_me 9.6.beta.3, which was
16436+
This file was extended by PostgreSQL $as_me 9.6.beta.4, which was
1643716437
generated by GNU Autoconf 2.69. Invocation command line was
1643816438
1643916439
CONFIG_FILES = $CONFIG_FILES
@@ -16503,7 +16503,7 @@ _ACEOF
1650316503
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1650416504
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1650516505
ac_cs_version="\\
16506-
PostgreSQL config.status 9.6.beta.3
16506+
PostgreSQL config.status 9.6.beta.4
1650716507
configured by $0, generated by GNU Autoconf 2.69,
1650816508
with options \\"\$ac_cs_config\\"
1650916509

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details.
1717
dnl
1818
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
1919

20-
AC_INIT([PostgreSQL], [9.6.beta.3], [pgsql-bugs@postgresql.org])
20+
AC_INIT([PostgreSQL], [9.6.beta.4], [pgsql-bugs@postgresql.org])
2121

2222
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
2323
Untested combinations of 'autoconf' and PostgreSQL versions are not

contrib/bloom/blinsert.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ blinsert(Relation index, Datum *values, bool *isnull,
237237
state = GenericXLogStart(index);
238238
page = GenericXLogRegisterBuffer(state, buffer, 0);
239239

240+
/*
241+
* We might have found a page that was recently deleted by VACUUM. If
242+
* so, we can reuse it, but we must reinitialize it.
243+
*/
244+
if (PageIsNew(page) || BloomPageIsDeleted(page))
245+
BloomInitPage(page, 0);
246+
240247
if (BloomPageAddItem(&blstate, page, itup))
241248
{
242249
/* Success! Apply the change, clean up, and exit */
@@ -295,6 +302,10 @@ blinsert(Relation index, Datum *values, bool *isnull,
295302
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
296303
page = GenericXLogRegisterBuffer(state, buffer, 0);
297304

305+
/* Basically same logic as above */
306+
if (PageIsNew(page) || BloomPageIsDeleted(page))
307+
BloomInitPage(page, 0);
308+
298309
if (BloomPageAddItem(&blstate, page, itup))
299310
{
300311
/* Success! Apply the changes, clean up, and exit */

contrib/bloom/blscan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
135135
page = BufferGetPage(buffer);
136136
TestForOldSnapshot(scan->xs_snapshot, scan->indexRelation, page);
137137

138-
if (!BloomPageIsDeleted(page))
138+
if (!PageIsNew(page) && !BloomPageIsDeleted(page))
139139
{
140140
OffsetNumber offset,
141141
maxOffset = BloomPageGetMaxOffset(page);

contrib/bloom/blutils.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,25 @@ blhandler(PG_FUNCTION_ARGS)
119119
amroutine->amstorage = false;
120120
amroutine->amclusterable = false;
121121
amroutine->ampredlocks = false;
122-
amroutine->amkeytype = 0;
122+
amroutine->amkeytype = InvalidOid;
123123

124-
amroutine->aminsert = blinsert;
125-
amroutine->ambeginscan = blbeginscan;
126-
amroutine->amgettuple = NULL;
127-
amroutine->amgetbitmap = blgetbitmap;
128-
amroutine->amrescan = blrescan;
129-
amroutine->amendscan = blendscan;
130-
amroutine->ammarkpos = NULL;
131-
amroutine->amrestrpos = NULL;
132124
amroutine->ambuild = blbuild;
133125
amroutine->ambuildempty = blbuildempty;
126+
amroutine->aminsert = blinsert;
134127
amroutine->ambulkdelete = blbulkdelete;
135128
amroutine->amvacuumcleanup = blvacuumcleanup;
136129
amroutine->amcanreturn = NULL;
137130
amroutine->amcostestimate = blcostestimate;
138131
amroutine->amoptions = bloptions;
132+
amroutine->amproperty = NULL;
139133
amroutine->amvalidate = blvalidate;
134+
amroutine->ambeginscan = blbeginscan;
135+
amroutine->amrescan = blrescan;
136+
amroutine->amgettuple = NULL;
137+
amroutine->amgetbitmap = blgetbitmap;
138+
amroutine->amendscan = blendscan;
139+
amroutine->ammarkpos = NULL;
140+
amroutine->amrestrpos = NULL;
140141

141142
PG_RETURN_POINTER(amroutine);
142143
}
@@ -298,7 +299,7 @@ BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull)
298299

299300
/*
300301
* Add new bloom tuple to the page. Returns true if new tuple was successfully
301-
* added to the page. Returns false if it doesn't fit the page.
302+
* added to the page. Returns false if it doesn't fit on the page.
302303
*/
303304
bool
304305
BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
@@ -307,7 +308,10 @@ BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
307308
BloomPageOpaque opaque;
308309
Pointer ptr;
309310

310-
/* Does new tuple fit the page */
311+
/* We shouldn't be pointed to an invalid page */
312+
Assert(!PageIsNew(page) && !BloomPageIsDeleted(page));
313+
314+
/* Does new tuple fit on the page? */
311315
if (BloomPageGetFreeSpace(state, page) < state->sizeOfBloomTuple)
312316
return false;
313317

@@ -321,6 +325,9 @@ BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple)
321325
ptr = (Pointer) BloomPageGetTuple(state, page, opaque->maxoff + 1);
322326
((PageHeader) page)->pd_lower = ptr - page;
323327

328+
/* Assert we didn't overrun available space */
329+
Assert(((PageHeader) page)->pd_lower <= ((PageHeader) page)->pd_upper);
330+
324331
return true;
325332
}
326333

@@ -423,6 +430,9 @@ BloomFillMetapage(Relation index, Page metaPage)
423430
metadata->magickNumber = BLOOM_MAGICK_NUMBER;
424431
metadata->opts = *opts;
425432
((PageHeader) metaPage)->pd_lower += sizeof(BloomMetaPageData);
433+
434+
/* If this fails, probably FreeBlockNumberArray size calc is wrong: */
435+
Assert(((PageHeader) metaPage)->pd_lower <= ((PageHeader) metaPage)->pd_upper);
426436
}
427437

428438
/*

contrib/bloom/blvacuum.c

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "postgres.h"
1414

1515
#include "access/genam.h"
16+
#include "bloom.h"
1617
#include "catalog/storage.h"
1718
#include "commands/vacuum.h"
1819
#include "miscadmin.h"
@@ -21,7 +22,6 @@
2122
#include "storage/indexfsm.h"
2223
#include "storage/lmgr.h"
2324

24-
#include "bloom.h"
2525

2626
/*
2727
* Bulk deletion of all index entries pointing to a set of heap tuples.
@@ -42,6 +42,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
4242
BloomState state;
4343
Buffer buffer;
4444
Page page;
45+
BloomMetaPageData *metaData;
4546
GenericXLogState *gxlogState;
4647

4748
if (stats == NULL)
@@ -60,22 +61,27 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
6061
*itupPtr,
6162
*itupEnd;
6263

64+
vacuum_delay_point();
65+
6366
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
6467
RBM_NORMAL, info->strategy);
6568

6669
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
6770
gxlogState = GenericXLogStart(index);
6871
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
6972

70-
if (BloomPageIsDeleted(page))
73+
/* Ignore empty/deleted pages until blvacuumcleanup() */
74+
if (PageIsNew(page) || BloomPageIsDeleted(page))
7175
{
7276
UnlockReleaseBuffer(buffer);
7377
GenericXLogAbort(gxlogState);
74-
CHECK_FOR_INTERRUPTS();
7578
continue;
7679
}
7780

78-
/* Iterate over the tuples */
81+
/*
82+
* Iterate over the tuples. itup points to current tuple being
83+
* scanned, itupPtr points to where to save next non-deleted tuple.
84+
*/
7985
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
8086
itupEnd = BloomPageGetTuple(&state, page,
8187
OffsetNumberNext(BloomPageGetMaxOffset(page)));
@@ -84,36 +90,32 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
8490
/* Do we have to delete this tuple? */
8591
if (callback(&itup->heapPtr, callback_state))
8692
{
87-
stats->tuples_removed += 1;
93+
/* Yes; adjust count of tuples that will be left on page */
8894
BloomPageGetOpaque(page)->maxoff--;
95+
stats->tuples_removed += 1;
8996
}
9097
else
9198
{
99+
/* No; copy it to itupPtr++, but skip copy if not needed */
92100
if (itupPtr != itup)
93-
{
94-
/*
95-
* If we already delete something before, we have to move
96-
* this tuple backward.
97-
*/
98101
memmove((Pointer) itupPtr, (Pointer) itup,
99102
state.sizeOfBloomTuple);
100-
}
101-
stats->num_index_tuples++;
102103
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
103104
}
104105

105106
itup = BloomPageGetNextTuple(&state, itup);
106107
}
107108

109+
/* Assert that we counted correctly */
108110
Assert(itupPtr == BloomPageGetTuple(&state, page,
109111
OffsetNumberNext(BloomPageGetMaxOffset(page))));
110112

111113
/*
112-
* Add page to notFullPage list if we will not mark page as deleted
113-
* and there is a free space on it
114+
* Add page to new notFullPage list if we will not mark page as
115+
* deleted and there is free space on it
114116
*/
115117
if (BloomPageGetMaxOffset(page) != 0 &&
116-
BloomPageGetFreeSpace(&state, page) > state.sizeOfBloomTuple &&
118+
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
117119
countPage < BloomMetaBlockN)
118120
notFullPage[countPage++] = blkno;
119121

@@ -134,27 +136,26 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
134136
GenericXLogAbort(gxlogState);
135137
}
136138
UnlockReleaseBuffer(buffer);
137-
CHECK_FOR_INTERRUPTS();
138139
}
139140

140-
if (countPage > 0)
141-
{
142-
BloomMetaPageData *metaData;
143-
144-
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
145-
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
141+
/*
142+
* Update the metapage's notFullPage list with whatever we found. Our
143+
* info could already be out of date at this point, but blinsert() will
144+
* cope if so.
145+
*/
146+
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
147+
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
146148

147-
gxlogState = GenericXLogStart(index);
148-
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
149+
gxlogState = GenericXLogStart(index);
150+
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
149151

150-
metaData = BloomPageGetMeta(page);
151-
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
152-
metaData->nStart = 0;
153-
metaData->nEnd = countPage;
152+
metaData = BloomPageGetMeta(page);
153+
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
154+
metaData->nStart = 0;
155+
metaData->nEnd = countPage;
154156

155-
GenericXLogFinish(gxlogState);
156-
UnlockReleaseBuffer(buffer);
157-
}
157+
GenericXLogFinish(gxlogState);
158+
UnlockReleaseBuffer(buffer);
158159

159160
return stats;
160161
}
@@ -170,7 +171,6 @@ blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
170171
Relation index = info->index;
171172
BlockNumber npages,
172173
blkno;
173-
BlockNumber totFreePages;
174174

175175
if (info->analyze_only)
176176
return stats;
@@ -183,7 +183,9 @@ blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
183183
* statistics.
184184
*/
185185
npages = RelationGetNumberOfBlocks(index);
186-
totFreePages = 0;
186+
stats->num_pages = npages;
187+
stats->pages_free = 0;
188+
stats->num_index_tuples = 0;
187189
for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno++)
188190
{
189191
Buffer buffer;
@@ -196,23 +198,20 @@ blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
196198
LockBuffer(buffer, BUFFER_LOCK_SHARE);
197199
page = (Page) BufferGetPage(buffer);
198200

199-
if (BloomPageIsDeleted(page))
201+
if (PageIsNew(page) || BloomPageIsDeleted(page))
200202
{
201203
RecordFreeIndexPage(index, blkno);
202-
totFreePages++;
204+
stats->pages_free++;
203205
}
204206
else
205207
{
206208
stats->num_index_tuples += BloomPageGetMaxOffset(page);
207-
stats->estimated_count += BloomPageGetMaxOffset(page);
208209
}
209210

210211
UnlockReleaseBuffer(buffer);
211212
}
212213

213214
IndexFreeSpaceMapVacuum(info->index);
214-
stats->pages_free = totFreePages;
215-
stats->num_pages = RelationGetNumberOfBlocks(index);
216215

217216
return stats;
218217
}

contrib/intarray/bench/bench.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292

9393
if ($opt{e})
9494
{
95-
$dbi->do("explain $sql");
95+
my @plan = map { "$_->[0]\n" } @{$dbi->selectall_arrayref("explain $sql")};
96+
print @plan;
9697
}
9798

9899
my $t0 = [gettimeofday];

contrib/pgcrypto/px.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static const struct error_desc px_err_list[] = {
4848
{PXE_BAD_OPTION, "Unknown option"},
4949
{PXE_BAD_FORMAT, "Badly formatted type"},
5050
{PXE_KEY_TOO_BIG, "Key was too big"},
51-
{PXE_CIPHER_INIT, "Cipher cannot be initalized ?"},
51+
{PXE_CIPHER_INIT, "Cipher cannot be initialized ?"},
5252
{PXE_HASH_UNUSABLE_FOR_HMAC, "This hash algorithm is unusable for HMAC"},
5353
{PXE_DEV_READ_ERROR, "Error reading from random device"},
5454
{PXE_OSSL_RAND_ERROR, "OpenSSL PRNG error"},

0 commit comments

Comments
 (0)