@@ -182,7 +182,7 @@ impl S3LogDir {
182182 pub fn history_server_spark_config ( & self ) -> Result < BTreeMap < String , String > , Error > {
183183 let connection = & self . bucket . connection ;
184184
185- Ok ( BTreeMap :: from ( [
185+ let mut config = BTreeMap :: from ( [
186186 ( "spark.history.fs.logDirectory" . to_string ( ) , self . url ( ) ) ,
187187 (
188188 "spark.hadoop.fs.s3a.endpoint" . to_string ( ) ,
@@ -192,7 +192,16 @@ impl S3LogDir {
192192 "spark.hadoop.fs.s3a.path.style.access" . to_string ( ) ,
193193 ( connection. access_style == S3AccessStyle :: Path ) . to_string ( ) ,
194194 ) ,
195- ] ) )
195+ ] ) ;
196+
197+ if let Some ( region_name) = connection. region . name ( ) {
198+ config. insert (
199+ "spark.hadoop.fs.s3a.endpoint.region" . to_string ( ) ,
200+ region_name. to_string ( ) ,
201+ ) ;
202+ } ;
203+
204+ Ok ( config)
196205 }
197206
198207 pub fn application_spark_config ( & self ) -> Result < BTreeMap < String , String > , Error > {
@@ -211,6 +220,12 @@ impl S3LogDir {
211220 format ! ( "spark.hadoop.fs.s3a.bucket.{bucket_name}.path.style.access" ) ,
212221 ( connection. access_style == S3AccessStyle :: Path ) . to_string ( ) ,
213222 ) ;
223+ if let Some ( region_name) = connection. region . name ( ) {
224+ result. insert (
225+ format ! ( "spark.hadoop.fs.s3a.bucket.{bucket_name}.region" ) ,
226+ region_name. to_string ( ) ,
227+ ) ;
228+ } ;
214229 if let Some ( secret_dir) = self . credentials_mount_path ( ) {
215230 // We don't use the credentials at all here but assume they are available
216231 result. insert (
0 commit comments