Skip to content

Commit f255954

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
Conflicts: doc/src/sgml/pgprobackup.sgml
2 parents ae50ef1 + 97d3291 commit f255954

Some content is hidden

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

48 files changed

+632
-353
lines changed

contrib/bloom/blinsert.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,18 @@ blbuildempty(Relation index)
164164
metapage = (Page) palloc(BLCKSZ);
165165
BloomFillMetapage(index, metapage);
166166

167-
/* Write the page. If archiving/streaming, XLOG it. */
167+
/*
168+
* Write the page and log it. It might seem that an immediate sync
169+
* would be sufficient to guarantee that the file exists on disk, but
170+
* recovery itself might remove it while replaying, for example, an
171+
* XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record. Therefore, we
172+
* need this even when wal_level=minimal.
173+
*/
168174
PageSetChecksumInplace(metapage, BLOOM_METAPAGE_BLKNO);
169175
smgrwrite(index->rd_smgr, INIT_FORKNUM, BLOOM_METAPAGE_BLKNO,
170176
(char *) metapage, true);
171-
if (XLogIsNeeded())
172-
log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
173-
BLOOM_METAPAGE_BLKNO, metapage, false);
177+
log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
178+
BLOOM_METAPAGE_BLKNO, metapage, false);
174179

175180
/*
176181
* An immediate sync is required even if we xlog'd the page, because the

contrib/pg_probackup/backup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void pg_start_backup(const char *label, bool smooth, pgBackup *backup);
6464
static void pg_stop_backup(pgBackup *backup);
6565
static bool pg_is_standby(void);
6666
static void get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup);
67-
static void get_xid(PGresult *res, uint32 *xid);
67+
static void get_xid(PGresult *res, TransactionId *xid);
6868
static void pg_ptrack_clear(void);
6969
static bool pg_ptrack_support(void);
7070
static bool pg_ptrack_enable(void);
@@ -1042,14 +1042,14 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
10421042
* Get XID from result of txid_current() after pg_stop_backup().
10431043
*/
10441044
static void
1045-
get_xid(PGresult *res, uint32 *xid)
1045+
get_xid(PGresult *res, TransactionId *xid)
10461046
{
10471047
if (res == NULL || PQntuples(res) != 1 || PQnfields(res) != 1)
10481048
elog(ERROR,
10491049
"result of txid_current() is invalid: %s",
10501050
PQerrorMessage(connection));
10511051

1052-
if (sscanf(PQgetvalue(res, 0, 0), "%u", xid) != 1)
1052+
if (sscanf(PQgetvalue(res, 0, 0), XID_FMT, xid) != 1)
10531053
{
10541054
elog(ERROR,
10551055
"result of txid_current() is invalid: %s",

contrib/pg_probackup/catalog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ catalog_read_ini(const char *path)
337337
{ 's', 0, "stop-lsn" , NULL, SOURCE_ENV },
338338
{ 't', 0, "start-time" , NULL, SOURCE_ENV },
339339
{ 't', 0, "end-time" , NULL, SOURCE_ENV },
340-
{ 'u', 0, "recovery-xid" , NULL, SOURCE_ENV },
340+
{ 'U', 0, "recovery-xid" , NULL, SOURCE_ENV },
341341
{ 't', 0, "recovery-time" , NULL, SOURCE_ENV },
342342
{ 'I', 0, "data-bytes" , NULL, SOURCE_ENV },
343343
{ 'u', 0, "block-size" , NULL, SOURCE_ENV },

contrib/pg_probackup/pg_probackup.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
#define DIR_PERMISSION (0700)
4646
#define FILE_PERMISSION (0600)
4747

48+
#ifndef PGPRO_EE
49+
#define XID_FMT "%u"
50+
#endif
51+
4852
/* backup mode file */
4953
typedef struct pgFile
5054
{
@@ -119,7 +123,7 @@ typedef struct pgBackup
119123
time_t start_time;
120124
time_t end_time;
121125
time_t recovery_time;
122-
uint32 recovery_xid;
126+
TransactionId recovery_xid;
123127

124128
/* Different sizes (-1 means nothing was backed up) */
125129
/*
@@ -159,7 +163,7 @@ typedef struct pgRecoveryTarget
159163
bool time_specified;
160164
time_t recovery_target_time;
161165
bool xid_specified;
162-
unsigned int recovery_target_xid;
166+
TransactionId recovery_target_xid;
163167
bool recovery_target_inclusive;
164168
} pgRecoveryTarget;
165169

contrib/pg_probackup/restore.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ checkIfCreateRecoveryConf(const char *target_time,
775775
const char *target_inclusive)
776776
{
777777
time_t dummy_time;
778-
unsigned int dummy_xid;
778+
TransactionId dummy_xid;
779779
bool dummy_bool;
780780
pgRecoveryTarget *rt;
781781

@@ -798,7 +798,11 @@ checkIfCreateRecoveryConf(const char *target_time,
798798
if (target_xid)
799799
{
800800
rt->xid_specified = true;
801-
if (parse_uint32(target_xid, &dummy_xid))
801+
#ifdef PGPRO_EE
802+
if (parse_uint64(target_xid, &dummy_xid))
803+
#else
804+
if (parse_uint32(target_xid, &dummy_xid))
805+
#endif
802806
rt->recovery_target_xid = dummy_xid;
803807
else
804808
elog(ERROR, "cannot create recovery.conf with %s", target_xid);

doc/src/sgml/func.sgml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,11 +1534,12 @@
15341534
</entry>
15351535
<entry><type>text</type></entry>
15361536
<entry>
1537-
Remove the longest string containing only the
1537+
Remove the longest string containing only characters from
15381538
<parameter>characters</parameter> (a space by default) from the
1539-
start/end/both ends of the <parameter>string</parameter>
1539+
start, end, or both ends (<literal>both</> is the default)
1540+
of <parameter>string</parameter>
15401541
</entry>
1541-
<entry><literal>trim(both 'x' from 'xTomxx')</literal></entry>
1542+
<entry><literal>trim(both 'xyz' from 'yxTomxx')</literal></entry>
15421543
<entry><literal>Tom</literal></entry>
15431544
</row>
15441545

@@ -1547,14 +1548,14 @@
15471548
<literal><function>trim(<optional>leading | trailing
15481549
| both</optional> <optional>from</optional>
15491550
<parameter>string</parameter>
1550-
<optional><parameter>, characters</parameter></optional>
1551+
<optional>, <parameter>characters</parameter></optional>
15511552
)</function></literal>
15521553
</entry>
15531554
<entry><type>text</type></entry>
15541555
<entry>
1555-
Non-standard version of <function>trim()</>
1556+
Non-standard syntax for <function>trim()</>
15561557
</entry>
1557-
<entry><literal>trim(both from 'xTomxx', 'x')</literal></entry>
1558+
<entry><literal>trim(both from 'yxTomxx', 'xyz')</literal></entry>
15581559
<entry><literal>Tom</literal></entry>
15591560
</row>
15601561

@@ -1626,7 +1627,7 @@
16261627
in <parameter>characters</parameter> (a space by default)
16271628
from the start and end of <parameter>string</parameter>
16281629
</entry>
1629-
<entry><literal>btrim('xyxtrimyyx', 'xy')</literal></entry>
1630+
<entry><literal>btrim('xyxtrimyyx', 'xyz')</literal></entry>
16301631
<entry><literal>trim</literal></entry>
16311632
</row>
16321633

@@ -1895,8 +1896,8 @@
18951896
<parameter>characters</parameter> (a space by default) from the start of
18961897
<parameter>string</parameter>
18971898
</entry>
1898-
<entry><literal>ltrim('zzzytrim', 'xyz')</literal></entry>
1899-
<entry><literal>trim</literal></entry>
1899+
<entry><literal>ltrim('zzzytest', 'xyz')</literal></entry>
1900+
<entry><literal>test</literal></entry>
19001901
</row>
19011902

19021903
<row>
@@ -2201,8 +2202,8 @@
22012202
<parameter>characters</parameter> (a space by default) from the end of
22022203
<parameter>string</parameter>
22032204
</entry>
2204-
<entry><literal>rtrim('trimxxxx', 'x')</literal></entry>
2205-
<entry><literal>trim</literal></entry>
2205+
<entry><literal>rtrim('testxxzx', 'xyz')</literal></entry>
2206+
<entry><literal>test</literal></entry>
22062207
</row>
22072208

22082209
<row>
@@ -3467,11 +3468,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
34673468
</entry>
34683469
<entry><type>bytea</type></entry>
34693470
<entry>
3470-
Remove the longest string containing only the bytes in
3471+
Remove the longest string containing only bytes appearing in
34713472
<parameter>bytes</parameter> from the start
34723473
and end of <parameter>string</parameter>
34733474
</entry>
3474-
<entry><literal>trim(E'\\000'::bytea from E'\\000Tom\\000'::bytea)</literal></entry>
3475+
<entry><literal>trim(E'\\000\\001'::bytea from E'\\000Tom\\001'::bytea)</literal></entry>
34753476
<entry><literal>Tom</literal></entry>
34763477
</row>
34773478
</tbody>
@@ -3510,11 +3511,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
35103511
</entry>
35113512
<entry><type>bytea</type></entry>
35123513
<entry>
3513-
Remove the longest string consisting only of bytes
3514-
in <parameter>bytes</parameter> from the start and end of
3514+
Remove the longest string containing only bytes appearing in
3515+
<parameter>bytes</parameter> from the start and end of
35153516
<parameter>string</parameter>
35163517
</entry>
3517-
<entry><literal>btrim(E'\\000trim\\000'::bytea, E'\\000'::bytea)</literal></entry>
3518+
<entry><literal>btrim(E'\\000trim\\001'::bytea, E'\\000\\001'::bytea)</literal></entry>
35183519
<entry><literal>trim</literal></entry>
35193520
</row>
35203521

doc/src/sgml/parallel.sgml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
218218
</para>
219219
</listitem>
220220

221+
<listitem>
222+
<para>
223+
A prepared statement is executed using a <literal>CREATE TABLE .. AS
224+
EXECUTE ..</literal> statement. This construct converts what otherwise
225+
would have been a read-only operation into a read-write operation,
226+
making it ineligible for parallel query.
227+
</para>
228+
</listitem>
229+
221230
<listitem>
222231
<para>
223232
The transaction isolation level is serializable. This situation
@@ -240,7 +249,7 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
240249
copy of the output result set, so the query would not run any faster
241250
than normal but would produce incorrect results. Instead, the parallel
242251
portion of the plan must be what is known internally to the query
243-
optimizer as a <firstterm>partial plan</>; that is, it must constructed
252+
optimizer as a <firstterm>partial plan</>; that is, it must be constructed
244253
so that each process which executes the plan will generate only a
245254
subset of the output rows in such a way that each required output row
246255
is guaranteed to be generated by exactly one of the cooperating processes.

doc/src/sgml/pgprobackup.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,9 @@ pg_probackup restore -j 4
11491149
<listitem>
11501150
<para>
11511151
Only full backups are supported when using
1152-
<ulink url="https://postgrespro.com/docs/postgresproee/current/cfs.html">compressed tablespaces</ulink>
1152+
<ulink
1153+
url="https://postgrespro.com/docs/postgresproee/current/cfs.html">compressed
1154+
tablespaces</ulink>
11531155
(<productname>Postgres Pro Enterprise</productname> feature).
11541156
</para>
11551157
</listitem>

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ doc/src/sgml/ref/pg_dump.sgml
138138
<para>
139139
Include large objects in the dump. This is the default behavior
140140
except when <option>--schema</>, <option>--table</>, or
141-
<option>--schema-only</> is specified, so the <option>-b</>
142-
switch is only useful to add large objects to selective dumps.
141+
<option>--schema-only</> is specified. The <option>-b</>
142+
switch is therefore only useful to add large objects to dumps
143+
where a specific schema or table has been requested. Note that
144+
blobs are considered data and therefore will be included when
145+
--data-only is used, but not when --schema-only is.
143146
</para>
144147
</listitem>
145148
</varlistentry>

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3798,8 +3798,9 @@ $endif
37983798
If the query results do not fit on the screen, they are piped
37993799
through this command. Typical values are
38003800
<literal>more</literal> or <literal>less</literal>. The default
3801-
is platform-dependent. The use of the pager can be disabled by
3802-
using the <command>\pset</command> command.
3801+
is platform-dependent. Use of the pager can be disabled by setting
3802+
<envar>PAGER</envar> to empty, or by using pager-related options of
3803+
the <command>\pset</command> command.
38033804
</para>
38043805
</listitem>
38053806
</varlistentry>
@@ -4170,7 +4171,7 @@ second | four
41704171
with the <command>\crosstabview</command> command:
41714172
<programlisting>
41724173
testdb=&gt; <userinput>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</userinput>
4173-
first | second | ge2
4174+
first | second | gt2
41744175
-------+--------+-----
41754176
1 | one | f
41764177
2 | two | f

doc/src/sgml/release-pro-9.6.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<title>Postgres Pro 9.6.1.2</title>
5252
<note>
5353
<title>Release Date</title>
54-
<simpara>2016-12-09</simpara>
54+
<simpara>2016-12-14</simpara>
5555
</note>
5656
<sect2>
5757
<title>Overview</title>

src/backend/access/nbtree/nbtree.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,18 @@ btbuildempty(Relation index)
244244
metapage = (Page) palloc(BLCKSZ);
245245
_bt_initmetapage(metapage, P_NONE, 0);
246246

247-
/* Write the page. If archiving/streaming, XLOG it. */
247+
/*
248+
* Write the page and log it. It might seem that an immediate sync
249+
* would be sufficient to guarantee that the file exists on disk, but
250+
* recovery itself might remove it while replaying, for example, an
251+
* XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record. Therefore, we
252+
* need this even when wal_level=minimal.
253+
*/
248254
PageSetChecksumInplace(metapage, BTREE_METAPAGE);
249255
smgrwrite(index->rd_smgr, INIT_FORKNUM, BTREE_METAPAGE,
250256
(char *) metapage, true);
251-
if (XLogIsNeeded())
252-
log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
253-
BTREE_METAPAGE, metapage, false);
257+
log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
258+
BTREE_METAPAGE, metapage, false);
254259

255260
/*
256261
* An immediate sync is required even if we xlog'd the page, because the

src/backend/access/rmgrdesc/gindesc.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ gin_desc(StringInfo buf, XLogReaderState *record)
8787
case XLOG_GIN_INSERT:
8888
{
8989
ginxlogInsert *xlrec = (ginxlogInsert *) rec;
90-
char *payload = rec + sizeof(ginxlogInsert);
9190

9291
appendStringInfo(buf, "isdata: %c isleaf: %c",
9392
(xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F',
9493
(xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F');
9594
if (!(xlrec->flags & GIN_INSERT_ISLEAF))
9695
{
96+
char *payload = rec + sizeof(ginxlogInsert);
9797
BlockNumber leftChildBlkno;
9898
BlockNumber rightChildBlkno;
9999

@@ -104,27 +104,27 @@ gin_desc(StringInfo buf, XLogReaderState *record)
104104
appendStringInfo(buf, " children: %u/%u",
105105
leftChildBlkno, rightChildBlkno);
106106
}
107-
if (!(xlrec->flags & GIN_INSERT_ISDATA))
108-
appendStringInfo(buf, " isdelete: %c",
109-
(((ginxlogInsertEntry *) payload)->isDelete) ? 'T' : 'F');
110-
else if (xlrec->flags & GIN_INSERT_ISLEAF)
111-
{
112-
ginxlogRecompressDataLeaf *insertData =
113-
(ginxlogRecompressDataLeaf *) payload;
114-
115-
if (XLogRecHasBlockImage(record, 0))
116-
appendStringInfoString(buf, " (full page image)");
117-
else
118-
desc_recompress_leaf(buf, insertData);
119-
}
107+
if (XLogRecHasBlockImage(record, 0))
108+
appendStringInfoString(buf, " (full page image)");
120109
else
121110
{
122-
ginxlogInsertDataInternal *insertData = (ginxlogInsertDataInternal *) payload;
111+
char *payload = XLogRecGetBlockData(record, 0, NULL);
123112

124-
appendStringInfo(buf, " pitem: %u-%u/%u",
125-
PostingItemGetBlockNumber(&insertData->newitem),
126-
ItemPointerGetBlockNumber(&insertData->newitem.key),
127-
ItemPointerGetOffsetNumber(&insertData->newitem.key));
113+
if (!(xlrec->flags & GIN_INSERT_ISDATA))
114+
appendStringInfo(buf, " isdelete: %c",
115+
(((ginxlogInsertEntry *) payload)->isDelete) ? 'T' : 'F');
116+
else if (xlrec->flags & GIN_INSERT_ISLEAF)
117+
desc_recompress_leaf(buf, (ginxlogRecompressDataLeaf *) payload);
118+
else
119+
{
120+
ginxlogInsertDataInternal *insertData =
121+
(ginxlogInsertDataInternal *) payload;
122+
123+
appendStringInfo(buf, " pitem: %u-%u/%u",
124+
PostingItemGetBlockNumber(&insertData->newitem),
125+
ItemPointerGetBlockNumber(&insertData->newitem.key),
126+
ItemPointerGetOffsetNumber(&insertData->newitem.key));
127+
}
128128
}
129129
}
130130
break;
@@ -144,12 +144,15 @@ gin_desc(StringInfo buf, XLogReaderState *record)
144144
break;
145145
case XLOG_GIN_VACUUM_DATA_LEAF_PAGE:
146146
{
147-
ginxlogVacuumDataLeafPage *xlrec = (ginxlogVacuumDataLeafPage *) rec;
148-
149147
if (XLogRecHasBlockImage(record, 0))
150148
appendStringInfoString(buf, " (full page image)");
151149
else
150+
{
151+
ginxlogVacuumDataLeafPage *xlrec =
152+
(ginxlogVacuumDataLeafPage *) XLogRecGetBlockData(record, 0, NULL);
153+
152154
desc_recompress_leaf(buf, &xlrec->data);
155+
}
153156
}
154157
break;
155158
case XLOG_GIN_DELETE_PAGE:

0 commit comments

Comments
 (0)