Use checkpoint_distance instead of OLDEST_INMEM_DISTANCE

This commit is contained in:
Konstantin Knizhnik
2021-09-16 14:44:26 +03:00
parent 09cced0855
commit 611abc5299

View File

@@ -1239,7 +1239,7 @@ impl LayeredTimeline {
if let Some((oldest_layer, _oldest_generation)) = layers.peek_oldest_open() {
let oldest_pending_lsn = oldest_layer.get_oldest_pending_lsn();
let distance = lsn.widening_sub(oldest_pending_lsn);
let excess_factor = distance / conf.checkpoint_distance - 1;
let excess_factor = distance / self.conf.checkpoint_distance as i128 - 1;
if excess_factor > 0 {
// Memory layers consume two much memory because checkpointer
// is not able to keep up with wal receiveer and flushes inmemory layers with