xanderbailey commented on code in PR #2821:
URL: https://github.com/apache/iceberg-rust/pull/2821#discussion_r3637818593
##########
crates/iceberg/src/transaction/append.rs:
##########
@@ -387,6 +387,81 @@ mod tests {
.collect()
}
+ #[tokio::test]
+ async fn test_fast_append_writes_encrypted_manifest() {
+ let table = make_encrypted_table().await;
+ assert!(
+ table.encryption_manager().is_some(),
+ "fixture table should have an EncryptionManager"
+ );
+
+ let new_file = DataFileBuilder::default()
+ .content(DataContentType::Data)
+ .file_path("memory:///table/data/00000.parquet".to_string())
+ .file_format(DataFileFormat::Parquet)
+ .partition(Struct::empty())
+ .record_count(100)
+ .file_size_in_bytes(4096)
+ .partition_spec_id(table.metadata().default_partition_spec_id())
+ .build()
+ .unwrap();
+
+ let tx = Transaction::new(&table);
+ let action = tx.fast_append().add_data_files(vec![new_file]);
+ let mut action_commit = Arc::new(action).commit(&table).await.unwrap();
+ let updates = action_commit.take_updates();
+
+ let new_snapshot: SnapshotRef = updates
+ .iter()
+ .find_map(|u| match u {
+ TableUpdate::AddSnapshot { snapshot } =>
Some(SnapshotRef::new(snapshot.clone())),
+ _ => None,
+ })
+ .expect("a fast append should emit an AddSnapshot update");
+
+ let manifest_list = table
+ .manifest_list_reader(&new_snapshot)
+ .load()
+ .await
+ .unwrap();
+ let manifest_file = manifest_list
+ .entries()
+ .iter()
+ .find(|m| m.added_files_count.unwrap_or(0) > 0)
+ .expect("new snapshot should carry the appended data manifest");
+
+ // The manifest list entry must carry decodable key metadata.
+ let key_metadata_bytes = manifest_file
Review Comment:
Good idea — filed https://github.com/apache/iceberg-rust/issues/2881 to
track adding a `ManifestReader` symmetric to `ManifestWriter` so we don't
repeat the read/decrypt/parse dance. Left a `TODO(#2881)` in the test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]