From 7482d3df707af818738730b88d7ab1996187b258 Mon Sep 17 00:00:00 2001 From: Bojan Serafimov Date: Thu, 14 Apr 2022 13:57:44 -0400 Subject: [PATCH] Clippy --- pageserver/src/bin/dump_layerfile.rs | 4 ++-- pageserver/src/bin/pageserver_zst.rs | 10 +++++----- pageserver/src/bin/psbench.rs | 8 ++++---- pageserver/src/bin/update_metadata.rs | 4 ++-- pageserver/src/config.rs | 3 +++ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pageserver/src/bin/dump_layerfile.rs b/pageserver/src/bin/dump_layerfile.rs index 7cf39566ac..a9c6f68d33 100644 --- a/pageserver/src/bin/dump_layerfile.rs +++ b/pageserver/src/bin/dump_layerfile.rs @@ -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( diff --git a/pageserver/src/bin/pageserver_zst.rs b/pageserver/src/bin/pageserver_zst.rs index 5b8f8cc3c6..1dc5d55983 100644 --- a/pageserver/src/bin/pageserver_zst.rs +++ b/pageserver/src/bin/pageserver_zst.rs @@ -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) diff --git a/pageserver/src/bin/psbench.rs b/pageserver/src/bin/psbench.rs index 97b331d77b..ea1fe7cdd6 100644 --- a/pageserver/src/bin/psbench.rs +++ b/pageserver/src/bin/psbench.rs @@ -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 { + fn build(wal_metadata_path: &Path) -> Result { let wal_metadata_file = File::open(wal_metadata_path).expect("error opening wal_metadata"); let wal_metadata: Vec = 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) -> 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 = 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); diff --git a/pageserver/src/bin/update_metadata.rs b/pageserver/src/bin/update_metadata.rs index bfbb6179c5..9a7e2c22fa 100644 --- a/pageserver/src/bin/update_metadata.rs +++ b/pageserver/src/bin/update_metadata.rs @@ -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( diff --git a/pageserver/src/config.rs b/pageserver/src/config.rs index d3649fab94..dbd99bdd92 100644 --- a/pageserver/src/config.rs +++ b/pageserver/src/config.rs @@ -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" );