Skip to content

Commit 9a69b6c

Browse files
koivunejproblame
andauthored
Demote deletion warning, list files (#4688)
Handle test failures like: ``` AssertionError: assert not ['$ts WARN delete_timeline{tenant_id=X timeline_id=Y}: About to remove 1 files\n'] ``` Instead of logging: ``` WARN delete_timeline{tenant_id=X timeline_id=Y}: Found 1 files not bound to index_file.json, proceeding with their deletion WARN delete_timeline{tenant_id=X timeline_id=Y}: About to remove 1 files ``` For each one operation of timeline deletion, list all unref files with `info!`, and then continue to delete them with the added spice of logging the rare/never happening non-utf8 name with `warn!`. Rationale for `info!` instead of `warn!`: this is a normal operation; like we had mentioned in `test_import.py` -- basically whenever we delete a timeline which is not idle. Rationale for N * (`ìnfo!`|`warn!`): symmetry for the layer deletions; if we could ever need those, we could also need these for layer files which are not yet mentioned in `index_part.json`. --------- Co-authored-by: Christian Schwarz <[email protected]>
1 parent cc82cd1 commit 9a69b6c

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

libs/remote_storage/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ const REMOTE_STORAGE_PREFIX_SEPARATOR: char = '/';
5050
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
5151
pub struct RemotePath(PathBuf);
5252

53+
impl std::fmt::Display for RemotePath {
54+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55+
write!(f, "{}", self.0.display())
56+
}
57+
}
58+
5359
impl RemotePath {
5460
pub fn new(relative_path: &Path) -> anyhow::Result<Self> {
5561
anyhow::ensure!(

pageserver/src/tenant/remote_timeline_client.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,16 @@ impl RemoteTimelineClient {
840840
let remaining: Vec<RemotePath> = remaining
841841
.into_iter()
842842
.filter(|p| p.object_name() != Some(IndexPart::FILE_NAME))
843+
.inspect(|path| {
844+
if let Some(name) = path.object_name() {
845+
info!(%name, "deleting a file not referenced from index_part.json");
846+
} else {
847+
warn!(%path, "deleting a nameless or non-utf8 object not referenced from index_part.json");
848+
}
849+
})
843850
.collect();
844851

845852
if !remaining.is_empty() {
846-
warn!(
847-
"Found {} files not bound to index_file.json, proceeding with their deletion",
848-
remaining.len()
849-
);
850-
warn!("About to remove {} files", remaining.len());
851853
self.storage_impl.delete_objects(&remaining).await?;
852854
}
853855

@@ -856,7 +858,7 @@ impl RemoteTimelineClient {
856858
debug!("deleting index part");
857859
self.storage_impl.delete(&index_file_path).await?;
858860

859-
info!(deletions_queued, "done deleting, including index_part.json");
861+
info!(prefix=%timeline_storage_path, referenced=deletions_queued, not_referenced=%remaining.len(), "done deleting in timeline prefix, including index_part.json");
860862

861863
Ok(())
862864
}

test_runner/regress/test_import.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ def import_tar(base, wal):
149149
".*WARN.*ignored .* unexpected bytes after the tar archive.*"
150150
)
151151

152-
# NOTE: delete can easily come before upload operations are completed
153-
# https://github.com/neondatabase/neon/issues/4326
154-
env.pageserver.allowed_errors.append(
155-
".*files not bound to index_file.json, proceeding with their deletion.*"
156-
)
157-
158152
timeline_delete_wait_completed(client, tenant, timeline)
159153

160154
# Importing correct backup works

test_runner/regress/test_remote_storage.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,6 @@ def assert_compacted_and_uploads_queued():
598598
".* ERROR .*Error processing HTTP request: InternalServerError\\(timeline is Stopping"
599599
)
600600

601-
env.pageserver.allowed_errors.append(
602-
".*files not bound to index_file.json, proceeding with their deletion.*"
603-
)
604601
timeline_delete_wait_completed(client, tenant_id, timeline_id)
605602

606603
assert not timeline_path.exists()

0 commit comments

Comments
 (0)