Skip to content

Commit

Permalink
Add additional trace logging during mount (#937)
Browse files Browse the repository at this point in the history
* Add additional trace logging during mount

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>

* Remove old block used to gate SSE behind compile-time flag

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>

---------

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
  • Loading branch information
dannycjones committed Jul 10, 2024
1 parent 5855859 commit 278c429
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
11 changes: 8 additions & 3 deletions mountpoint-s3/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,12 @@ where

match session {
Ok(session) => {
tracing::trace!("FUSE session created OK, sending message back to parent process");
pipe_file
.write(&status_success)
.context("Failed to write data to the pipe")?;
drop(pipe_file);
tracing::trace!("message sent back to parent process");

// Logging is set up and the mount succeeded, so we can hang up
// stdin/out/err now to cleanly daemonize ourselves
Expand All @@ -490,9 +492,11 @@ where
session.join().context("failed to join session")?;
}
Err(e) => {
tracing::trace!("FUSE session creation failed, sending message back to parent process");
pipe_file
.write(&status_failure)
.context("Failed to write data to the pipe")?;
tracing::trace!("message sent back to parent process");
return Err(anyhow!(e));
}
}
Expand Down Expand Up @@ -653,9 +657,7 @@ where
tracing::debug!("{:?}", args);

validate_mount_point(&args.mount_point)?;
{
validate_sse_args(args.sse.as_deref(), args.sse_kms_key_id.as_deref())?;
}
validate_sse_args(args.sse.as_deref(), args.sse_kms_key_id.as_deref())?;

let (client, runtime, s3_personality) = client_builder(&args)?;

Expand Down Expand Up @@ -717,6 +719,7 @@ where
}
metadata_cache_ttl = TimeToLive::Minimal;
}
tracing::trace!("using metadata TTL setting {metadata_cache_ttl:?}");
filesystem_config.cache_config = CacheConfig::new(metadata_cache_ttl);

if let Some(path) = args.cache {
Expand Down Expand Up @@ -780,7 +783,9 @@ where
Client: ObjectClient + Send + Sync + 'static,
Prefetcher: Prefetch + Send + Sync + 'static,
{
tracing::trace!(?filesystem_config, "creating file system");
let fs = S3FuseFilesystem::new(client, prefetcher, bucket_name, prefix, filesystem_config);
tracing::debug!(?fuse_session_config, "creating fuse session");
let session = Session::new(fs, &fuse_session_config.mount_point, &fuse_session_config.options)
.context("Failed to create FUSE session")?;
let session = FuseSession::new(session, fuse_session_config.max_threads).context("Failed to start FUSE session")?;
Expand Down
15 changes: 14 additions & 1 deletion mountpoint-s3/src/fuse/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ impl FuseSession {
) -> anyhow::Result<Self> {
assert!(max_worker_threads > 0);

tracing::trace!(
max_worker_threads,
"creating worker thread pool for handling FUSE requests",
);

let unmounter = session.unmount_callable();

let (tx, rx) = mpsc::channel();
Expand All @@ -37,10 +42,14 @@ impl FuseSession {

// A thread that waits for all workers to exit and then sends a message on the channel
let _waiter = {
const FUSE_WORKER_WAITER_THREAD_NAME: &str = "fuse-worker-waiter";
let tx = tx.clone();
thread::Builder::new()
.name("fuse-worker-waiter".to_owned())
.name(FUSE_WORKER_WAITER_THREAD_NAME.to_owned())
.spawn(move || {
tracing::trace!(
"{FUSE_WORKER_WAITER_THREAD_NAME} thread now waiting for all worker threads to exit",
);
while let Ok(thd) = workers_rx.recv() {
let thread_name = thd.thread().name().map(ToOwned::to_owned);
match thd.join() {
Expand Down Expand Up @@ -137,6 +146,8 @@ impl<W: Work> WorkerPool<W> {
fn start(work: W, workers: Sender<JoinHandle<W::Result>>, max_workers: usize) -> anyhow::Result<()> {
assert!(max_workers > 0);

tracing::trace!(max_workers, "worker pool starting");

let state = WorkerPoolState {
work,
worker_count: AtomicUsize::new(0),
Expand All @@ -150,6 +161,8 @@ impl<W: Work> WorkerPool<W> {
if !pool.try_add_worker()? {
unreachable!("should always create at least 1 worker (max_workers > 0)");
}

tracing::trace!("worker pool started OK");
Ok(())
}

Expand Down

0 comments on commit 278c429

Please sign in to comment.