Skip to content

Commit 95e16da

Browse files
authored
Set fallback region (#797)
* Set fallback region Closes #793 I confirmed that this works 1. by deleting my default region in `.aws/config`. 2. Creating a new repo on tigris. This action fails without this change. * lint fix
1 parent aa0a550 commit 95e16da

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

design-docs/009-tigris-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ By default Icechunk should be perfectly safe and consistent, even at the price o
3737
* All writes and reads use the `X-Tigris-Regions` header set to the initialized region.
3838
* All reads use the `Cache-Control:no-cache` header.
3939
* This will make Icechunk safe, but it will direct all writes and reads to a single region, which may cause performance degradation.
40-
40+
4141
* Setting a `Storage` configuration variable to "`unsafe_read_from_local_region: True`":
4242
* Region is ignored if passed
4343
* No `X-Tigris-Regions` header is passed.

icechunk/src/storage/s3.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ pub async fn mk_client(config: &S3Options, credentials: S3Credentials) -> Client
7878
.unwrap_or_else(RegionProviderChain::default_provider);
7979

8080
let endpoint = config.endpoint_url.clone();
81+
let region = if endpoint.is_some() {
82+
// GH793, the S3 SDK requires a region even though it may not make sense
83+
// for S3-compatible object stores like Tigris or Ceph.
84+
// So we set a fake region, using the `endpoint_url` as a sign that
85+
// we are not talking to real S3
86+
region.or_else(Region::new("region-was-not-set"))
87+
} else {
88+
region
89+
};
90+
8191
#[allow(clippy::unwrap_used)]
8292
let app_name = AppName::new("icechunk").unwrap();
8393
let mut aws_config = aws_config::defaults(BehaviorVersion::v2024_03_28())

0 commit comments

Comments
 (0)