Skip to content

Commit 4e4f227

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
2 parents 52123f3 + 3a3ac47 commit 4e4f227

File tree

20 files changed

+215
-85
lines changed

20 files changed

+215
-85
lines changed

doc/src/sgml/config.sgml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,8 @@ include_dir 'conf.d'
10481048
in the <application>OpenSSL</> package for the syntax of this setting
10491049
and a list of supported values. The default value is
10501050
<literal>HIGH:MEDIUM:+3DES:!aNULL</>. It is usually reasonable,
1051-
unless you have specific security requirements.
1051+
unless you have specific security requirements. This parameter can only
1052+
be set at server start.
10521053
</para>
10531054

10541055
<para>
@@ -1120,7 +1121,8 @@ include_dir 'conf.d'
11201121
<listitem>
11211122
<para>
11221123
Specifies whether to use the server's SSL cipher preferences, rather
1123-
than the client's. The default is true.
1124+
than the client's. The default is true. This parameter can only be
1125+
set at server start.
11241126
</para>
11251127

11261128
<para>
@@ -1144,7 +1146,8 @@ include_dir 'conf.d'
11441146
Specifies the name of the curve to use in <acronym>ECDH</> key
11451147
exchange. It needs to be supported by all clients that connect.
11461148
It does not need to be same curve as used by server's Elliptic
1147-
Curve key. The default is <literal>prime256v1</>.
1149+
Curve key. The default is <literal>prime256v1</>. This parameter
1150+
can only be set at server start.
11481151
</para>
11491152

