Skip to content

Commit 8581033

Browse files
committed
Merge branch 'PGPROEE9_6' into PGPROEE9_6_MULTIMASTER
2 parents 8321c58 + 573beb1 commit 8581033

File tree

13 files changed

+1815
-15
lines changed

13 files changed

+1815
-15
lines changed

.ci/build_and_test_world

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ set -e
3535
stage configure
3636
./configure --enable-tap-tests --enable-debug --enable-cassert --enable-nls \
3737
--with-openssl --with-perl --with-tcl --with-python \
38-
--with-gssapi --with-libxml --with-libxslt --with-ldap \
38+
--with-gssapi --with-includes=/usr/include/gssglue \
39+
--with-libxml --with-libxslt --with-ldap \
3940
--with-icu --with-zstd ${TCLCONFIG:+--with-tclconfig=${TCLCONFIG}}
4041
stage make
4142
make

.ci/run_install_check

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ make install prefix=`pwd`/tmp_install -C contrib
2222

2323
# Setup an environment
2424
LD_LIBRARY_PATH=$(pwd)/tmp_install/lib
25+
DYLD_LIBRARY_PATH=$(pwd)/tmp_install/lib
2526
PATH=$(pwd)/tmp_install/bin:${PATH}
2627
PGDATA=$(pwd)/tmp_base
27-
export LD_LIBRARY_PATH PATH PG_DATA
28+
export DYLD_LIBRARY_PATH LD_LIBRARY_PATH PATH PG_DATA
2829

2930
# create installation
3031
PGPORT=`./.ci/find_free_port 5432`

contrib/aqo/aqo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
*/
109109
#ifndef __ML_CARD_H__
110110
#define __ML_CARD_H__
111-
111+
#include <math.h>
112112
#include "postgres.h"
113113

114114
#include "fmgr.h"

