testgres-pg-probackup2 0.0.4__tar.gz → 0.0.6__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.
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/PKG-INFO +10 -2
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/app.py +37 -6
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/init_helpers.py +12 -5
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/setup.py +1 -1
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/testgres_pg_probackup2.egg-info/PKG-INFO +10 -2
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/README.md +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/__init__.py +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/gdb.py +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/storage/__init__.py +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/storage/fs_backup.py +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/setup.cfg +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/testgres_pg_probackup2.egg-info/SOURCES.txt +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/testgres_pg_probackup2.egg-info/dependency_links.txt +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/testgres_pg_probackup2.egg-info/requires.txt +0 -0
- {testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/testgres_pg_probackup2.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: testgres_pg_probackup2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Plugin for testgres that manages pg_probackup2
|
|
5
5
|
Home-page: https://github.com/postgrespro/testgres
|
|
6
6
|
Author: Postgres Professional
|
|
@@ -9,3 +9,11 @@ License: PostgreSQL
|
|
|
9
9
|
Keywords: pg_probackup,testing,testgres
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
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
|
|
@@ -45,6 +45,7 @@ class ProbackupApp:
|
|
|
45
45
|
|
|
46
46
|
def __init__(self, test_class: unittest.TestCase,
|
|
47
47
|
pg_node, pb_log_path, test_env, auto_compress_alg, backup_dir, probackup_path=None):
|
|
48
|
+
self.process = None
|
|
48
49
|
self.test_class = test_class
|
|
49
50
|
self.pg_node = pg_node
|
|
50
51
|
self.pb_log_path = pb_log_path
|
|
@@ -60,8 +61,35 @@ class ProbackupApp:
|
|
|
60
61
|
self.test_class.output = None
|
|
61
62
|
self.execution_time = None
|
|
62
63
|
|
|
64
|
+
def form_daemon_process(self, cmdline, env):
|
|
65
|
+
def stream_output(stream: subprocess.PIPE) -> None:
|
|
66
|
+
try:
|
|
67
|
+
for line in iter(stream.readline, ''):
|
|
68
|
+
print(line)
|
|
69
|
+
self.test_class.output += line
|
|
70
|
+
finally:
|
|
71
|
+
stream.close()
|
|
72
|
+
|
|
73
|
+
self.process = subprocess.Popen(
|
|
74
|
+
cmdline,
|
|
75
|
+
stdout=subprocess.PIPE,
|
|
76
|
+
stderr=subprocess.PIPE,
|
|
77
|
+
text=True,
|
|
78
|
+
env=env
|
|
79
|
+
)
|
|
80
|
+
logging.info(f"Process started in background with PID: {self.process.pid}")
|
|
81
|
+
|
|
82
|
+
if self.process.stdout and self.process.stderr:
|
|
83
|
+
stdout_thread = threading.Thread(target=stream_output, args=(self.process.stdout,), daemon=True)
|
|
84
|
+
stderr_thread = threading.Thread(target=stream_output, args=(self.process.stderr,), daemon=True)
|
|
85
|
+
|
|
86
|
+
stdout_thread.start()
|
|
87
|
+
stderr_thread.start()
|
|
88
|
+
|
|
89
|
+
return self.process.pid
|
|
90
|
+
|
|
63
91
|
def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
|
|
64
|
-
skip_log_directory=False, expect_error=False, use_backup_dir=True):
|
|
92
|
+
skip_log_directory=False, expect_error=False, use_backup_dir=True, daemonize=False):
|
|
65
93
|
"""
|
|
66
94
|
Run pg_probackup
|
|
67
95
|
backup_dir: target directory for making backup
|
|
@@ -118,11 +146,14 @@ class ProbackupApp:
|
|
|
118
146
|
logging.warning("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
|
|
119
147
|
|
|
120
148
|
start_time = time.time()
|
|
121
|
-
|
|
122
|
-
cmdline,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
if daemonize:
|
|
150
|
+
return self.form_daemon_process(cmdline, env)
|
|
151
|
+
else:
|
|
152
|
+
self.test_class.output = subprocess.check_output(
|
|
153
|
+
cmdline,
|
|
154
|
+
stderr=subprocess.STDOUT,
|
|
155
|
+
env=env
|
|
156
|
+
).decode('utf-8', errors='replace')
|
|
126
157
|
end_time = time.time()
|
|
127
158
|
self.execution_time = end_time - start_time
|
|
128
159
|
|
|
@@ -121,8 +121,7 @@ class Init(object):
|
|
|
121
121
|
self.probackup_path = probackup_path_tmp
|
|
122
122
|
|
|
123
123
|
if not self.probackup_path:
|
|
124
|
-
|
|
125
|
-
exit(1)
|
|
124
|
+
raise Exception('pg_probackup binary is not found')
|
|
126
125
|
|
|
127
126
|
if os.name == 'posix':
|
|
128
127
|
self.EXTERNAL_DIRECTORY_DELIMITER = ':'
|
|
@@ -172,6 +171,10 @@ class Init(object):
|
|
|
172
171
|
self.ptrack = test_env.get('PG_PROBACKUP_PTRACK', None) == 'ON' and self.pg_config_version >= 110000
|
|
173
172
|
self.wal_tree_enabled = test_env.get('PG_PROBACKUP_WAL_TREE_ENABLED', None) == 'ON'
|
|
174
173
|
|
|
174
|
+
self.bckp_source = test_env.get('PG_PROBACKUP_SOURCE', 'pro').lower()
|
|
175
|
+
if self.bckp_source not in ('base', 'direct', 'pro'):
|
|
176
|
+
raise Exception("Wrong PG_PROBACKUP_SOURCE value. Available options: base|direct|pro")
|
|
177
|
+
|
|
175
178
|
self.paranoia = test_env.get('PG_PROBACKUP_PARANOIA', None) == 'ON'
|
|
176
179
|
env_compress = test_env.get('ARCHIVE_COMPRESSION', None)
|
|
177
180
|
if env_compress:
|
|
@@ -209,11 +212,15 @@ class Init(object):
|
|
|
209
212
|
if self.probackup_version.split('.')[0].isdigit():
|
|
210
213
|
self.major_version = int(self.probackup_version.split('.')[0])
|
|
211
214
|
else:
|
|
212
|
-
|
|
213
|
-
sys.exit(1)
|
|
215
|
+
raise Exception('Can\'t process pg_probackup version \"{}\": the major version is expected to be a number'.format(self.probackup_version))
|
|
214
216
|
|
|
215
217
|
def test_env(self):
|
|
216
218
|
return self._test_env.copy()
|
|
217
219
|
|
|
218
220
|
|
|
219
|
-
|
|
221
|
+
try:
|
|
222
|
+
init_params = Init()
|
|
223
|
+
except Exception as e:
|
|
224
|
+
logging.error(str(e))
|
|
225
|
+
logging.warning("testgres.plugins.probackup2.init_params is set to None.")
|
|
226
|
+
init_params = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: testgres_pg_probackup2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Plugin for testgres that manages pg_probackup2
|
|
5
5
|
Home-page: https://github.com/postgrespro/testgres
|
|
6
6
|
Author: Postgres Professional
|
|
@@ -9,3 +9,11 @@ License: PostgreSQL
|
|
|
9
9
|
Keywords: pg_probackup,testing,testgres
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/storage/__init__.py
RENAMED
|
File without changes
|
{testgres_pg_probackup2-0.0.4 → testgres_pg_probackup2-0.0.6}/pg_probackup2/storage/fs_backup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|