@@ -142,15 +142,20 @@ pub async fn resolve_parseable_metadata() -> Result<(), ObjectStorageError> {
142
142
Some ( "Could not start the server because metadata not found in storage" )
143
143
}
144
144
EnvChange :: NewStaging => {
145
- put_staging_metadata ( remote_metadata. as_ref ( ) . expect ( "remote metadata exists" ) ) ?;
145
+ let mut remote_meta = remote_metadata. expect ( "remote metadata exists" ) ;
146
+ create_dir_all ( CONFIG . staging_dir ( ) ) ?;
147
+ remote_meta. staging = CONFIG . staging_dir ( ) . canonicalize ( ) ?;
148
+ create_remote_metadata ( & remote_meta) . await ?;
149
+ put_staging_metadata ( & remote_meta) ?;
146
150
147
- // allow new staging directories
148
- return Ok ( ( ) ) ;
151
+ None
149
152
}
150
153
EnvChange :: CreateBoth => {
151
154
let metadata = StorageMetadata :: new ( ) ;
152
155
create_remote_metadata ( & metadata) . await ?;
153
- create_staging_metadata ( & metadata) ?;
156
+ create_dir_all ( CONFIG . staging_dir ( ) ) ?;
157
+ put_staging_metadata ( & metadata) ?;
158
+
154
159
None
155
160
}
156
161
} ;
@@ -173,11 +178,6 @@ async fn create_remote_metadata(metadata: &StorageMetadata) -> Result<(), Object
173
178
client. put_metadata ( metadata) . await
174
179
}
175
180
176
- fn create_staging_metadata ( metadata : & StorageMetadata ) -> std:: io:: Result < ( ) > {
177
- create_dir_all ( CONFIG . staging_dir ( ) ) ?;
178
- put_staging_metadata ( metadata)
179
- }
180
-
181
181
lazy_static ! {
182
182
pub static ref CACHED_FILES : Mutex <FileTable <FileLink >> = Mutex :: new( FileTable :: new( ) ) ;
183
183
pub static ref STORAGE_RUNTIME : Arc <RuntimeEnv > = CONFIG . storage( ) . get_datafusion_runtime( ) ;
0 commit comments