testgres-pg-probackup2 0.0.3__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/PKG-INFO +11 -6
  2. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/app.py +26 -13
  3. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/gdb.py +4 -1
  4. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/init_helpers.py +11 -5
  5. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/setup.py +1 -1
  6. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/testgres_pg_probackup2.egg-info/PKG-INFO +12 -7
  7. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/README.md +0 -0
  8. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/__init__.py +0 -0
  9. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/storage/__init__.py +0 -0
  10. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/pg_probackup2/storage/fs_backup.py +0 -0
  11. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/setup.cfg +0 -0
  12. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/testgres_pg_probackup2.egg-info/SOURCES.txt +0 -0
  13. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/testgres_pg_probackup2.egg-info/dependency_links.txt +0 -0
  14. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/testgres_pg_probackup2.egg-info/requires.txt +0 -0
  15. {testgres_pg_probackup2-0.0.3 → testgres_pg_probackup2-0.0.5}/testgres_pg_probackup2.egg-info/top_level.txt +0 -0
@@ -1,14 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: testgres_pg_probackup2
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Plugin for testgres that manages pg_probackup2
5
5
  Home-page: https://github.com/postgrespro/testgres
6
6
  Author: Postgres Professional
7
7
  Author-email: testgres@postgrespro.ru
8
8
  License: PostgreSQL
9
9
  Keywords: pg_probackup,testing,testgres
10
- Platform: UNKNOWN
11
10
  Description-Content-Type: text/markdown
12
-
13
- UNKNOWN
14
-
11
+ Requires-Dist: testgres>=1.9.2
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description-content-type
15
+ Dynamic: home-page
16
+ Dynamic: keywords
17
+ Dynamic: license
18
+ Dynamic: requires-dist
19
+ Dynamic: summary
@@ -1,6 +1,7 @@
1
1
  import contextlib
2
2
  import importlib
3
3
  import json
4
+ import logging
4
5
  import os
5
6
  import re
6
7
  import subprocess
@@ -43,16 +44,17 @@ fs_backup_class = FSTestBackupDir
43
44
  class ProbackupApp:
44
45
 
45
46
  def __init__(self, test_class: unittest.TestCase,
46
- pg_node, pb_log_path, test_env, auto_compress_alg, backup_dir):
47
+ pg_node, pb_log_path, test_env, auto_compress_alg, backup_dir, probackup_path=None):
47
48
  self.test_class = test_class
48
49
  self.pg_node = pg_node
49
50
  self.pb_log_path = pb_log_path
50
51
  self.test_env = test_env
51
52
  self.auto_compress_alg = auto_compress_alg
52
53
  self.backup_dir = backup_dir
53
- self.probackup_path = init_params.probackup_path
54
+ self.probackup_path = probackup_path or init_params.probackup_path
54
55
  self.probackup_old_path = init_params.probackup_old_path
55
56
  self.remote = init_params.remote
57
+ self.wal_tree_enabled = init_params.wal_tree_enabled
56
58
  self.verbose = init_params.verbose
57
59
  self.archive_compress = init_params.archive_compress
58
60
  self.test_class.output = None
@@ -72,9 +74,11 @@ class ProbackupApp:
72
74
  command = [command[0], *use_backup_dir.pb_args, *command[1:]]
73
75
  elif use_backup_dir:
74
76
  command = [command[0], *self.backup_dir.pb_args, *command[1:]]
77
+ else:
78
+ command = [command[0], *self.backup_dir.pb_args[2:], *command[1:]]
75
79
 
76
80
  if not self.probackup_old_path and old_binary:
77
- print('PGPROBACKUPBIN_OLD is not set')
81
+ logging.error('PGPROBACKUPBIN_OLD is not set')
78
82
  exit(1)
79
83
 
80
84
  if old_binary:
@@ -107,12 +111,11 @@ class ProbackupApp:
107
111
  return GDBobj(cmdline, self.test_class)
108
112
 
109
113
  try:
110
- result = None
111
114
  if type(gdb) is tuple and gdb[0] == 'suspend':
112
115
  # special test flow for manually debug probackup
113
116
  gdb_port = gdb[1]
114
117
  cmdline = ['gdbserver'] + ['localhost:' + str(gdb_port)] + cmdline
