Skip to content

Commit dd060e9

Browse files
committed
Merge branch 'PGPROEE9_6' into PGPROEE9_6_RUSDOC
2 parents 1085d88 + e4e1784 commit dd060e9

File tree

150 files changed

+8061
-3451
lines changed

Some content is hidden

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

150 files changed

+8061
-3451
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/make_test_base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def prepare_extlist(value):
1919
if "pg_pathman" in l:
2020
# remove duplicates and reorder extension list to move pg_pathman to tail
2121
nl = sorted(list(set(l)), cmp = lambda a,b: 1 if a=="pg_pathman" else -1)
22-
new_value = "'{}'".format(",".join(nl))
22+
new_value = "'{0}'".format(",".join(nl))
2323
return new_value
2424
else:
2525
return value

.ci/run

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ if [ "`id -un`" = "root" ]; then
1717
else
1818
groupadd ci
1919
useradd -g ci ci
20-
chown -R ci:ci .
20+
# chown -R ci:ci .
21+
find . -type d -exec chown ci:ci {} +
2122
fi
2223
su ci -c ./.ci/build_and_test_world
2324
else

.ci/run.cmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
@echo off
22
PATH=C:\Windows\system32;C:\Perl64\bin;C:\Program Files\Git\cmd;C:\msys64\usr\bin
33

4+
REM Copy source-repo to CI temporary catalog
5+
cp -r postgrespro/* .
6+
47
IF "%ARCH%"=="" SET ARCH=X86
58
IF "%ARCH%"=="x86" SET ARCH=X86
69
IF "%ARCH%"=="x64" SET ARCH=X64
710
IF "%ARCH%"=="amd64" SET ARCH=X64
11+
IF "%ARCH%"=="AMD64" SET ARCH=X64
812
IF "%SDK%"=="" SET SDK=SDK71
913

1014
echo BUILD_ID=%BUILD_ID%

.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`

configure

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,7 +2770,7 @@ else
27702770
fi
27712771

27722772

2773-
PGPRO_VERSION="$PACKAGE_VERSION.1"
2773+
PGPRO_VERSION="$PACKAGE_VERSION.2"
27742774
PGPRO_PACKAGE_NAME="PostgresPro"
27752775
PGPRO_EDITION="enterprise"
27762776

@@ -16078,24 +16078,6 @@ cat >>confdefs.h <<_ACEOF
1607816078
_ACEOF
1607916079

1608016080

16081-
16082-
if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
16083-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16084-
/* end confdefs.h. */
16085-
16086-
#define INT64CONST(x) x##LL
16087-
long long int foo = INT64CONST(0x1234567890123456);
16088-
16089-
_ACEOF
16090-
if ac_fn_c_try_compile "$LINENO"; then :
16091-
16092-
$as_echo "#define HAVE_LL_CONSTANTS 1" >>confdefs.h
16093-
16094-
fi
16095-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16096-
fi
16097-
16098-
1609916081
# If we found "long int" is 64 bits, assume snprintf handles it. If
1610016082
# we found we need to use "long long int", better check. We cope with
1610116083
# snprintfs that use %lld, %qd, or %I64d as the format. If none of these

configure.in

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major versio
3838
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
3939
[PG_VERSION="$PACKAGE_VERSION$withval"],
4040
[PG_VERSION="$PACKAGE_VERSION"])
41-
PGPRO_VERSION="$PACKAGE_VERSION.1"
41+
PGPRO_VERSION="$PACKAGE_VERSION.2"
4242
PGPRO_PACKAGE_NAME="PostgresPro"
4343
PGPRO_EDITION="enterprise"
4444
AC_SUBST(PGPRO_PACKAGE_NAME)
@@ -1877,18 +1877,6 @@ fi
18771877
AC_DEFINE_UNQUOTED(PG_INT64_TYPE, $pg_int64_type,
18781878
[Define to the name of a signed 64-bit integer type.])
18791879

