MCPcopy Create free account
hub / github.com/wal-e/wal-e / wal_prefetch

Method wal_prefetch

wal_e/operator/backup.py:365–402  ·  view source on GitHub ↗
(self, base, segment_name)

Source from the content-addressed store, hash-verified

363 return ret
364
365 def wal_prefetch(self, base, segment_name):
366 url = '{0}://{1}/{2}'.format(
367 self.layout.scheme, self.layout.store_name(),
368 self.layout.wal_path(segment_name))
369 pd = prefetch.Dirs(base)
370 seg = WalSegment(segment_name)
371 pd.create(seg)
372 with pd.download(seg) as d:
373 logger.info(
374 msg='begin wal restore',
375 structured={'action': 'wal-prefetch',
376 'key': url,
377 'seg': segment_name,
378 'prefix': self.layout.path_prefix,
379 'state': 'begin'})
380
381 ret = do_lzop_get(self.creds, url, d.dest,
382 self.gpg_key_id is not None, do_retry=False)
383 if not ret:
384 # If the download failed, AtomicDownload.__exit__()
385 # must be informed so that it does not link an empty
386 # archive file into place.
387 #
388 # We thus raise SystemExit. This is acceptable for
389 # prefetch since prefetch execution is daemonized.
390 # I.e., PostgreSQL has no knowledge of prefetch
391 # exit codes.
392 raise SystemExit('Failed to prefetch %s' % segment_name)
393
394 logger.info(
395 msg='complete wal restore',
396 structured={'action': 'wal-prefetch',
397 'key': url,
398 'seg': segment_name,
399 'prefix': self.layout.path_prefix,
400 'state': 'complete'})
401
402 return ret
403
404 def delete_old_versions(self, dry_run):
405 assert storage.CURRENT_VERSION not in storage.OBSOLETE_VERSIONS

Callers 1

mainFunction · 0.80

Calls 8

createMethod · 0.95
downloadMethod · 0.95
WalSegmentClass · 0.90
do_lzop_getFunction · 0.90
formatMethod · 0.80
store_nameMethod · 0.80
wal_pathMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected