Skip to content

Commit

Permalink
Do not ensure ensure_main_branch_not_removed
Browse files Browse the repository at this point in the history
  • Loading branch information
c-thiel committed Nov 21, 2024
1 parent f7b4fcf commit dd06a8d
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions crates/iceberg/src/spec/table_metadata_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,6 @@ impl TableMetadataBuilder {
.with_fields(sort_order.fields)
.build(&schema)?;

self.ensure_main_branch_not_removed()?;
self.update_snapshot_log()?;
self.metadata.try_normalize()?;

Expand All @@ -874,23 +873,6 @@ impl TableMetadataBuilder {
})
}

fn ensure_main_branch_not_removed(&self) -> Result<()> {
if self.metadata.current_snapshot_id.is_none() {
let has_removed_main_branch = self
.changes
.iter()
.any(|update| matches!(update, TableUpdate::RemoveSnapshotRef { ref_name } if ref_name == MAIN_BRANCH));
if has_removed_main_branch {
return Err(Error::new(
ErrorKind::DataInvalid,
"Cannot remove main branch",
));
}
}

Ok(())
}

fn expire_metadata_log(&mut self) -> Vec<MetadataLog> {
let max_size = self
.metadata
Expand Down

0 comments on commit dd06a8d

Please sign in to comment.