Look up wal directory properly in all find_end_of_wal callers.

ref #388
This commit is contained in:
Arseny Sher
2021-08-04 11:55:33 +03:00
committed by arssher
parent 56565c0f58
commit b77fade7b8
2 changed files with 3 additions and 8 deletions

View File

@@ -242,13 +242,7 @@ impl ReceiveWalConn {
my_info.server.node_id = node_id;
/* Calculate WAL end based on local data */
let (flush_lsn, timeline) = self.timeline.find_end_of_wal(
&self
.conf
.data_dir
.join(format!("{}", server_info.timeline_id)),
true,
);
let (flush_lsn, timeline) = self.timeline.find_end_of_wal(&self.conf.data_dir, true);
my_info.flush_lsn = flush_lsn;
my_info.server.timeline = timeline;

View File

@@ -232,7 +232,8 @@ impl TimelineTools for Option<Arc<Timeline>> {
/// Find last WAL record. If "precise" is false then just locate last partial segment
fn find_end_of_wal(&self, data_dir: &Path, precise: bool) -> (Lsn, TimeLineID) {
let seg_size = self.get().get_info().server.wal_seg_size as usize;
let (lsn, timeline) = find_end_of_wal(data_dir, seg_size, precise);
let wal_dir = data_dir.join(format!("{}", self.get().timelineid));
let (lsn, timeline) = find_end_of_wal(&wal_dir, seg_size, precise);
(Lsn(lsn), timeline)
}
}