11501153
<para>
@@ -1902,10 +1905,10 @@ include_dir 'conf.d'
19021905
<xref linkend="guc-shared-buffers">, but smaller than the OS's page
19031906
cache, where performance might degrade. This setting may have no
19041907
effect on some platforms. The valid range is between
1905-
<literal>0</literal>, which disables controlled writeback, and
1908+
<literal>0</literal>, which disables forced writeback, and
19061909
<literal>2MB</literal>. The default is <literal>512kB</> on Linux,
1907-
<literal>0</> elsewhere. (Non-default values of
1908-
<symbol>BLCKSZ</symbol> change the default and maximum.)
1910+
<literal>0</> elsewhere. (If <symbol>BLCKSZ</symbol> is not 8kB,
1911+
the default and maximum values scale proportionally to it.)
19091912
This parameter can only be set in the <filename>postgresql.conf</>
19101913
file or on the server command line.
19111914
</para>
@@ -2054,10 +2057,10 @@ include_dir 'conf.d'
20542057
that are bigger than <xref linkend="guc-shared-buffers">, but smaller
20552058
than the OS's page cache, where performance might degrade. This
20562059
setting may have no effect on some platforms. The valid range is
2057-
between <literal>0</literal>, which disables controlled writeback,
2058-
and <literal>2MB</literal>. The default is <literal>0</> (i.e. no
2059-
flush control). (Non-default values of <symbol>BLCKSZ</symbol>
2060-
change the maximum.)
2060+
between <literal>0</literal>, which disables forced writeback,
2061+
and <literal>2MB</literal>. The default is <literal>0</>, i.e., no
2062+
forced writeback. (If <symbol>BLCKSZ</symbol> is not 8kB,
2063+
the maximum value scales proportionally to it.)
20612064
</para>
20622065
</listitem>
20632066
</varlistentry>
@@ -2517,10 +2520,11 @@ include_dir 'conf.d'
25172520
<para>
25182521
Specifies how often the WAL writer flushes WAL. After flushing WAL it
25192522
sleeps for <varname>wal_writer_delay</> milliseconds, unless woken up
2520-
by an asynchronously committing transaction. In case the last flush
2523+
by an asynchronously committing transaction. If the last flush
25212524
happened less than <varname>wal_writer_delay</> milliseconds ago and
25222525
less than <varname>wal_writer_flush_after</> bytes of WAL have been
2523-
produced since, WAL is only written to the OS, not flushed to disk.
2526+
produced since, then WAL is only written to the operating system, not
2527+
flushed to disk.
25242528
The default value is 200 milliseconds (<literal>200ms</>). Note that
25252529
on many systems, the effective resolution of sleep delays is 10
25262530
milliseconds; setting <varname>wal_writer_delay</> to a value that is
@@ -2539,12 +2543,12 @@ include_dir 'conf.d'
25392543
</term>
25402544
<listitem>
25412545
<para>
2542-
Specifies how often the WAL writer flushes WAL. In case the last flush
2546+
Specifies how often the WAL writer flushes WAL. If the last flush
25432547
happened less than <varname>wal_writer_delay</> milliseconds ago and
25442548
less than <varname>wal_writer_flush_after</> bytes of WAL have been
2545-
produced since, WAL is only written to the OS, not flushed to disk.
2546-
If <varname>wal_writer_flush_after</> is set to <literal>0</> WAL is
2547-
flushed every time the WAL writer has written WAL. The default is
2549+
produced since, then WAL is only written to the operating system, not
2550+
flushed to disk. If <varname>wal_writer_flush_after</> is set
2551+
to <literal>0</> then WAL data is flushed immediately. The default is
25482552
<literal>1MB</literal>. This parameter can only be set in the
25492553
<filename>postgresql.conf</> file or on the server command line.
25502554
</para>
@@ -2664,10 +2668,10 @@ include_dir 'conf.d'
26642668
that are bigger than <xref linkend="guc-shared-buffers">, but smaller
26652669
than the OS's page cache, where performance might degrade. This
26662670
setting may have no effect on some platforms. The valid range is
2667-
between <literal>0</literal>, which disables controlled writeback,
2671+
between <literal>0</literal>, which disables forced writeback,
26682672
and <literal>2MB</literal>. The default is <literal>256kB</> on
2669-
Linux, <literal>0</> elsewhere. (Non-default values of
2670-
<symbol>BLCKSZ</symbol> change the default and maximum.)
2673+
Linux, <literal>0</> elsewhere. (If <symbol>BLCKSZ</symbol> is not
2674+
8kB, the default and maximum values scale proportionally to it.)
26712675
This parameter can only be set in the <filename>postgresql.conf</>
26722676
file or on the server command line.
26732677
</para>

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2756,7 +2756,7 @@ XLogFlush(XLogRecPtr record)
27562756
* This routine is invoked periodically by the background walwriter process.
27572757
*
27582758
* Returns TRUE if there was any work to do, even if we skipped flushing due
2759-
* to wal_writer_delay/wal_flush_after.
2759+
* to wal_writer_delay/wal_writer_flush_after.
27602760
*/
27612761
bool
27622762
XLogBackgroundFlush(void)