contrib/aqo/hash.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ get_fss_for_object(List *clauselist, List *selectivities, List *relidslist,
118118
i = 0;
119119
foreach(l, selectivities)
120120
{
121-
(*features)[inverse_idx[i]] = fmax(log_selectivity_lower_bound,
122-
log(*((double *) (lfirst(l)))));
121+
(*features)[inverse_idx[i]] = log(*((double *) (lfirst(l))));
122+
if ((*features)[inverse_idx[i]] < log_selectivity_lower_bound)
123+
(*features)[inverse_idx[i]] = log_selectivity_lower_bound;
123124
sorted_clauses[inverse_idx[i]] = clause_hashes[i];
124125
i++;
125126
}

contrib/aqo/preprocessing.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,21 @@ aqo_planner(Query *parse,
163163
aqo_mode);
164164
break;
165165
}
166+
if (RecoveryInProgress())
167+
{
168+
if (aqo_mode == AQO_MODE_FORCED)
169+
{
170+
adding_query = false;
171+
learn_aqo = false;
172+
auto_tuning = false;
173+
collect_stat = false;
174+
}
175+
else
176+
{
177+
disable_aqo_for_query();
178+
return call_default_planner(parse, cursorOptions, boundParams);
179+
}
180+
}
166181
if (adding_query)
167182
{
168183
add_query(query_hash, learn_aqo, use_aqo, fspace_hash, auto_tuning);
@@ -177,8 +192,14 @@ aqo_planner(Query *parse,
177192
fspace_hash = DatumGetInt32(query_params[3]);
178193
auto_tuning = DatumGetBool(query_params[4]);
179194
collect_stat = learn_aqo || use_aqo || auto_tuning;
180-
if (!collect_stat)
195+
if (!learn_aqo && !use_aqo && !auto_tuning)
181196
add_deactivated_query(query_hash);
197+
if (RecoveryInProgress())
198+
{
199+
learn_aqo = false;
200+
auto_tuning = false;
201+
collect_stat = false;
202+
}
182203
}
183204
explain_aqo = use_aqo;
184205

contrib/rum/src/btree_rum.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@
1414

1515
#include "rum.h"
1616

17+
#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
18+
#include <float.h>
19+
#define isfinite _finite
20+
#elif defined(__sun) && defined(__SVR4) //Solaris
21+
#if !defined(isfinite)
22+
#include <ieeefp.h>
23+
#define isfinite finite
24+
#endif
25+
#elif defined(_AIX) // AIX
26+
#if !defined(isfinite)
27+
#include <math.h>
28+
#define isfinite finite
29+
#endif
30+
#elif defined(__hpux) // HPUX
31+
#if !defined(isfinite)
32+
#if defined(__ia64) && !defined(finite)
33+
#define isfinite(x) ((sizeof(x) == sizeof(float) ? _Isfinitef(x) : _IsFinite(x)))
34+
#else
35+
#include <math.h>
36+
#define isfinite finite
37+
#endif
38+
#endif
39+
#endif
40+
1741
typedef struct QueryInfo
1842
{
1943
StrategyNumber strategy;

doc/src/sgml/aqo.sgml

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ DROP EXTENSION aqo;
8383
<listitem>
8484
<para>
8585
<literal>forced</literal> &mdash;
86-
this mode tries to optimize all queries together, regardless of
86+
this mode tries to optimize all new queries together, regardless of
8787
the query type.
8888
</para>
8989
</listitem>
@@ -148,11 +148,8 @@ where <replaceable>mode</> is the name of the optimization mode to use.
148148
mode. However, since the <literal>forced</literal> mode lacks
149149
intelligent tuning, performance may decrease for some queries.
150150
If you see performance issues in this mode, switch <filename>aqo</filename> to the
151-
<literal>controlled</literal> mode:
151+
<literal>controlled</literal> mode.
152152
</para>
153-
<programlisting>
154-
SET aqo.mode = 'controlled';
155-
</programlisting>
156153
<para>
157154
In the <literal>controlled</literal> mode, <filename>aqo</filename> does not collect statistics for new
158155
query types, so they will not be optimized. For known query
@@ -298,6 +295,57 @@ UPDATE aqo_queries SET learn_aqo=false WHERE query_hash = '<replaceable>hash</>'
298295
UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;
299296
</programlisting>
300297
</sect3>
298+
<sect3 id="using-aqo-on-standby">
299+
<title>Using aqo on Standby</title>
300+
<para>
301+
In master-standby configurations, <filename>aqo</filename>
302+
statistics on standby is inherited from master in read-only mode.
303+
Standby queries do not update <filename>aqo</filename> statistics,
304+
regardless of the current <filename>aqo</filename> settings.
305+
If you would like to update the statistics on
306+
standby for one or more query types, you must run these queries
307+
on master and synchronize the standby.
308+
</para>
309+
<para>
310+
You can define whether to use <filename>aqo</filename> statistics
311+
for standby queries independent of the master configuration,
312+
toggling <filename>aqo</filename> modes as required. By default,
313+
<filename>aqo</filename> optimizes queries on standby as follows:
314+
<itemizedlist>
315+
<listitem>
316+
<para>
317+
In <literal>intelligent</> and <literal>controlled</> modes,
318+
<filename>aqo</filename> statistics is only used for the
319+
alreadyknown query types.
320+
</para>
321+
</listitem>
322+
<listitem>
323+
<para>
324+
In the <literal>forced</> mode,
325+
<filename>aqo</filename> tries to optimize the unknown
326+
queries based on the common statistics collected in the
327+
<literal>forced</> mode on master, if any. If the common
328+
statistics is not found, <filename>aqo</filename> falls back
329+
to the default query planner. All the known query types continue using
330+
the available statistics.
331+
</para>
332+
</listitem>
333+
<listitem>
334+
<para>
335+
The <literal>disabled</literal> mode switches off the collected
336+
statistics completely, relying on the default query planner
337+
for all queries.
338+
</para>
339+
</listitem>
340+
</itemizedlist>
341+
</para>
342+
<para>
343+
If you fine-tuned optimization settings for specific query types
344+
on master, these settings override the default <filename>aqo</filename>
345+
behavior, unless you choose the <literal>disabled</literal> mode.
346+
For details, see <xref linkend="aqo-advanced-query-tuning">.
347+
</para>
348+
</sect3>
301349
</sect2>
302350
<sect2 id="aqo-reference">
303351
<title>Reference</title>

doc/src/sgml/contrib.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
134134
&online-analyze;
135135
&pageinspect;
136136
&passwordcheck;
137+
&pgaudit;
137138
&pgbuffercache;
138139
&pgcrypto;
139140
&pgfreespacemap;

doc/src/sgml/filelist.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<!ENTITY pageinspect SYSTEM "pageinspect.sgml">
145145
<!ENTITY passwordcheck SYSTEM "passwordcheck.sgml">
146146
<!ENTITY pgprobackup SYSTEM "pgprobackup.sgml">
147+
<!ENTITY pgaudit SYSTEM "pgaudit.sgml">
147148
<!ENTITY pgbuffercache SYSTEM "pgbuffercache.sgml">
148149
<!ENTITY pgcrypto SYSTEM "pgcrypto.sgml">
149150
<!ENTITY pgfreespacemap SYSTEM "pgfreespacemap.sgml">

doc/src/sgml/func.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17200,8 +17200,7 @@ SELECT collation for ('foo' COLLATE "de_DE");
1720017200
<para>
1720117201
In <productname>&productname;</productname>, transaction IDs
1720217202
are implemented as 64-bit counters to prevent transaction ID wraparound.
17203-
The following functions
17204-
export a 64-bit format that is extended with an <quote>epoch</> counter
17203+
The following functions export a 64-bit format,
1720517204
so it will not wrap around during the life of an installation.
1720617205
The data type used by these functions, <type>txid_snapshot</type>,
1720717206
stores information about transaction ID

0 commit comments

Comments
 (0)