comments, other cleanup

This commit is contained in:
Heikki Linnakangas
2022-03-09 15:51:57 +02:00
parent 2896d35a8b
commit 92d1322cd5
2 changed files with 18 additions and 13 deletions

View File

@@ -1986,8 +1986,8 @@ mod tests {
}
//
// Insert a bunch of key-value pairs with increasing keys, checkpoint,
// repeat 100 times.
// Insert 1000 key-value pairs with increasing keys, checkpoint,
// repeat 50 times.
//
#[test]
fn test_bulk_insert() -> Result<()> {
@@ -2042,6 +2042,8 @@ mod tests {
let mut parts = KeyPartitioning::new();
// Track when each page was last modified. Used to assert that
// a read sees the latest page version.
let mut updated = [Lsn(0); NUM_KEYS];
let mut lsn = Lsn(0);
@@ -2081,6 +2083,7 @@ mod tests {
updated[blknum] = lsn;
}
// Read all the blocks
for (blknum, last_lsn) in updated.iter().enumerate() {
test_key.field6 = blknum as u32;
assert_eq!(
@@ -2088,8 +2091,9 @@ mod tests {
TEST_IMG(&format!("{} at {}", blknum, last_lsn))
);
}
println!("checkpointing {}", lsn);
// Perform a cycle of checkpoint, compaction, and GC
println!("checkpointing {}", lsn);
let cutoff = tline.get_last_record_lsn();
tline.update_gc_info(Vec::new(), cutoff);
tline.checkpoint(CheckpointConfig::Forced)?;

View File

@@ -139,16 +139,6 @@ impl Key {
field6: u32::from_str_radix(&s[28..36], 16)?,
})
}
pub fn to_prefix_128(&self) -> u128 {
assert!(self.field1 & 0xf0 == 0);
(self.field1 as u128) << 124
| (self.field2 as u128) << 92
| (self.field3 as u128) << 60
| (self.field4 as u128) << 28
| (self.field5 as u128) << 20
| (self.field6 as u128) >> 12
}
}
//
@@ -365,6 +355,17 @@ pub trait Timeline: Send + Sync {
/// know anything about them here in the repository.
fn checkpoint(&self, cconf: CheckpointConfig) -> Result<()>;
///
/// Tell the implementation how the keyspace should be partitioned.
///
/// FIXME: This is quite a hack. The code in pgdatadir_mapping.rs knows
/// which keys exist and what is the logical grouping of them. That's why
/// the code there (and in keyspace.rs) decides the partitioning, not the
/// layered_repository.rs implementation. That's a layering violation:
/// the Repository implementation ought to be responsible for the physical
/// layout, but currently it's more convenient to do it in pgdatadir_mapping.rs
/// rather than in layered_repository.rs.
///
fn hint_partitioning(&self, partitioning: KeyPartitioning) -> Result<()>;
///