Skip to content

feat(cache): cache metadata location in signer - #334

Merged
twuebi merged 11 commits into
mainfrom
tp/cache-metadata-location
Sep 13, 2024
Merged

twuebi merged 11 commits into
mainfrom
tp/cache-metadata-location

Conversation

@twuebi

@twuebi twuebi commented Sep 10, 2024

Copy link
Copy Markdown
Collaborator

Adds a cache for get_table_metadata by location, we're only caching the table_id since that's not going to change.

partially addresses #6

@twuebi
twuebi force-pushed the tp/cache-metadata-location branch from dc7413a to 5700923 Compare September 10, 2024 16:08
@twuebi
twuebi requested a review from c-thiel September 10, 2024 16:11
@twuebi
twuebi force-pushed the tp/cache-metadata-location branch from c60b3c0 to ff05602 Compare September 11, 2024 07:41
@twuebi
twuebi force-pushed the tp/cache-metadata-location branch from ff05602 to 161a98e Compare September 11, 2024 07:52
@twuebi
twuebi force-pushed the tp/cache-metadata-location branch from 35d0521 to 96ff1c4 Compare September 12, 2024 12:35
@twuebi
twuebi force-pushed the tp/cache-metadata-location branch from 96ff1c4 to 2d67ea4 Compare September 12, 2024 12:47
use anyhow::anyhow;
use std::collections::HashSet;
use std::convert::Infallible;
use std::num::NonZeroUsize;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fancy!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's somewhat of a pain to work with.. there's no const constructor which would be infallible that I found

.r#type("CreateTableLocationRequired".to_string())
.build()
})?
.trim_end_matches('/')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be part of the Postgres impl, but fixed in catalog.rs so that its fixed for all backends.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also adding it to determine_tabular_location, it's also here since most tests do not create tables via the catalog but instead directly on postgres impl level

pub(crate) async fn get_table_metadata_by_s3_location(
pub(crate) async fn get_table_id_by_s3_location(
warehouse_id: WarehouseIdent,
location: &str,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change the type to configs::Location (basically URL?).
I think just by splitting location at :// it is not guaranteed to be a valid URL. Location type is a bit more typesafe and allows easier access to protocol and (sub)-paths by path_segemnts.
We might need to expose more attributes of Location.
Maybe having sublocation part of configs.Location makes sense? Then we could share it across impls again.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to use location instead

@twuebi
twuebi merged commit fa0863c into main Sep 13, 2024
@twuebi
twuebi deleted the tp/cache-metadata-location branch September 13, 2024 20:56
@c-thiel c-thiel mentioned this pull request Sep 13, 2024
@twuebi twuebi mentioned this pull request Sep 18, 2024
This was referenced Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants