Improve comments

This commit is contained in:
Heikki Linnakangas
2022-03-18 11:45:45 +02:00
parent d383ed4e68
commit 12141523f6
3 changed files with 14 additions and 33 deletions

View File

@@ -1815,8 +1815,13 @@ impl LayeredTimeline {
Ok(())
}
/// Update information about which layer files need to be retained on
/// garbage collection. This is separate from actually performing the GC,
/// and is updated more frequently, so that compaction can remove obsolete
/// page versions more aggressively.
///
/// Garbage collect layer files on a timeline that are no longer needed.
/// TODO: that's wishful thinking, compaction doesn't actually do that
/// currently.
///
/// The caller specifies how much history is needed with the two arguments:
///
@@ -1833,16 +1838,19 @@ impl LayeredTimeline {
/// the latest LSN subtracted by a constant, and doesn't do anything smart
/// to figure out what read-only nodes might actually need.)
///
/// Currently, we don't make any attempt at removing unneeded page versions
/// within a layer file. We can only remove the whole file if it's fully
/// obsolete.
///
fn update_gc_info(&self, retain_lsns: Vec<Lsn>, cutoff: Lsn) {
let mut gc_info = self.gc_info.write().unwrap();
gc_info.retain_lsns = retain_lsns;
gc_info.cutoff = cutoff;
}
///
/// Garbage collect layer files on a timeline that are no longer needed.
///
/// Currently, we don't make any attempt at removing unneeded page versions
/// within a layer file. We can only remove the whole file if it's fully
/// obsolete.
///
fn gc(&self) -> Result<GcResult> {
let now = Instant::now();
let mut result: GcResult = Default::default();

View File

@@ -1,30 +1,3 @@
//!
//! FIXME: relishes are obsolete
//!
//! Zenith stores PostgreSQL relations, and some other files, in the
//! repository. The relations (i.e. tables and indexes) take up most
//! of the space in a typical installation, while the other files are
//! small. We call each relation and other file that is stored in the
//! repository a "relish". It comes from "rel"-ish, as in "kind of a
//! rel", because it covers relations as well as other things that are
//! not relations, but are treated similarly for the purposes of the
//! storage layer.
//!
//! This source file contains the definition of the RelishTag struct,
//! which uniquely identifies a relish.
//!
//! Relishes come in two flavors: blocky and non-blocky. Relations and
//! SLRUs are blocky, that is, they are divided into 8k blocks, and
//! the repository tracks their size. Other relishes are non-blocky:
//! the content of the whole relish is stored as one blob. Block
//! number must be passed as 0 for all operations on a non-blocky
//! relish. The one "block" that you store in a non-blocky relish can
//! have arbitrary size, but they are expected to be small, or you
//! will have performance issues.
//!
//! All relishes are versioned by LSN in the repository.
//!
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt;

View File

@@ -98,7 +98,7 @@ pub enum ThreadKind {
// Thread that handles GC of a tenant
GarbageCollector,
// FIXME
// Thread that flushes frozen in-memory layers to disk
LayerFlushThread,
// Thread for synchronizing pageserver relish data with the remote storage.