@@ -22,6 +22,7 @@ use lance_core::utils::tokio::get_num_compute_intensive_cpus;
22
22
use object_store:: aws:: {
23
23
AmazonS3ConfigKey , AwsCredential as ObjectStoreAwsCredential , AwsCredentialProvider ,
24
24
} ;
25
+ use object_store:: azure:: MicrosoftAzureBuilder ;
25
26
use object_store:: gcp:: { GcpCredential , GoogleCloudStorageBuilder } ;
26
27
use object_store:: {
27
28
aws:: AmazonS3Builder , azure:: AzureConfigKey , gcp:: GoogleConfigKey , local:: LocalFileSystem ,
@@ -729,6 +730,12 @@ impl StorageOptions {
729
730
if let Ok ( value) = std:: env:: var ( "AWS_ALLOW_HTTP" ) {
730
731
options. insert ( "allow_http" . into ( ) , value) ;
731
732
}
733
+ if let Ok ( value) = std:: env:: var ( "OBJECT_STORE_CLIENT_MAX_RETRIES" ) {
734
+ options. insert ( "client_max_retries" . into ( ) , value) ;
735
+ }
736
+ if let Ok ( value) = std:: env:: var ( "OBJECT_STORE_CLIENT_RETRY_TIMEOUT" ) {
737
+ options. insert ( "client_retry_timeout" . into ( ) , value) ;
738
+ }
732
739
Self ( options)
733
740
}
734
741
@@ -790,7 +797,7 @@ impl StorageOptions {
790
797
. unwrap_or ( 3 )
791
798
}
792
799
793
- /// Max retry times to set in RetryConfig for s3 client
800
+ /// Max retry times to set in RetryConfig for object store client
794
801
pub fn client_max_retries ( & self ) -> usize {
795
802
self . 0
796
803
. iter ( )
@@ -799,7 +806,7 @@ impl StorageOptions {
799
806
. unwrap_or ( 10 )
800
807
}
801
808
802
- /// Seconds of timeout to set in RetryConfig for s3 client
809
+ /// Seconds of timeout to set in RetryConfig for object store client
803
810
pub fn client_retry_timeout ( & self ) -> u64 {
804
811
self . 0
805
812
. iter ( )
@@ -865,6 +872,13 @@ async fn configure_store(
865
872
// block size where we don't see a latency penalty.
866
873
let file_block_size = options. block_size . unwrap_or ( 4 * 1024 ) ;
867
874
let cloud_block_size = options. block_size . unwrap_or ( 64 * 1024 ) ;
875
+ let max_retries = storage_options. client_max_retries ( ) ;
876
+ let retry_timeout = storage_options. client_retry_timeout ( ) ;
877
+ let retry_config = RetryConfig {
878
+ backoff : Default :: default ( ) ,
879
+ max_retries,
880
+ retry_timeout : Duration :: from_secs ( retry_timeout) ,
881
+ } ;
868
882
match url. scheme ( ) {
869
883
"s3" | "s3+ddb" => {
870
884
storage_options. with_env_s3 ( ) ;
@@ -877,13 +891,6 @@ async fn configure_store(
877
891
// });
878
892
// }
879
893
880
- let max_retries = storage_options. client_max_retries ( ) ;
881
- let retry_timeout = storage_options. client_retry_timeout ( ) ;
882
- let retry_config = RetryConfig {
883
- backoff : Default :: default ( ) ,
884
- max_retries,
885
- retry_timeout : Duration :: from_secs ( retry_timeout) ,
886
- } ;
887
894
let mut storage_options = storage_options. as_s3_options ( ) ;
888
895
let region = resolve_s3_region ( & url, & storage_options) . await ?;
889
896
let ( aws_creds, region) = build_aws_credential (
@@ -938,7 +945,9 @@ async fn configure_store(
938
945
}
939
946
"gs" => {
940
947
storage_options. with_env_gcs ( ) ;
941
- let mut builder = GoogleCloudStorageBuilder :: new ( ) . with_url ( url. as_ref ( ) ) ;
948
+ let mut builder = GoogleCloudStorageBuilder :: new ( )
949
+ . with_url ( url. as_ref ( ) )
950
+ . with_retry ( retry_config) ;
942
951
for ( key, value) in storage_options. as_gcs_options ( ) {
943
952
builder = builder. with_config ( key, value) ;
944
953
}
@@ -965,7 +974,13 @@ async fn configure_store(
965
974
}
966
975
"az" => {
967
976
storage_options. with_env_azure ( ) ;
968
- let ( store, _) = parse_url_opts ( & url, storage_options. as_azure_options ( ) ) ?;
977
+ let mut builder = MicrosoftAzureBuilder :: new ( )
978
+ . with_url ( url. as_ref ( ) )
979
+ . with_retry ( retry_config) ;
980
+ for ( key, value) in storage_options. as_azure_options ( ) {
981
+ builder = builder. with_config ( key, value) ;
982
+ }
983
+ let store = builder. build ( ) ?;
969
984
let store = Arc :: new ( store) . traced ( ) ;
970
985
971
986
Ok ( ObjectStore {
0 commit comments