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

Method mark_done

wal_e/worker/pg/wal_transfer.py:30–65  ·  view source on GitHub ↗

Mark the archive status of this segment as 'done'. This is most useful when performing out-of-band parallel uploads of segments, so that Postgres doesn't try to go and upload them again. This amounts to messing with an internal bookkeeping mechanism of Postg

(self)

Source from the content-addressed store, hash-verified

28 seg=gd['seg'])
29
30 def mark_done(self):
31 """Mark the archive status of this segment as 'done'.
32
33 This is most useful when performing out-of-band parallel
34 uploads of segments, so that Postgres doesn't try to go and
35 upload them again.
36
37 This amounts to messing with an internal bookkeeping mechanism
38 of Postgres, but that mechanism is not changing too fast over
39 the last five years and seems simple enough.
40 """
41
42 # Recheck that this is not an segment explicitly passed from Postgres
43 if self.explicit:
44 raise UserCritical(
45 msg='unexpected attempt to modify wal metadata detected',
46 detail=('Segments explicitly passed from postgres should not '
47 'engage in archiver metadata manipulation: {0}'
48 .format(self.path)),
49 hint='report a bug')
50
51 # Attempt a rename of archiver metadata, wrapping unexpected
52 # raised exceptions into a UserCritical.
53 try:
54 status_dir = path.join(path.dirname(self.path),
55 'archive_status')
56
57 ready_metadata = path.join(status_dir, self.name + '.ready')
58 done_metadata = path.join(status_dir, self.name + '.done')
59
60 os.rename(ready_metadata, done_metadata)
61 except Exception:
62 raise UserCritical(
63 msg='problem moving .ready archive status to .done',
64 detail='Traceback is: {0}'.format(traceback.format_exc()),
65 hint='report a bug')
66
67 @staticmethod
68 def from_ready_archive_status(xlog_dir):

Callers 1

_complete_executionMethod · 0.45

Calls 3

UserCriticalClass · 0.90
formatMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected