readWALPosition reads the recorded WAL position from the WAL position file
()
| 770 | |
| 771 | // readWALPosition reads the recorded WAL position from the WAL position file |
| 772 | func (r *LogicalReplicator) readWALPosition() (pglogrepl.LSN, error) { |
| 773 | walFileContents, err := os.ReadFile(r.walFilePath) |
| 774 | if err != nil { |
| 775 | // if the file doesn't exist, consider this a cold start and return 0 |
| 776 | if os.IsNotExist(err) { |
| 777 | return pglogrepl.LSN(0), nil |
| 778 | } |
| 779 | return 0, err |
| 780 | } |
| 781 | |
| 782 | return pglogrepl.ParseLSN(string(walFileContents)) |
| 783 | } |
| 784 | |
| 785 | // writeWALPosition writes the recorded WAL position to the WAL position file |
| 786 | func (r *LogicalReplicator) writeWALPosition(lsn pglogrepl.LSN) error { |
no test coverage detected