src/backend/catalog/dependency.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -594,29 +594,43 @@ findDependentObjects(const ObjectAddress *object,
594594
case DEPENDENCY_AUTO_EXTENSION:
595595
/* no problem */
596596
break;
597-
case DEPENDENCY_INTERNAL:
597+
598598
case DEPENDENCY_EXTENSION:
599599

600+
/*
601+
* If the other object is the extension currently being
602+
* created/altered, ignore this dependency and continue with
603+
* the deletion. This allows dropping of an extension's
604+
* objects within the extension's scripts, as well as corner
605+
* cases such as dropping a transient object created within
606+
* such a script.
607+
*/
608+
if (creating_extension &&
609+
otherObject.classId == ExtensionRelationId &&
610+
otherObject.objectId == CurrentExtensionObject)
611+
break;
612+
613+
/* Otherwise, treat this like an internal dependency */
614+
/* FALL THRU */
615+
616+
case DEPENDENCY_INTERNAL:
617+
600618
/*
601619
* This object is part of the internal implementation of
602620
* another object, or is part of the extension that is the
603621
* other object. We have three cases:
604622
*
605-
* 1. At the outermost recursion level, we normally disallow
606-
* the DROP. (We just ereport here, rather than proceeding,
607-
* since no other dependencies are likely to be interesting.)
608-
* However, there are exceptions.
623+
* 1. At the outermost recursion level, disallow the DROP. (We
624+
* just ereport here, rather than proceeding, since no other
625+
* dependencies are likely to be interesting.) However, if
626+
* the owning object is listed in pendingObjects, just release
627+
* the caller's lock and return; we'll eventually complete the
628+
* DROP when we reach that entry in the pending list.
609629
*/
610630
if (stack == NULL)
611631
{
612632
char *otherObjDesc;
613633

614-
/*
615-
* Exception 1a: if the owning object is listed in
616-
* pendingObjects, just release the caller's lock and
617-
* return. We'll eventually complete the DROP when we
618-
* reach that entry in the pending list.
619-
*/
620634
if (pendingObjects &&
621635
object_address_present(&otherObject, pendingObjects))
622636
{
@@ -625,21 +639,6 @@ findDependentObjects(const ObjectAddress *object,
625639
ReleaseDeletionLock(object);
626640
return;
627641
}
628-
629-
/*
630-
* Exception 1b: if the owning object is the extension
631-
* currently being created/altered, it's okay to continue
632-
* with the deletion. This allows dropping of an
633-
* extension's objects within the extension's scripts, as
634-
* well as corner cases such as dropping a transient
635-
* object created within such a script.
636-
*/
637-
if (creating_extension &&
638-
otherObject.classId == ExtensionRelationId &&
639-
otherObject.objectId == CurrentExtensionObject)
640-
break;
641-
642-
/* No exception applies, so throw the error */
643642
otherObjDesc = getObjectDescription(&otherObject);
644643
ereport(ERROR,
645644
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),

src/backend/commands/tablecmds.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,6 +7719,24 @@ ATExecDropConstraint(Relation rel, const char *constrName,
77197719

77207720
is_no_inherit_constraint = con->connoinherit;
77217721

7722+
/*
7723+
* If it's a foreign-key constraint, we'd better lock the referenced
7724+
* table and check that that's not in use, just as we've already done
7725+
* for the constrained table (else we might, eg, be dropping a trigger
7726+
* that has unfired events). But we can/must skip that in the
7727+
* self-referential case.
7728+
*/
7729+
if (con->contype == CONSTRAINT_FOREIGN &&
7730+
con->confrelid != RelationGetRelid(rel))
7731+
{
7732+
Relation frel;
7733+
7734+
/* Must match lock taken by RemoveTriggerById: */
7735+
frel = heap_open(con->confrelid, AccessExclusiveLock);
7736+
CheckTableNotInUse(frel, "ALTER TABLE");
7737+
heap_close(frel, NoLock);
7738+
}
7739+
77227740
/*
77237741
* Perform the actual constraint deletion
77247742
*/

src/backend/executor/execParallel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ ExecParallelFinish(ParallelExecutorInfo *pei)
563563
}
564564

565565
/*
566-
* Clean up whatever ParallelExecutreInfo resources still exist after
566+
* Clean up whatever ParallelExecutorInfo resources still exist after
567567
* ExecParallelFinish. We separate these routines because someone might
568568
* want to examine the contents of the DSM after ExecParallelFinish and
569569
* before calling this routine.

src/backend/optimizer/plan/planner.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,9 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
326326
* Optionally add a Gather node for testing purposes, provided this is
327327
* actually a safe thing to do. (Note: we assume adding a Material node
328328
* above did not change the parallel safety of the plan, so we can still
329-
* rely on best_path->parallel_safe. However, that flag doesn't account
330-
* for subplans, which we are unable to transmit to workers presently.)
329+
* rely on best_path->parallel_safe.)
331330
*/
332-
if (force_parallel_mode != FORCE_PARALLEL_OFF &&
333-
best_path->parallel_safe &&
334-
glob->subplans == NIL)
331+
if (force_parallel_mode != FORCE_PARALLEL_OFF && best_path->parallel_safe)
335332
{
336333
Gather *gather = makeNode(Gather);
337334

@@ -782,10 +779,10 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
782779
SS_identify_outer_params(root);
783780

784781
/*
785-
* If any initPlans were created in this query level, increment the
786-
* surviving Paths' costs to account for them. They won't actually get
787-
* attached to the plan tree till create_plan() runs, but we want to be
788-
* sure their costs are included now.
782+
* If any initPlans were created in this query level, adjust the surviving
783+
* Paths' costs and parallel-safety flags to account for them. The
784+
* initPlans won't actually get attached to the plan tree till
785+
* create_plan() runs, but we must include their effects now.
789786
*/
790787
final_rel = fetch_upper_rel(root, UPPERREL_FINAL, NULL);
791788
SS_charge_for_initplans(root, final_rel);

src/backend/optimizer/plan/subselect.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,11 +2134,13 @@ SS_identify_outer_params(PlannerInfo *root)
21342134
}
21352135

21362136
/*
2137-
* SS_charge_for_initplans - account for cost of initplans in Path costs
2137+
* SS_charge_for_initplans - account for initplans in Path costs & parallelism
21382138
*
21392139
* If any initPlans have been created in the current query level, they will
21402140
* get attached to the Plan tree created from whichever Path we select from
2141-
* the given rel; so increment all the rel's Paths' costs to account for them.
2141+
* the given rel. Increment all that rel's Paths' costs to account for them,
2142+
* and make sure the paths get marked as parallel-unsafe, since we can't
2143+
* currently transmit initPlans to parallel workers.
21422144
*
21432145
* This is separate from SS_attach_initplans because we might conditionally
21442146
* create more initPlans during create_plan(), depending on which Path we
@@ -2170,14 +2172,15 @@ SS_charge_for_initplans(PlannerInfo *root, RelOptInfo *final_rel)
21702172
}
21712173

21722174
/*
2173-
* Now adjust the costs.
2175+
* Now adjust the costs and parallel_safe flags.
21742176
*/
21752177
foreach(lc, final_rel->pathlist)
21762178
{
21772179
Path *path = (Path *) lfirst(lc);
21782180

21792181
path->startup_cost += initplan_cost;
21802182
path->total_cost += initplan_cost;
2183+
path->parallel_safe = false;
21812184
}
21822185

21832186
/* We needn't do set_cheapest() here, caller will do it */

src/backend/utils/misc/guc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,6 @@ static struct config_int ConfigureNamesInt[] =
22862286
GUC_UNIT_BLOCKS
22872287
},
22882288
&checkpoint_flush_after,
2289-
/* see bufmgr.h: OS dependent default */
22902289
DEFAULT_CHECKPOINT_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES,
22912290
NULL, NULL, NULL
22922291
},
@@ -2315,12 +2314,12 @@ static struct config_int ConfigureNamesInt[] =
23152314

23162315
{
23172316
{"wal_writer_flush_after", PGC_SIGHUP, WAL_SETTINGS,
2318-
gettext_noop("Amount of WAL written out by WAL writer triggering a flush."),
2317+
gettext_noop("Amount of WAL written out by WAL writer that triggers a flush."),
23192318
NULL,
23202319
GUC_UNIT_XBLOCKS
23212320
},
23222321
&WalWriterFlushAfter,
2323-
128, 0, INT_MAX,
2322+
(1024*1024) / XLOG_BLCKSZ, 0, INT_MAX,
23242323
NULL, NULL, NULL
23252324
},
23262325

@@ -2444,7 +2443,6 @@ static struct config_int ConfigureNamesInt[] =
24442443
GUC_UNIT_BLOCKS
24452444
},
24462445
&bgwriter_flush_after,
2447-
/* see bufmgr.h: OS dependent default */
24482446
DEFAULT_BGWRITER_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES,
24492447
NULL, NULL, NULL
24502448
},
@@ -2472,7 +2470,7 @@ static struct config_int ConfigureNamesInt[] =
24722470
GUC_UNIT_BLOCKS
24732471
},
24742472
&backend_flush_after,
2475-
0, 0, WRITEBACK_MAX_PENDING_FLUSHES,
2473+
DEFAULT_BACKEND_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES,
24762474
NULL, NULL, NULL
24772475
},
24782476

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,16 @@ listen_addresses = '*' # what IP address(es) to listen on;
156156
#bgwriter_delay = 200ms # 10-10000ms between rounds
157157
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
158158
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round
159-
#bgwriter_flush_after = 0 # 0 disables,
160-
# default is 512kB on linux, 0 otherwise
159+
#bgwriter_flush_after = 0 # measured in pages, 0 disables
161160