115
- print("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
118
+ logging.warning("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
116
119
 
117
120
  start_time = time.time()
118
121
  self.test_class.output = subprocess.check_output(
@@ -185,6 +188,9 @@ class ProbackupApp:
185
188
  '--remote-proto=ssh',
186
189
  '--remote-host=localhost']
187
190
 
191
+ if self.wal_tree_enabled:
192
+ options = options + ['--wal-tree']
193
+
188
194
  return self.run(cmd + options, old_binary=old_binary, expect_error=expect_error)
189
195
 
190
196
  def set_config(self, instance, old_binary=False, options=None, expect_error=False):
@@ -233,7 +239,7 @@ class ProbackupApp:
233
239
  if options is None:
234
240
  options = []
235
241
  if not node and not data_dir:
236
- print('You must provide ether node or data_dir for backup')
242
+ logging.error('You must provide ether node or data_dir for backup')
237
243
  exit(1)
238
244
 
239
245
  if not datname:
@@ -388,6 +394,7 @@ class ProbackupApp:
388
394
  backup_mode, source_pgdata, destination_node,
389
395
  options=None,
390
396
  remote_host='localhost',
397
+ remote_port=None,
391
398
  expect_error=False,
392
399
  gdb=False
393
400
  ):
@@ -401,7 +408,9 @@ class ProbackupApp:
401
408
  '--destination-pgdata={0}'.format(destination_node.data_dir)
402
409
  ]
403
410
  if self.remote:
404
- cmd_list += ['--remote-proto=ssh', '--remote-host=%s' % remote_host]
411
+ cmd_list += ['--remote-proto=ssh', f'--remote-host={remote_host}']
412
+ if remote_port:
413
+ cmd_list.append(f'--remote-port={remote_port}')
405
414
  if self.verbose:
