Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 11 commits into from
Sep 13, 2024
Merged

Conversation

twuebi
Copy link
Contributor

@twuebi twuebi commented Sep 10, 2024

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

crates/iceberg-catalog/src/catalog/s3_signer/sign.rs Outdated Show resolved Hide resolved
@@ -2,6 +2,7 @@
use anyhow::anyhow;
use std::collections::HashSet;
use std::convert::Infallible;
use std::num::NonZeroUsize;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fancy!

Copy link
Contributor 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
Contributor

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
Contributor 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

@@ -334,79 +337,84 @@ pub(crate) async fn get_table_metadata_by_id(
})
}

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
Contributor

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
Contributor 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
18 checks passed
@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
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