162161
# - Asynchronous Behavior -
163162

164163
#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
165164
#max_worker_processes = 8 # (change requires restart)
166165
#max_parallel_workers_per_gather = 0 # taken from max_worker_processes
167166
#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate
168-
# (change requires restart)
169-
#backend_flush_after = 0 # 0 disables, default is 0
167+
# (change requires restart)
168+
#backend_flush_after = 0 # measured in pages, 0 disables
170169

171170

172171
#------------------------------------------------------------------------------
@@ -196,7 +195,7 @@ listen_addresses = '*' # what IP address(es) to listen on;
196195
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
197196
# (change requires restart)
198197
#wal_writer_delay = 200ms # 1-10000 milliseconds
199-
#wal_writer_flush_after = 1MB # 0 disables
198+
#wal_writer_flush_after = 1MB # measured in pages, 0 disables
200199

201200
#commit_delay = 0 # range 0-100000, in microseconds
202201
#commit_siblings = 5 # range 1-1000
@@ -207,8 +206,7 @@ listen_addresses = '*' # what IP address(es) to listen on;
207206
#max_wal_size = 1GB
208207
#min_wal_size = 80MB
209208
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
210-
#checkpoint_flush_after = 0 # 0 disables,
211-
# default is 256kB on linux, 0 otherwise
209+
#checkpoint_flush_after = 0 # measured in pages, 0 disables
212210
#checkpoint_warning = 30s # 0 disables
213211

