1. Always start repliction from the begging of WAL segment (to be able to skip missed segments)

2. Do not materialize always last version of objects in GC (only when needed)
3. Fix history test
4. Fix CPU consumption in wal_keeper when connection is broken
5. Fix handling of --recall parameter in walkeeper
This commit is contained in:
Konstantin Knizhnik
2021-06-11 15:49:38 +03:00
parent 04e1ee5ce3
commit 87fce3fcd5
8 changed files with 40 additions and 37 deletions

View File

@@ -48,7 +48,7 @@ fn main() -> Result<()> {
.help("interval for keeping WAL as walkeeper node, after which them will be uploaded to S3 and removed locally"),
)
.arg(
Arg::with_name("recall-period")
Arg::with_name("recall")
.long("recall")
.takes_value(true)
.help("Period for requestion pageserver to call for replication"),

View File

@@ -248,7 +248,14 @@ impl ReceiveWalConn {
let (flush_lsn, timeline) = self.timeline.find_end_of_wal(&self.conf.data_dir, true);
my_info.flush_lsn = flush_lsn;
let min_lsn = Lsn((server_info.wal_seg_size as u64) * 2); // strt from second segment because of pg_resetwal
// FIXME: Yet another trick to handle creation of new WAL segment at
// compute node startup (a-la pg_resetwal).
// If restart_lsn was not adjusted then walproposer will try to perform recovery
// because restart_lsn != flush_lsn and fail because first WAL segment is missed.
// May be it is better to handle it by wal proposer, but it will contradict with wal_proposer
// usage in other branches.
// This adjustment is needed only for first segment.
let min_lsn = Lsn((server_info.wal_seg_size as u64) * 2);
my_info.restart_lsn = Lsn::max(my_info.restart_lsn, min_lsn);
my_info.server.timeline = timeline;

View File

@@ -63,11 +63,15 @@ impl ReplicationConn {
let feedback = HotStandbyFeedback::des(&m)?;
timeline.add_hs_feedback(feedback)
}
msg => {
None => {
break;
}
Some(msg) => {
info!("unexpected message {:?}", msg);
}
}
}
Err(anyhow!("Connection closed"))
}
/// Helper function that parses a pair of LSNs.

View File

@@ -232,8 +232,10 @@ 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;
assert!(seg_size > 0);
let (lsn, timeline) = find_end_of_wal(data_dir, seg_size, precise);
let wal_start = Lsn((seg_size * 2) as u64); // FIXME: handle pg_resetwal
// FIXME: because of generation of new segment at compute node start we just do not have first WAL segment
let wal_start = Lsn((seg_size * 2) as u64);
let lsn = Lsn::max(Lsn(lsn), wal_start);
(lsn, timeline)
}