Skip to content

Commit

Permalink
Explain why VirtualFile stores tenant_id and timeline_id as strings (n…
Browse files Browse the repository at this point in the history
…eondatabase#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.
  • Loading branch information
arpad-m committed Aug 8, 2023
1 parent 6661f4f commit 1037a8d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pageserver/src/virtual_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 1037a8d

Please sign in to comment.