patroni.git / summary / log / commit / refs
commit 9fc412a6737486ed84d0bf48c3d080952dbfe7af
Author: Oleksii Kliukin <oleksii.kliukin@zalando.de>
Date: Tue May 19 08:32:48 2015 +0000
some arithmetics and type conversion fixes.
helpers/postgresql.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/helpers/postgresql.py b/helpers/postgresql.py
index 2242e4ec..a589ee4d 100644
--- a/helpers/postgresql.py
+++ b/helpers/postgresql.py
@@ -158,14 +158,15 @@ class Postgresql:
# that we have to convert to hex and 'prepend' to the high offset digits.
lsn_segment = backup_start_segment[8:16]
- lsn_offset = hex(int(backup_start_segment[16:32], 16) << 24 + backup_start_offset)[2:]
+ # first 2 characters of the result are 0x and the last one is L
+ lsn_offset = hex((long(backup_start_segment[16:32], 16) << 24) + long(backup_start_offset))[2:-1]
# construct the LSN from the segment and offset
backup_start_lsn = '{}/{}'.format(lsn_segment, lsn_offset)
conn = None
cursor = None
- diff_in_bytes = backup_size
+ diff_in_bytes = long(backup_size)
try:
# get the difference in bytes between the current WAL location and the backup start offset
conn = psycopg2.connect(master_connurl)
[parent: ea5b4e9725ea]