1880-
dnl If we need to use "long long int", figure out whether nnnLL notation works.
1881-
1882-
if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
1883-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1884-
#define INT64CONST(x) x##LL
1885-
long long int foo = INT64CONST(0x1234567890123456);
1886-
])],
1887-
[AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
1888-
[])
1889-
fi
1890-
1891-
18921880
# If we found "long int" is 64 bits, assume snprintf handles it. If
18931881
# we found we need to use "long long int", better check. We cope with
18941882
# snprintfs that use %lld, %qd, or %I64d as the format. If none of these

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/mmts/Cluster.pm

Lines changed: 97 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ sub start
149149
foreach my $node (@$nodes)
150150
{
151151
$node->start();
152-
diag "Starting node with connstr 'dbname=postgres port=@{[ $node->port() ]} host=@{[ $node->host() ]}'";
152+
note( "Starting node with connstr 'dbname=postgres port=@{[ $node->port() ]} host=@{[ $node->host() ]}'");
153153
}
154154
}
155155

@@ -159,7 +159,7 @@ sub stopnode
159159
return 1 unless defined $node->{_pid};
160160
$mode = 'fast' unless defined $mode;
161161
my $name = $node->name;
162-
diag("stopping $name ${mode}ly");
162+
note("stopping $name ${mode}ly");
163163

164164
if ($mode eq 'kill') {
165165
killtree($node->{_pid});
@@ -169,13 +169,13 @@ sub stopnode
169169
my $pgdata = $node->data_dir;
170170
my $ret = TestLib::system_log('pg_ctl', '-D', $pgdata, '-m', 'fast', 'stop');
171171
my $pidfile = $node->data_dir . "/postmaster.pid";
172-
diag("unlink $pidfile");
172+
note("unlink $pidfile");
173173
unlink $pidfile;
174174
$node->{_pid} = undef;
175175
$node->_update_pid;
176176

177177
if ($ret != 0) {
178-
diag("$name failed to stop ${mode}ly");
178+
note("$name failed to stop ${mode}ly");
179179
return 0;
180180
}
181181

@@ -193,16 +193,16 @@ sub dumplogs
193193
my ($self) = @_;
194194
my $nodes = $self->{nodes};
195195

196-
diag("Dumping logs:");
196+
note("Dumping logs:");
197197
foreach my $node (@$nodes) {
198-
diag("##################################################################");
199-
diag($node->{_logfile});
200-
diag("##################################################################");
198+
note("##################################################################");
199+
note($node->{_logfile});
200+
note("##################################################################");
201201
my $filename = $node->{_logfile};
202202
open my $fh, '<', $filename or die "error opening $filename: $!";
203203
my $data = do { local $/; <$fh> };
204-
diag($data);
205-
diag("##################################################################\n\n");
204+
note($data);
205+
note("##################################################################\n\n");
206206
}
207207
}
208208

@@ -213,7 +213,7 @@ sub stop
213213
$mode = 'fast' unless defined $mode;
214214

215215
my $ok = 1;
216-
diag("stopping cluster ${mode}ly");
216+
note("stopping cluster ${mode}ly");
217217

218218
foreach my $node (@$nodes) {
219219
if (!stopnode($node, $mode)) {
@@ -268,7 +268,7 @@ sub poll
268268
return 1;
269269
}
270270
my $tries_left = $tries - $i - 1;
271-
diag("$poller poll for $pollee failed [$tries_left tries left]");
271+
note("$poller poll for $pollee failed [$tries_left tries left]");
272272
sleep($delay);
273273
}
274274
return 0;
@@ -296,7 +296,7 @@ sub pgbench_async()
296296
-p => $self->{nodes}->[$node]->port(),
297297
'postgres',
298298
);
299-
# diag("running pgbench init");
299+
note("running pgbench: " . join(" ", @pgbench_command));
300300
my $handle = IPC::Run::start(\@pgbench_command, $in, $out);
301301
return $handle;
302302
}
@@ -307,4 +307,88 @@ sub pgbench_await()
307307
IPC::Run::finish($pgbench_handle) || BAIL_OUT("pgbench exited with $?");
308308
}
309309

