Store the current checkpoint in the oplog progress dictionary.
(self, checkpoint)
| 784 | return cursor, cursor_empty |
| 785 | |
| 786 | def update_checkpoint(self, checkpoint): |
| 787 | """Store the current checkpoint in the oplog progress dictionary. |
| 788 | """ |
| 789 | if checkpoint is not None and checkpoint != self.checkpoint: |
| 790 | self.checkpoint = checkpoint |
| 791 | with self.oplog_progress as oplog_prog: |
| 792 | oplog_dict = oplog_prog.get_dict() |
| 793 | # If we have the repr of our oplog collection |
| 794 | # in the dictionary, remove it and replace it |
| 795 | # with our replica set name. |
| 796 | # This allows an easy upgrade path from mongo-connector 2.3. |
| 797 | # For an explanation of the format change, see the comment in |
| 798 | # read_last_checkpoint. |
| 799 | oplog_dict.pop(str(self.oplog), None) |
| 800 | oplog_dict[self.replset_name] = checkpoint |
| 801 | LOG.debug("OplogThread: oplog checkpoint updated to %s", |
| 802 | checkpoint) |
| 803 | else: |
| 804 | LOG.debug("OplogThread: no checkpoint to update.") |
| 805 | |
| 806 | def read_last_checkpoint(self): |
| 807 | """Read the last checkpoint from the oplog progress dictionary. |