Skip to content

Commit

Permalink
pylint: user newer pylint
Browse files Browse the repository at this point in the history
Older pylint version had issues with distutils imports:

pylint-dev/pylint#73
  • Loading branch information
Mika Eloranta committed Oct 26, 2019
1 parent 9f89ea7 commit e218135
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ disable=
bad-option-value,
duplicate-code,
fixme,
import-outside-toplevel,
invalid-name,
len-as-condition,
locally-disabled,
Expand Down
13 changes: 7 additions & 6 deletions pghoard/archive_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,20 @@ def check_wal_archive_integrity(self, new_backup_on_failure):
return 0
valid_timeline = True
continue
elif not valid_timeline:

if not valid_timeline:
msg = "{} file {} missing, integrity check from {} to {} failed".format(
archive_type, wal_file, current_wal_file, first_required_wal_file)
if not new_backup_on_failure:
raise SyncError(msg)
self.log.error("Requesting new basebackup: %s", msg)
self.request_basebackup()
return 0
else:
# Go back one timeline and flag the current timeline as invalid, this will prevent segment
# number from being decreased on the next iteration.
valid_timeline = False
current_tli -= 1

# Go back one timeline and flag the current timeline as invalid, this will prevent segment
# number from being decreased on the next iteration.
valid_timeline = False
current_tli -= 1

def request_basebackup(self):
resp = requests.put("{base}/archive/basebackup".format(base=self.base_url))
Expand Down
4 changes: 3 additions & 1 deletion pghoard/pghoard.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@ def startup_walk_for_missed_files(self):
self.metrics.increase("pghoard.incomplete_partial_wal_segment")
os.truncate(full_path, 0)
continue
elif not wal.WAL_RE.match(filename) and not wal.TIMELINE_RE.match(filename):

if not wal.WAL_RE.match(filename) and not wal.TIMELINE_RE.match(filename):
self.log.warning("Found invalid file %r from incoming xlog directory", full_path)
continue

compression_event = {
"delete_file_after_compression": True,
"full_path": full_path,
Expand Down
3 changes: 2 additions & 1 deletion pghoard/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ def fetch_all(self):
self.last_progress_ts = time.monotonic()
if self.errors:
break
elif retry == 2:

if retry == 2:
self.log.error("Download stalled despite retries, aborting")
self.errors = 1
break
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
astroid==2.0.0
astroid
botocore
cryptography
flake8
httplib2
mock
psycopg2
pylint==2.2.2
pylint>=2.4.3
pytest
python-dateutil
python-snappy
Expand Down
4 changes: 3 additions & 1 deletion test/test_pghoard.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ def test_pause_on_disk_full(self, db, pghoard_separate_volume):
xlogs = pghoard.transfer_agent_state[site]["upload"]["xlog"]["xlogs_since_basebackup"]
if xlogs >= 15:
break
elif time.monotonic() - start > 15:

if time.monotonic() - start > 15:
assert False, "Expected at least 15 xlog uploads, got {}".format(xlogs)

time.sleep(0.1)

0 comments on commit e218135

Please sign in to comment.