Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit de531e6

Browse files
committed
PBCKP-797: fix race condition by waiting
and filling same amount of rows.
1 parent 70b97d8 commit de531e6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/page_test.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import subprocess
77
import gzip
88
import shutil
9+
import time
910

1011
class PageTest(ProbackupTest, unittest.TestCase):
1112

@@ -893,7 +894,7 @@ def test_page_backup_with_alien_wal_segment(self):
893894
"create table t_heap as select i as id, "
894895
"md5(i::text) as text, "
895896
"md5(repeat(i::text,10))::tsvector as tsvector "
896-
"from generate_series(0,1000) i;")
897+
"from generate_series(0,10000) i;")
897898

898899
alien_node.safe_psql(
899900
"postgres",
@@ -905,7 +906,7 @@ def test_page_backup_with_alien_wal_segment(self):
905906
"create table t_heap_alien as select i as id, "
906907
"md5(i::text) as text, "
907908
"md5(repeat(i::text,10))::tsvector as tsvector "
908-
"from generate_series(0,100000) i;")
909+
"from generate_series(0,10000) i;")
909910

910911
# copy latest wal segment
911912
wals_dir = os.path.join(backup_dir, 'wal', 'alien_node')
@@ -916,9 +917,9 @@ def test_page_backup_with_alien_wal_segment(self):
916917
file = os.path.join(wals_dir, filename)
917918
file_destination = os.path.join(
918919
os.path.join(backup_dir, 'wal', 'node'), filename)
919-
# file = os.path.join(wals_dir, '000000010000000000000004')
920-
print(file)
921-
print(file_destination)
920+
start = time.time()
921+
while not os.path.exists(file_destination) and time.time() - start < 20:
922+
time.sleep(0.1)
922923
os.remove(file_destination)
923924
os.rename(file, file_destination)
924925

0 commit comments

Comments
 (0)