list_nonrels() returns elements in arbitrary order.

Remove incorrect comments that say otherwise.
This commit is contained in:
anastasia
2021-08-05 19:38:19 +03:00
committed by lubennikovaav
parent 3ca3394170
commit a5d57ca10b
6 changed files with 10 additions and 14 deletions

View File

@@ -70,9 +70,6 @@ impl<'a> Basebackup<'a> {
}
// Gather non-relational files from object storage pages.
// Iteration is sorted order: all objects of the same type are grouped and traversed
// in key ascending order. For example all pg_xact records precede pg_multixact records and are sorted by block number.
// It allows to easily construct SLRU segments.
for obj in self.timeline.list_nonrels(self.lsn)? {
match obj {
RelishTag::Slru { slru, segno } => {
@@ -96,7 +93,7 @@ impl<'a> Basebackup<'a> {
}
//
// Generate SLRU segment files from repository. Path identifies SLRU kind (pg_xact, pg_multixact/members, ...).
// Generate SLRU segment files from repository.
//
fn add_slru_segment(&mut self, slru: SlruKind, segno: u32) -> anyhow::Result<()> {
let nblocks = self
@@ -116,15 +113,11 @@ impl<'a> Basebackup<'a> {
slru_buf.extend_from_slice(&img);
}
let dir = match slru {
SlruKind::Clog => "pg_xact",
SlruKind::MultiXactMembers => "pg_multixact/members",
SlruKind::MultiXactOffsets => "pg_multixact/offsets",
};
let segname = format!("{}/{:>04X}", dir, segno);
let segname = format!("{}/{:>04X}", slru.to_str(), segno);
let header = new_tar_header(&segname, slru_buf.len() as u64)?;
self.ar.append(&header, slru_buf.as_slice())?;
trace!("Added to basebackup slru {} relsize {}", segname, nblocks);
Ok(())
}

View File

@@ -843,7 +843,7 @@ impl ObjectTimeline {
}
}
} else {
info!("relation {} not found at {}", rel, lsn);
trace!("relation {} not found at {}", rel, lsn);
Ok(None)
}
}

View File

@@ -72,7 +72,6 @@ pub trait ObjectStore: Send + Sync {
/// Iterate through non-rel relishes
///
/// This is used to prepare tarball for new node startup.
/// Returns objects in increasing key-version order.
fn list_nonrels<'a>(&'a self, timelineid: ZTimelineId, lsn: Lsn) -> Result<HashSet<RelishTag>>;
/// Iterate through objects tags. If nonrel_only, then only non-relationa data is iterated.

View File

@@ -195,7 +195,7 @@ pub enum SlruKind {
}
impl SlruKind {
fn to_str(&self) -> &'static str {
pub fn to_str(&self) -> &'static str {
match self {
Self::Clog => "pg_xact",
Self::MultiXactMembers => "pg_multixact/members",

View File

@@ -557,7 +557,10 @@ fn save_xlog_dbase_create(timeline: &dyn Timeline, lsn: Lsn, rec: &XlCreateDatab
num_rels_copied += 1;
}
// Copy relfilemap
// TODO This implementation is very inefficient -
// it scans all non-rels only to find FileNodeMaps
for tag in timeline.list_nonrels(req_lsn)? {
match tag {
RelishTag::FileNodeMap { spcnode, dbnode } => {

View File

@@ -212,6 +212,7 @@ impl ObjectStore for RocksObjectStore {
}
/// Get a list of all distinct NON-relations in timeline
/// that are visible at given lsn.
///
/// TODO: This implementation is very inefficient, it scans
/// through all non-rel page versions in the system. In practice, this