From 45124856b1c8504b0573d6e3f273cce53fb497a4 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 19 Jan 2022 17:29:14 +0200 Subject: [PATCH] Better S3 remote storage logging --- pageserver/src/remote_storage.rs | 35 ++++++++++++++---------- pageserver/src/remote_storage/rust_s3.rs | 6 ++++ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/pageserver/src/remote_storage.rs b/pageserver/src/remote_storage.rs index 6c948aaeb2..ba57027823 100644 --- a/pageserver/src/remote_storage.rs +++ b/pageserver/src/remote_storage.rs @@ -138,20 +138,27 @@ pub fn start_local_timeline_sync( match &config.remote_storage_config { Some(storage_config) => match &storage_config.storage { - RemoteStorageKind::LocalFs(root) => storage_sync::spawn_storage_sync_thread( - config, - local_timeline_files, - LocalFs::new(root.clone(), &config.workdir)?, - storage_config.max_concurrent_sync, - storage_config.max_sync_errors, - ), - RemoteStorageKind::AwsS3(s3_config) => storage_sync::spawn_storage_sync_thread( - config, - local_timeline_files, - S3::new(s3_config, &config.workdir)?, - storage_config.max_concurrent_sync, - storage_config.max_sync_errors, - ), + RemoteStorageKind::LocalFs(root) => { + info!("Using fs root '{}' as a remote storage", root.display()); + storage_sync::spawn_storage_sync_thread( + config, + local_timeline_files, + LocalFs::new(root.clone(), &config.workdir)?, + storage_config.max_concurrent_sync, + storage_config.max_sync_errors, + ) + }, + RemoteStorageKind::AwsS3(s3_config) => { + info!("Using s3 bucket '{}' in region '{}' as a remote storage, prefix in bucket: '{:?}', bucket endpoint: '{:?}'", + s3_config.bucket_name, s3_config.bucket_region, s3_config.prefix_in_bucket, s3_config.endpoint); + storage_sync::spawn_storage_sync_thread( + config, + local_timeline_files, + S3::new(s3_config, &config.workdir)?, + storage_config.max_concurrent_sync, + storage_config.max_sync_errors, + ) + }, } .context("Failed to spawn the storage sync thread"), None => { diff --git a/pageserver/src/remote_storage/rust_s3.rs b/pageserver/src/remote_storage/rust_s3.rs index 757ff8ffe9..527bdf48ff 100644 --- a/pageserver/src/remote_storage/rust_s3.rs +++ b/pageserver/src/remote_storage/rust_s3.rs @@ -9,6 +9,7 @@ use std::path::{Path, PathBuf}; use anyhow::Context; use s3::{bucket::Bucket, creds::Credentials, region::Region}; use tokio::io::{self, AsyncWriteExt}; +use tracing::debug; use crate::{ config::S3Config, @@ -58,6 +59,10 @@ pub struct S3 { impl S3 { /// Creates the storage, errors if incorrect AWS S3 configuration provided. pub fn new(aws_config: &S3Config, pageserver_workdir: &'static Path) -> anyhow::Result { + debug!( + "Creating s3 remote storage around bucket {}", + aws_config.bucket_name + ); let region = match aws_config.endpoint.clone() { Some(endpoint) => Region::Custom { endpoint, @@ -68,6 +73,7 @@ impl S3 { .parse::() .context("Failed to parse the s3 region from config")?, }; + let credentials = Credentials::new( aws_config.access_key_id.as_deref(), aws_config.secret_access_key.as_deref(),