214212
# - Archiving -

src/bin/initdb/initdb.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,27 @@ setup_config(void)
12871287
conflines = replace_token(conflines, "#dynamic_shared_memory_type = posix",
12881288
repltok);
12891289

1290+
#if DEFAULT_BACKEND_FLUSH_AFTER > 0
1291+
snprintf(repltok, sizeof(repltok), "#backend_flush_after = %dkB",
1292+
DEFAULT_BACKEND_FLUSH_AFTER * (BLCKSZ / 1024));
1293+
conflines = replace_token(conflines, "#backend_flush_after = 0",
1294+
repltok);
1295+
#endif
1296+
1297+
#if DEFAULT_BGWRITER_FLUSH_AFTER > 0
1298+
snprintf(repltok, sizeof(repltok), "#bgwriter_flush_after = %dkB",
1299+
DEFAULT_BGWRITER_FLUSH_AFTER * (BLCKSZ / 1024));
1300+
conflines = replace_token(conflines, "#bgwriter_flush_after = 0",
1301+
repltok);
1302+
#endif
1303+
1304+
#if DEFAULT_CHECKPOINT_FLUSH_AFTER > 0
1305+
snprintf(repltok, sizeof(repltok), "#checkpoint_flush_after = %dkB",
1306+
DEFAULT_CHECKPOINT_FLUSH_AFTER * (BLCKSZ / 1024));
1307+
conflines = replace_token(conflines, "#checkpoint_flush_after = 0",
1308+
repltok);
1309+
#endif
1310+
12901311
#ifndef USE_PREFETCH
12911312
conflines = replace_token(conflines,
12921313
"#effective_io_concurrency = 1",

0 commit comments

Comments
 (0)