Skip to content

Commit 6d0cbfa

Browse files
Fix test test_arhive_push_file_exists
1 parent 20d4dcc commit 6d0cbfa

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
11241124
return;
11251125
/* Do not copy and do not rise error. Just quit as normal. */
11261126
else if (!overwrite)
1127-
elog(ERROR, "WAL segment \"%s\" already exists.", to_path);
1127+
elog(ERROR, "WAL segment \"%s\" already exists.", to_path_p);
11281128
}
11291129

11301130
/* open backup file for write */

tests/archive.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import shutil
3-
import zlib
3+
import gzip
44
import unittest
55
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, archive_script
66
from datetime import datetime, timedelta
@@ -329,13 +329,11 @@ def test_arhive_push_file_exists(self):
329329

330330
wal_src = os.path.join(node.data_dir, 'pg_wal', '000000010000000000000001')
331331
if self.archive_compress:
332-
with open(wal_src, 'rb') as f_in, open(file, 'wb') as f_out:
333-
original_wal = f_in.read()
334-
compressed_wal = zlib.compress(original_wal, 1)
335-
f_out.write(compressed_wal)
332+
with open(wal_src, 'rb') as f_in, gzip.open(file, 'wb', compresslevel=1) as f_out:
333+
shutil.copyfileobj(f_in, f_out)
336334
else:
337335
shutil.copyfile(wal_src, file)
338-
336+
339337
self.switch_wal_segment(node)
340338
sleep(5)
341339

0 commit comments

Comments
 (0)