406
415
  cmd_list += [
407
416
  '--log-level-file=VERBOSE',
@@ -499,7 +508,7 @@ class ProbackupApp:
499
508
  if i == '':
500
509
  backup_record_split.remove(i)
501
510
  if len(header_split) != len(backup_record_split):
502
- print(warning.format(
511
+ logging.error(warning.format(
503
512
  header=header, body=body,
504
513
  header_split=header_split,
505
514
  body_split=backup_record_split)
@@ -578,7 +587,7 @@ class ProbackupApp:
578
587
  else:
579
588
  show_splitted = self.run(cmd_list + options, old_binary=old_binary,
580
589
  expect_error=expect_error).splitlines()
581
- print(show_splitted)
590
+ logging.error(show_splitted)
582
591
  exit(1)
583
592
 
584
593
  def validate(
@@ -702,9 +711,13 @@ class ProbackupApp:
702
711
  if overwrite:
703
712
  archive_command += ' --overwrite'
704
713
 
705
- archive_command += ' --log-level-console=VERBOSE'
706
- archive_command += ' -j 5'
707
- archive_command += ' --batch-size 10'
714
+ if init_params.major_version > 2:
715
+ archive_command += ' --log-level-console=trace'
716
+ else:
717
+ archive_command += ' --log-level-console=VERBOSE'
718
+ archive_command += ' -j 5'
719
+ archive_command += ' --batch-size 10'
720
+
708
721
  archive_command += ' --no-sync'
709
722
 
710
723
  if archive_timeout:
@@ -766,7 +779,7 @@ class ProbackupApp:
766
779
  if fs_type:
767
780
  implementation = fs_type
768
781
 
769
- print("Using ", implementation)
782
+ logging.info("Using ", implementation)
770
783
  module_name, class_name = implementation.rsplit(sep='.', maxsplit=1)
771
784
 
772
785
  module = importlib.import_module(module_name)
@@ -37,7 +37,7 @@ class GDBobj:
37
37
  " to run GDB tests")
38
38
  raise GdbException("No gdb usage possible.")
39
39
 
40
- # Check gdb presense
40
+ # Check gdb presence
41
41
  try:
42
42
  gdb_version, _ = subprocess.Popen(
43
43
  ['gdb', '--version'],
@@ -108,6 +108,9 @@ class GDBobj:
108
108
  self.proc.stdin.close()
109
109
  self.proc.stdout.close()
110
110
 
111
+ def terminate_subprocess(self):
112
+ self._execute('kill')
113
+
111
114
  def set_breakpoint(self, location):
112
115
 
113
116
  result = self._execute('break ' + location)
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from functools import reduce
2
3
  import getpass
3
4
  import os
@@ -31,7 +32,7 @@ try:
31
32
  cached_initdb_dir=False,
32
33
  node_cleanup_full=delete_logs)
33
34
  except Exception as e:
34
- print("Can't configure testgres: {0}".format(e))
35
+ logging.warning("Can't configure testgres: {0}".format(e))
35
36
 
36
37
 
37
38
  class Init(object):
@@ -104,7 +105,7 @@ class Init(object):
104
105
 
105
106
  if os.path.isfile(probackup_path_tmp):
106
107
  if not os.access(probackup_path_tmp, os.X_OK):
107
- print('{0} is not an executable file'.format(
108
+ logging.warning('{0} is not an executable file'.format(
108
109
  probackup_path_tmp))
109
110
  else:
110
111
  self.probackup_path = probackup_path_tmp
@@ -114,13 +115,13 @@ class Init(object):
114
115
 
115
116
  if os.path.isfile(probackup_path_tmp):
116
117
  if not os.access(probackup_path_tmp, os.X_OK):
117
- print('{0} is not an executable file'.format(
118
+ logging.warning('{0} is not an executable file'.format(
118
119
  probackup_path_tmp))
119
120
  else:
120
121
  self.probackup_path = probackup_path_tmp
121
122
 
122
123
  if not self.probackup_path:
123
- print('pg_probackup binary is not found')
124
+ logging.error('pg_probackup binary is not found')
124
125
  exit(1)
125
126
 
126
127
  if os.name == 'posix':
@@ -169,6 +170,11 @@ class Init(object):
169
170
 
170
171
  self.remote = test_env.get('PGPROBACKUP_SSH_REMOTE', None) == 'ON'
171
172
  self.ptrack = test_env.get('PG_PROBACKUP_PTRACK', None) == 'ON' and self.pg_config_version >= 110000
173
+ self.wal_tree_enabled = test_env.get('PG_PROBACKUP_WAL_TREE_ENABLED', None) == 'ON'
174
+
175
+ self.bckp_source = test_env.get('PG_PROBACKUP_SOURCE', 'pro').lower()
176
+ if self.bckp_source not in ('base', 'direct', 'pro'):
177
+ raise Exception("Wrong PG_PROBACKUP_SOURCE value. Available options: base|direct|pro")
172
178
 
173
179
  self.paranoia = test_env.get('PG_PROBACKUP_PARANOIA', None) == 'ON'
174
180
  env_compress = test_env.get('ARCHIVE_COMPRESSION', None)
@@ -207,7 +213,7 @@ class Init(object):
207
213
  if self.probackup_version.split('.')[0].isdigit():
208
214
  self.major_version = int(self.probackup_version.split('.')[0])
209
215
  else:
210
- print('Can\'t process pg_probackup version \"{}\": the major version is expected to be a number'.format(self.probackup_version))
216
+ logging.error('Can\'t process pg_probackup version \"{}\": the major version is expected to be a number'.format(self.probackup_version))
211
217
  sys.exit(1)
212
218
 
213
219
  def test_env(self):
@@ -4,7 +4,7 @@ except ImportError:
4
4
  from distutils.core import setup
5
5
 
6
6
  setup(
7
- version='0.0.3',
7
+ version='0.0.5',
8
8
  name='testgres_pg_probackup2',
9
9
  packages=['pg_probackup2', 'pg_probackup2.storage'],
10
10
  description='Plugin for testgres that manages pg_probackup2',
@@ -1,14 +1,19 @@
1
- Metadata-Version: 2.1
2
- Name: testgres-pg-probackup2
3
- Version: 0.0.3
1
+ Metadata-Version: 2.2
2
+ Name: testgres_pg_probackup2
3
+ Version: 0.0.5
4
4
  Summary: Plugin for testgres that manages pg_probackup2
5
5
  Home-page: https://github.com/postgrespro/testgres
6
6
  Author: Postgres Professional
7
7
  Author-email: testgres@postgrespro.ru
8
8
  License: PostgreSQL
9
9
  Keywords: pg_probackup,testing,testgres
10
- Platform: UNKNOWN
11
10
  Description-Content-Type: text/markdown
12
-
13
- UNKNOWN
14
-
11
+ Requires-Dist: testgres>=1.9.2
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description-content-type
15
+ Dynamic: home-page
16
+ Dynamic: keywords
17
+ Dynamic: license
18
+ Dynamic: requires-dist
19
+ Dynamic: summary