From 1037a8ddd98d7f5c7fdf32b475355dc7b4c5c7f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Tue, 8 Aug 2023 23:41:09 +0200 Subject: [PATCH] Explain why VirtualFile stores tenant_id and timeline_id as strings (#4930) ## Problem One might wonder why the code here doesn't use `TimelineId` or `TenantId`. I originally had a refactor to use them, but then discarded it, because converting to strings on each time there is a read or write is wasteful. ## Summary of changes We add some docs explaining why here no `TimelineId` or `TenantId` is being used. --- pageserver/src/virtual_file.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index 65b4363f60..a86b8fa2a6 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -53,6 +53,9 @@ pub struct VirtualFile { pub path: PathBuf, open_options: OpenOptions, + // These are strings becase we only use them for metrics, and those expect strings. + // It makes no sense for us to constantly turn the `TimelineId` and `TenantId` into + // strings. tenant_id: String, timeline_id: String, }