Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit002d7b5

Browse files
authored
[PGPRO-5378] fix various tests (#420)
* [PGPRO-5378] tests.replica.ReplicaTest.test_replica_archive_page_backup stabilization* Skip some tests on PG-9.5 (test_replica_switchover, test_replica_promote_archive_delta, test_replica_promote_archive_page, test_parent_choosing)* travis: Fix compatibility issues with GDB
1 parent384cf6d commit002d7b5

File tree

5 files changed

+70
-5
lines changed

5 files changed

+70
-5
lines changed

‎tests/replica.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ def test_replica_switchover(self):
2121
over the course of several switchovers
2222
https://www.postgresql.org/message-id/54b059d4-2b48-13a4-6f43-95a087c92367%40postgrespro.ru
2323
"""
24-
2524
fname=self.id().split('.')[3]
2625
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
2726
node1=self.make_simple_node(
2827
base_dir=os.path.join(module_name,fname,'node1'),
2928
set_replication=True,
3029
initdb_params=['--data-checksums'])
3130

31+
ifself.get_version(node1)<self.version_to_num('9.6.0'):
32+
self.del_test_dir(module_name,fname)
33+
returnunittest.skip(
34+
'Skipped because backup from replica is not supported in PG 9.5')
35+
3236
self.init_pb(backup_dir)
3337
self.add_instance(backup_dir,'node1',node1)
3438

@@ -287,6 +291,16 @@ def test_replica_archive_page_backup(self):
287291

288292
self.wait_until_replica_catch_with_master(master,replica)
289293

294+
master.pgbench_init(scale=5)
295+
# Continuous making some changes on master,
296+
# because WAL archiving on replica in idle DB in PostgreSQL is broken:
297+
# replica will not archive the previous WAL until it receives new records in the next WAL file,
298+
# this "lazy" archiving can be seen in src/backend/replication/walreceiver.c:XLogWalRcvWrite()
299+
# (see !XLByteInSeg checking and XLogArchiveNotify() calling).
300+
pgbench=master.pgbench(
301+
stdout=subprocess.PIPE,stderr=subprocess.STDOUT,
302+
options=['-T','3','-c','1','--no-vacuum'])
303+
290304
backup_id=self.backup_node(
291305
backup_dir,'replica',replica,
292306
options=[
@@ -295,6 +309,9 @@ def test_replica_archive_page_backup(self):
295309
'--master-db=postgres',
296310
'--master-port={0}'.format(master.port)])
297311

312+
pgbench.wait()
313+
pgbench.stdout.close()
314+
298315
self.validate_pb(backup_dir,'replica')
299316
self.assertEqual(
300317
'OK',self.show_pb(backup_dir,'replica',backup_id)['status'])
@@ -317,8 +334,6 @@ def test_replica_archive_page_backup(self):
317334
# Change data on master, make PAGE backup from replica,
318335
# restore taken backup and check that restored data equal
319336
# to original data
320-
master.pgbench_init(scale=5)
321-
322337
pgbench=master.pgbench(
323338
options=['-T','30','-c','2','--no-vacuum'])
324339

@@ -535,6 +550,11 @@ def test_replica_promote(self):
535550
start backup from replica, during backup promote replica
536551
check that backup is failed
537552
"""
553+
ifnotself.gdb:
554+
self.skipTest(
555+
"Specify PGPROBACKUP_GDB and build without "
556+
"optimizations for run this test"
557+
)
538558
fname=self.id().split('.')[3]
539559
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
540560
master=self.make_simple_node(
@@ -706,6 +726,7 @@ def test_replica_stop_lsn_null_offset(self):
706726
output)
707727

708728
# Clean after yourself
729+
gdb_checkpointer.kill()
709730
self.del_test_dir(module_name,fname)
710731

711732
# @unittest.skip("skip")
@@ -1085,6 +1106,7 @@ def test_replica_toast(self):
10851106
self.compare_pgdata(pgdata,pgdata_restored)
10861107

10871108
# Clean after yourself
1109+
gdb_checkpointer.kill()
10881110
self.del_test_dir(module_name,fname)
10891111

10901112
# @unittest.skip("skip")
@@ -1313,6 +1335,11 @@ def test_replica_promote_archive_delta(self):
13131335
'checkpoint_timeout':'30s',
13141336
'archive_timeout':'30s'})
13151337

