@@ -254,7 +254,7 @@ impl<'a> SnapshotProducer<'a> {
254254 if added_data_files. is_empty ( ) {
255255 return Err ( Error :: new (
256256 ErrorKind :: PreconditionFailed ,
257- "No added data files found when write a manifest file" ,
257+ "No added data files found when write an added manifest file" ,
258258 ) ) ;
259259 }
260260
@@ -284,13 +284,30 @@ impl<'a> SnapshotProducer<'a> {
284284 snapshot_produce_operation : & OP ,
285285 manifest_process : & MP ,
286286 ) -> Result < Vec < ManifestFile > > {
287- let added_manifest = self . write_added_manifest ( ) . await ?;
287+ // Assert current snapshot producer contains new content to add to new snapshot.
288+ //
289+ // TODO: Allowing snapshot property setup with no added data files is a workaround.
290+ // We should clean it up after all necessary actions are supported.
291+ // For details, please refer to https://github.com/apache/iceberg-rust/issues/1548
292+ if self . added_data_files . is_empty ( ) && self . snapshot_properties . is_empty ( ) {
293+ return Err ( Error :: new (
294+ ErrorKind :: PreconditionFailed ,
295+ "No added data files or added snapshot properties found when write a manifest file" ,
296+ ) ) ;
297+ }
298+
288299 let existing_manifests = snapshot_produce_operation. existing_manifest ( self ) . await ?;
300+ let mut manifest_files = existing_manifests;
301+
302+ // Process added entries.
303+ if !self . added_data_files . is_empty ( ) {
304+ let added_manifest = self . write_added_manifest ( ) . await ?;
305+ manifest_files. push ( added_manifest) ;
306+ }
307+
289308 // # TODO
290309 // Support process delete entries.
291310
292- let mut manifest_files = vec ! [ added_manifest] ;
293- manifest_files. extend ( existing_manifests) ;
294311 let manifest_files = manifest_process. process_manifests ( self , manifest_files) ;
295312 Ok ( manifest_files)
296313 }
0 commit comments