Change checkpoint_distance type to u64

This commit is contained in:
anastasia
2021-09-15 19:21:27 +03:00
committed by lubennikovaav
parent 6984d33b4e
commit 8de41f1d70
3 changed files with 5 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ impl CfgFileParams {
None => DEFAULT_HTTP_LISTEN_ADDR.to_owned(),
};
let checkpoint_distance: i128 = match self.checkpoint_distance.as_ref() {
let checkpoint_distance: u64 = match self.checkpoint_distance.as_ref() {
Some(checkpoint_distance_str) => checkpoint_distance_str.parse()?,
None => DEFAULT_CHECKPOINT_DISTANCE,
};

View File

@@ -1232,7 +1232,7 @@ impl LayeredTimeline {
/// Flush to disk all data that was written with the put_* functions
///
/// NOTE: This has nothing to do with checkpoint in PostgreSQL.
fn checkpoint_internal(&self, checkpoint_distance: i128) -> Result<()> {
fn checkpoint_internal(&self, checkpoint_distance: u64) -> Result<()> {
// Grab lock on the layer map.
//
// TODO: We hold it locked throughout the checkpoint operation. That's bad,
@@ -1280,7 +1280,7 @@ impl LayeredTimeline {
// inserted ourselves.
let distance = last_record_lsn.widening_sub(oldest_pending_lsn);
if distance < 0
|| distance < checkpoint_distance
|| distance < checkpoint_distance.into()
|| oldest_generation == current_generation
{
info!(

View File

@@ -31,7 +31,7 @@ pub mod defaults {
// FIXME: This current value is very low. I would imagine something like 1 GB or 10 GB
// would be more appropriate. But a low value forces the code to be exercised more,
// which is good for now to trigger bugs.
pub const DEFAULT_CHECKPOINT_DISTANCE: i128 = 64 * 1024 * 1024;
pub const DEFAULT_CHECKPOINT_DISTANCE: u64 = 64 * 1024 * 1024;
pub const DEFAULT_CHECKPOINT_PERIOD: Duration = Duration::from_secs(100);
pub const DEFAULT_GC_HORIZON: u64 = 64 * 1024 * 1024;
@@ -59,7 +59,7 @@ pub struct PageServerConf {
// Flush out an inmemory layer, if it's holding WAL older than this
// This puts a backstop on how much WAL needs to be re-digested if the
// page server crashes.
pub checkpoint_distance: i128,
pub checkpoint_distance: u64,
pub checkpoint_period: Duration,
pub gc_horizon: u64,