1338+
ifself.get_version(node1)<self.version_to_num('9.6.0'):
1339+
self.del_test_dir(module_name,fname)
1340+
returnunittest.skip(
1341+
'Skipped because backup from replica is not supported in PG 9.5')
1342+
13161343
self.init_pb(backup_dir)
13171344
self.add_instance(backup_dir,'node',node1)
13181345
self.set_config(
@@ -1433,6 +1460,11 @@ def test_replica_promote_archive_page(self):
14331460
'checkpoint_timeout':'30s',
14341461
'archive_timeout':'30s'})
14351462

1463+
ifself.get_version(node1)<self.version_to_num('9.6.0'):
1464+
self.del_test_dir(module_name,fname)
1465+
returnunittest.skip(
1466+
'Skipped because backup from replica is not supported in PG 9.5')
1467+
14361468
self.init_pb(backup_dir)
14371469
self.add_instance(backup_dir,'node',node1)
14381470
self.set_archiving(backup_dir,'node',node1)
@@ -1550,6 +1582,11 @@ def test_parent_choosing(self):
15501582
set_replication=True,
15511583
initdb_params=['--data-checksums'])
15521584

1585+
ifself.get_version(master)<self.version_to_num('9.6.0'):
1586+
self.del_test_dir(module_name,fname)
1587+
returnunittest.skip(
1588+
'Skipped because backup from replica is not supported in PG 9.5')
1589+
15531590
self.init_pb(backup_dir)
15541591
self.add_instance(backup_dir,'master',master)
15551592

‎travis/Dockerfile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN python3 -m pip install virtualenv
1010

1111
# Environment
1212
ENV PG_MAJOR=${PG_VERSION} PG_BRANCH=${PG_BRANCH}
13+
ENV PGPROBACKUP_GDB=${PGPROBACKUP_GDB}
1314
ENV LANG=C.UTF-8 PGHOME=/pg/testdir/pgbin
1415

1516
# Make directories

‎travis/docker-compose.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
1-
tests:
2-
build:.
1+
version:"3.7"
2+
services:
3+
tests:
4+
build:
5+
context:.
6+
7+
cap_add:
8+
-SYS_PTRACE
9+
10+
security_opt:
11+
-seccomp=unconfined
12+
13+
# don't work
14+
#sysctls:
15+
# kernel.yama.ptrace_scope: 0
16+
privileged:true
17+

‎travis/make_dockerfile.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ if [ -z ${MODE+x} ]; then
1414
MODE=basic
1515
fi
1616

17+
if [-z${PGPROBACKUP_GDB+x} ];then
18+
PGPROBACKUP_GDB=ON
19+
fi
20+
1721
echo PG_VERSION=${PG_VERSION}
1822
echo PG_BRANCH=${PG_BRANCH}
1923
echo MODE=${MODE}
24+
echo PGPROBACKUP_GDB=${PGPROBACKUP_GDB}
2025

2126
sed \
2227
-e's/${PG_VERSION}/'${PG_VERSION}/g \
2328
-e's/${PG_BRANCH}/'${PG_BRANCH}/g \
2429
-e's/${MODE}/'${MODE}/g \
30+
-e's/${PGPROBACKUP_GDB}/'${PGPROBACKUP_GDB}/g \
2531
Dockerfile.in> Dockerfile

‎travis/run_tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ which pg_config
6565
echo"############### pg_config:"
6666
pg_config
6767

68+
# Show kernel parameters
69+
echo"############### kernel params:"
70+
cat /proc/sys/kernel/yama/ptrace_scope
71+
sudo sysctl kernel.yama.ptrace_scope=0
72+
cat /proc/sys/kernel/yama/ptrace_scope
73+
6874
# Build and install pg_probackup (using PG_CPPFLAGS and SHLIB_LINK for gcov)
6975
echo"############### Compiling and installing pg_probackup:"
7076
# make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" top_srcdir=$CUSTOM_PG_SRC install

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp