From ba9df27e78b501b679d2ae9000b7f355d91017de Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Fri, 4 Aug 2023 21:03:17 +0300 Subject: [PATCH] fix: silence not found error when removing ephmeral (#4900) We currently cannot drop tenant before removing it's directory, or use Tenant::drop for this. This creates unnecessary or inactionable warnings during detach at least. Silence the most typical, file not found. Log remaining at `error!`. Cc: #2442 --- pageserver/src/tenant/ephemeral_file.rs | 16 +++++++++++----- test_runner/fixtures/neon_fixtures.py | 3 --- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pageserver/src/tenant/ephemeral_file.rs b/pageserver/src/tenant/ephemeral_file.rs index 8d42150824..b088a3b602 100644 --- a/pageserver/src/tenant/ephemeral_file.rs +++ b/pageserver/src/tenant/ephemeral_file.rs @@ -266,11 +266,17 @@ impl Drop for EphemeralFile { // unlink the file let res = std::fs::remove_file(&self.file.path); if let Err(e) = res { - warn!( - "could not remove ephemeral file '{}': {}", - self.file.path.display(), - e - ); + if e.kind() != std::io::ErrorKind::NotFound { + // just never log the not found errors, we cannot do anything for them; on detach + // the tenant directory is already gone. + // + // not found files might also be related to https://github.com/neondatabase/neon/issues/2442 + error!( + "could not remove ephemeral file '{}': {}", + self.file.path.display(), + e + ); + } } } } diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index 2d6ac6e29f..79c1bb055b 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -1504,9 +1504,6 @@ class NeonPageserver(PgProtocol): ".*Error processing HTTP request: Forbidden", # intentional failpoints ".*failpoint ", - # FIXME: there is a race condition between GC and detach, see - # https://github.com/neondatabase/neon/issues/2442 - ".*could not remove ephemeral file.*No such file or directory.*", # FIXME: These need investigation ".*manual_gc.*is_shutdown_requested\\(\\) called in an unexpected task or thread.*", ".*tenant_list: timeline is not found in remote index while it is present in the tenants registry.*",