This commit is contained in:
Bojan Serafimov
2022-04-14 13:57:44 -04:00
parent 735145571f
commit 7482d3df70
5 changed files with 16 additions and 13 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
//!
//! A handy tool for debugging, that's all.
use anyhow::Result;
use clap::{App, Arg};
use clap::{Arg, Command};
use pageserver::layered_repository::dump_layerfile_from_path;
use pageserver::page_cache;
use pageserver::virtual_file;
@@ -10,7 +10,7 @@ use std::path::PathBuf;
use zenith_utils::GIT_VERSION;
fn main() -> Result<()> {
let arg_matches = App::new("Zenith dump_layerfile utility")
let arg_matches = Command::new("Zenith dump_layerfile utility")
.about("Dump contents of one layer file, for debugging")
.version(GIT_VERSION)
.arg(
+5 -5
View File
@@ -4,7 +4,7 @@
use std::{collections::BTreeSet, path::Path};
use anyhow::{bail, ensure, Context};
use clap::{App, Arg};
use clap::{Arg, Command};
use pageserver::{
layered_repository::metadata::{TimelineMetadata, METADATA_FILE_NAME},
remote_storage::compression,
@@ -23,10 +23,10 @@ const SOURCE_DIRECTORY_ARG_NAME: &str = "source_directory";
#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
let arg_matches = App::new("pageserver zst blob [un]compressor utility")
let arg_matches = Command::new("pageserver zst blob [un]compressor utility")
.version(GIT_VERSION)
.subcommands(vec![
App::new(LIST_SUBCOMMAND)
Command::new(LIST_SUBCOMMAND)
.about("List the archive contents")
.arg(
Arg::new(ARCHIVE_ARG_NAME)
@@ -34,7 +34,7 @@ async fn main() -> anyhow::Result<()> {
.takes_value(true)
.help("An archive to list the contents of"),
),
App::new(EXTRACT_SUBCOMMAND)
Command::new(EXTRACT_SUBCOMMAND)
.about("Extracts the archive into the directory")
.arg(
Arg::new(ARCHIVE_ARG_NAME)
@@ -48,7 +48,7 @@ async fn main() -> anyhow::Result<()> {
.takes_value(true)
.help("A directory to extract the archive into. Optional, will use the current directory if not specified"),
),
App::new(CREATE_SUBCOMMAND)
Command::new(CREATE_SUBCOMMAND)
.about("Creates an archive with the contents of a directory (only the first level files are taken, metadata file has to be present in the same directory)")
.arg(
Arg::new(SOURCE_DIRECTORY_ARG_NAME)
+4 -4
View File
@@ -6,7 +6,7 @@ use bytes::{BufMut, BytesMut};
use clap::{Parser, Subcommand};
use pageserver::wal_metadata::{Page, WalEntryMetadata};
use std::fs::File;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::time::Instant;
use std::{
collections::HashSet,
@@ -120,7 +120,7 @@ struct Metadata {
impl Metadata {
/// Construct metadata object from wal_metadata file emitted by pageserver
fn build(wal_metadata_path: &PathBuf) -> Result<Metadata> {
fn build(wal_metadata_path: &Path) -> Result<Metadata> {
let wal_metadata_file = File::open(wal_metadata_path).expect("error opening wal_metadata");
let wal_metadata: Vec<WalEntryMetadata> = BufReader::new(wal_metadata_file)
.lines()
@@ -145,7 +145,7 @@ impl Metadata {
}
/// Print results in a format readable by benchmark_fixture.py
fn report_latency(&self, latencies: &Vec<Duration>) -> Result<()> {
fn report_latency(&self, latencies: &[Duration]) -> Result<()> {
println!("test_param num_pages {}", self.affected_pages.len());
println!("test_param num_wal_entries {}", self.wal_metadata.len());
println!("test_param total_wal_size {} bytes", self.total_wal_size);
@@ -174,7 +174,7 @@ async fn test_latest_pages(api: &mut PagestreamApi, metadata: &Metadata) -> Resu
let mut latencies: Vec<Duration> = vec![];
for page in &metadata.affected_pages {
let start = Instant::now();
let _page_bytes = api.get_page(&metadata.latest_lsn, &page, true).await?;
let _page_bytes = api.get_page(&metadata.latest_lsn, page, true).await?;
let duration = start.elapsed();
latencies.push(duration);
+2 -2
View File
@@ -2,7 +2,7 @@
//!
//! A handy tool for debugging, that's all.
use anyhow::Result;
use clap::{App, Arg};
use clap::{Arg, Command};
use pageserver::layered_repository::metadata::TimelineMetadata;
use std::path::PathBuf;
use std::str::FromStr;
@@ -10,7 +10,7 @@ use zenith_utils::lsn::Lsn;
use zenith_utils::GIT_VERSION;
fn main() -> Result<()> {
let arg_matches = App::new("Zenith update metadata utility")
let arg_matches = Command::new("Zenith update metadata utility")
.about("Dump or update metadata file")
.version(GIT_VERSION)
.arg(
+3
View File
@@ -617,6 +617,7 @@ impl PageServerConf {
auth_type: AuthType::Trust,
auth_validation_public_key_path: None,
remote_storage_config: None,
emit_wal_metadata: false,
}
}
}
@@ -725,6 +726,7 @@ id = 10
auth_type: AuthType::Trust,
auth_validation_public_key_path: None,
remote_storage_config: None,
emit_wal_metadata: false,
},
"Correct defaults should be used when no config values are provided"
);
@@ -770,6 +772,7 @@ id = 10
auth_type: AuthType::Trust,
auth_validation_public_key_path: None,
remote_storage_config: None,
emit_wal_metadata: false,
},
"Should be able to parse all basic config values correctly"
);