310+
sub is_data_identic()
311+
{
312+
my ($self, @nodenums) = @_;
313+
my $checksum = '';
314+
315+
my $sql = "select md5('(' || string_agg(aid::text || ', ' || abalance::text , '),(') || ')')
316+
from (select * from pgbench_accounts order by aid) t;";
317+
318+
foreach my $i (@nodenums)
319+
{
320+
my $current_hash = '';
321+
$self->{nodes}->[$i]->psql('postgres', $sql, stdout => \$current_hash);
322+
if ($current_hash eq '')
323+
{
324+
note("got empty hash from node $i");
325+
return 0;
326+
}
327+
if ($checksum eq '')
328+
{
329+
$checksum = $current_hash;
330+
}
331+
elsif ($checksum ne $current_hash)
332+
{
333+
note("got different hashes: $checksum ang $current_hash");
334+
return 0;
335+
}
336+
}
337+
338+
note($checksum);
339+
return 1;
340+
}
341+
342+
sub add_node()
343+
{
344+
my ($self, %params) = @_;
345+
346+
my $pgport;
347+
my $arbiter_port;
348+
my $connstrs;
349+
my $node_id;
350+
351+
if (defined $params{node_id})
352+
{
353+
$node_id = $params{node_id};
354+
$pgport = $params{port};
355+
$arbiter_port = $params{arbiter_port};
356+
$connstrs = $self->all_connstrs();
357+
}
358+
else
359+
{
360+
$node_id = scalar(@{$self->{nodes}}) + 1;
361+
$pgport = (allocate_ports('127.0.0.1', 1))[0];
362+
$arbiter_port = (allocate_ports('127.0.0.1', 1))[0];
363+
$connstrs = $self->all_connstrs() . ", dbname=postgres host=127.0.0.1 port=$pgport arbiter_port=$arbiter_port";
364+
}
365+
366+
my $node = PostgresNode->get_new_node("node${node_id}x");
367+
368+
$self->{nodes}->[0]->backup("backup_for_$node_id");
369+
# do init from backup before setting host, since init_from_backup() checks
370+
# it default value
371+
$node->init_from_backup($self->{nodes}->[0], "backup_for_$node_id");
372+
373+
$node->{_host} = '127.0.0.1';
374+
$node->{_port} = $pgport;
375+
$node->{port} = $pgport;
376+
$node->{host} = '127.0.0.1';
377+
$node->{arbiter_port} = $arbiter_port;
378+
$node->{mmconnstr} = "${ \$node->connstr('postgres') } arbiter_port=${ \$node->{arbiter_port} }";
379+
$node->append_conf("postgresql.conf", qq(
380+
multimaster.arbiter_port = $arbiter_port
381+
multimaster.conn_strings = '$connstrs'
382+
multimaster.node_id = $node_id
383+
port = $pgport
384+
));
385+
$node->append_conf("pg_hba.conf", qq(
386+
local replication all trust
387+
host replication all 127.0.0.1/32 trust
388+
host replication all ::1/128 trust
389+
));
390+
391+
push(@{$self->{nodes}}, $node);
392+
}
393+
310394
1;

contrib/mmts/t/000_truncate.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$cluster->init();
1414
$cluster->configure();
1515
$cluster->start();
16-
diag("sleeping 10");
16+
note("sleeping 10");
1717
sleep(10);
1818

1919
my ($in, $out, $err, $rc);
@@ -28,7 +28,7 @@
2828
-p => $cluster->{nodes}->[0]->port(),
2929
'postgres',
3030
);
31-
diag("running pgbench init");
31+
note("running pgbench init");
3232
my $init_run = start(\@init_argv, $in, $out);
3333
finish($init_run) || BAIL_OUT("pgbench exited with $?");
3434

@@ -41,7 +41,7 @@
4141
-p => $cluster->{nodes}->[0]->port(),
4242
'postgres',
4343
);
44-
diag("running pgbench: " . join(' ', @bench_argv));
44+
note("running pgbench: " . join(' ', @bench_argv));
4545
my $bench_run = start(\@bench_argv, $in, $out);
4646
sleep(2);
4747

0 commit comments

Comments
 (0)