Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rust/cubestore/cubestore/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ pub enum FileStoreProvider {
region: String,
bucket_name: String,
sub_path: Option<String>,
endpoint: Option<String>,
},
GCS {
bucket_name: String,
Expand Down Expand Up @@ -1303,6 +1304,7 @@ impl Config {
"CUBESTORE_S3_REGION required when CUBESTORE_S3_BUCKET is set",
),
sub_path: env::var("CUBESTORE_S3_SUB_PATH").ok(),
endpoint: env::var("CUBESTORE_S3_ENDPOINT").ok(),
}
} else if let Ok(bucket_name) = env::var("CUBESTORE_MINIO_BUCKET") {
FileStoreProvider::MINIO {
Expand Down Expand Up @@ -1946,15 +1948,18 @@ impl Config {
region,
bucket_name,
sub_path,
endpoint,
} => {
let data_dir = self.config_obj.data_dir.clone();
let region = region.to_string();
let bucket_name = bucket_name.to_string();
let sub_path = sub_path.clone();
let endpoint = endpoint.clone();
self.injector
.register("original_remote_fs", async move |_| {
let arc: Arc<dyn DIService> =
S3RemoteFs::new(data_dir, region, bucket_name, sub_path).unwrap();
S3RemoteFs::new(data_dir, region, bucket_name, sub_path, endpoint)
.unwrap();
arc
})
.await;
Expand Down
2 changes: 2 additions & 0 deletions rust/cubestore/cubestore/src/remotefs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ mod tests {
region.clone(),
bucket_name.clone(),
None,
None,
)?;

let name_maker = NameMaker::new(Uuid::new_v4().to_string());
Expand All @@ -699,6 +700,7 @@ mod tests {
region.clone(),
bucket_name.clone(),
Some("remotefs_test_subpathdir".to_string()),
None,
)
.unwrap();

Expand Down
23 changes: 16 additions & 7 deletions rust/cubestore/cubestore/src/remotefs/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl S3RemoteFs {
region: String,
bucket_name: String,
sub_path: Option<String>,
endpoint: Option<String>,
) -> Result<Arc<Self>, CubeError> {
// Incorrect naming for ENV variables...
let access_key = env::var("CUBESTORE_AWS_ACCESS_KEY_ID").ok();
Expand All @@ -67,13 +68,21 @@ impl S3RemoteFs {
err.to_string()
))
})?;
let region = region.parse::<Region>().map_err(|err| {
CubeError::internal(format!(
"Failed to parse Region '{}': {}",
region,
err.to_string()
))
})?;
// If endpoint is provided, create a Custom region to support GovCloud and other non-standard regions
let region = if let Some(ep) = &endpoint {
Region::Custom {
region: region.clone(),
endpoint: ep.clone(),
}
} else {
region.parse::<Region>().map_err(|err| {
CubeError::internal(format!(
"Failed to parse Region '{}': {}",
region,
err.to_string()
))
})?
};
let bucket = Bucket::new(&bucket_name, region.clone(), credentials)?;
let fs = Arc::new(Self {
dir,
Expand Down
4 changes: 4 additions & 0 deletions rust/cubestore/cubestore/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3501,6 +3501,7 @@ mod tests {
region: "us-west-2".to_string(),
bucket_name: "cube-store-ci-test".to_string(),
sub_path: Some("high_frequency_inserts_s3".to_string()),
endpoint: None,
};
c.select_workers = vec!["127.0.0.1:4306".to_string()];
c
Expand All @@ -3516,6 +3517,7 @@ mod tests {
region: "us-west-2".to_string(),
bucket_name: "cube-store-ci-test".to_string(),
sub_path: Some("high_frequency_inserts_s3".to_string()),
endpoint: None,
};
c
})
Expand Down Expand Up @@ -3989,6 +3991,7 @@ mod tests {
region: "us-west-2".to_string(),
bucket_name: "cube-store-ci-test".to_string(),
sub_path: Some("create_table_with_location_cluster".to_string()),
endpoint: None,
};
c.select_workers = vec!["127.0.0.1:24306".to_string()];
c.metastore_bind_address = Some("127.0.0.1:25312".to_string());
Expand All @@ -4005,6 +4008,7 @@ mod tests {
region: "us-west-2".to_string(),
bucket_name: "cube-store-ci-test".to_string(),
sub_path: Some("create_table_with_location_cluster".to_string()),
endpoint: None,
};
c.metastore_remote_address = Some("127.0.0.1:25312".to_string());
c
Expand Down