Skip to content

Commit

Permalink
Remove obsolete code, now that we don't load WAL from local disk anym…
Browse files Browse the repository at this point in the history
…ore.

Commit ca9af37 removed the import_timeline_wal() call from here.
After that, the info!() message is bogus, as we no longer load the WAL
from local disk. Also, the logical size assertion is pointless now.
  • Loading branch information
hlinnaka committed Oct 6, 2021
1 parent 24580f2 commit 15f1bcc
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions pageserver/src/layered_repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::collections::{BTreeSet, HashSet};
use std::convert::TryInto;
use std::fs;
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::ops::Bound::Included;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex, MutexGuard};
use std::time::{Duration, Instant};
use std::{fs, thread};

use crate::layered_repository::inmemory_layer::FreezeLayers;
use crate::relish::*;
Expand Down Expand Up @@ -257,19 +257,6 @@ impl LayeredRepository {
timeline.init_current_logical_size()?;

let timeline = Arc::new(timeline);

// Load any new WAL after the last checkpoint into memory.
info!(
"Loading WAL for timeline {} starting at {}",
timelineid,
timeline.get_last_record_lsn()
);

if cfg!(debug_assertions) {
// check again after wal loading
Self::assert_size_calculation_matches_offloaded(Arc::clone(&timeline));
}

timelines.insert(timelineid, timeline.clone());
Ok(timeline)
}
Expand Down Expand Up @@ -535,24 +522,6 @@ impl LayeredRepository {
totals.elapsed = now.elapsed();
Ok(totals)
}

fn assert_size_calculation_matches(incremental: usize, timeline: &LayeredTimeline) {
match timeline.get_current_logical_size_non_incremental(timeline.get_last_record_lsn()) {
Ok(non_incremental) => {
if incremental != non_incremental {
error!("timeline size calculation diverged, incremental doesn't match non incremental. incremental={} non_incremental={}", incremental, non_incremental);
}
}
Err(e) => error!("failed to calculate non incremental timeline size: {:#}", e),
}
}

fn assert_size_calculation_matches_offloaded(timeline: Arc<LayeredTimeline>) {
let incremental = timeline.get_current_logical_size();
thread::spawn(move || {
Self::assert_size_calculation_matches(incremental, &timeline);
});
}
}

/// Metadata stored on disk for each timeline
Expand Down

0 comments on commit 15f1bcc

Please sign in to comment.