@@ -209,13 +209,15 @@ Status Transaction::ApplyExpireSnapshots(ExpireSnapshots& update) {
209209 if (!result.schema_ids_to_remove .empty ()) {
210210 ctx_->metadata_builder ->RemoveSchemas (std::move (result.schema_ids_to_remove ));
211211 }
212+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
212213 return {};
213214}
214215
215216Status Transaction::ApplySetSnapshot (SetSnapshot& update) {
216217 ICEBERG_ASSIGN_OR_RAISE (auto snapshot_id, update.Apply ());
217218 ctx_->metadata_builder ->SetBranchSnapshot (snapshot_id,
218219 std::string (SnapshotRef::kMainBranch ));
220+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
219221 return {};
220222}
221223
@@ -232,6 +234,7 @@ Status Transaction::ApplyUpdatePartitionSpec(UpdatePartitionSpec& update) {
232234 } else {
233235 ctx_->metadata_builder ->AddPartitionSpec (std::move (result.spec ));
234236 }
237+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
235238 return {};
236239}
237240
@@ -246,6 +249,7 @@ Status Transaction::ApplyUpdateProperties(UpdateProperties& update) {
246249 if (result.format_version .has_value ()) {
247250 ctx_->metadata_builder ->UpgradeFormatVersion (result.format_version .value ());
248251 }
252+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
249253 return {};
250254}
251255
@@ -256,6 +260,7 @@ Status Transaction::ApplyUpdateSchema(UpdateSchema& update) {
256260 if (!result.updated_props .empty ()) {
257261 ctx_->metadata_builder ->SetProperties (result.updated_props );
258262 }
263+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
259264
260265 return {};
261266}
@@ -275,6 +280,7 @@ Status Transaction::ApplyUpdateSnapshot(SnapshotUpdate& update) {
275280 } else {
276281 temp_update->SetBranchSnapshot (std::move (result.snapshot ), result.target_branch );
277282 }
283+ ICEBERG_RETURN_UNEXPECTED (temp_update->CheckErrors ());
278284
279285 if (temp_update->changes ().empty ()) {
280286 // Do not commit if the metadata has not changed. for example, this may happen
@@ -293,6 +299,7 @@ Status Transaction::ApplyUpdateSnapshot(SnapshotUpdate& update) {
293299 if (base.table_uuid .empty ()) {
294300 ctx_->metadata_builder ->AssignUUID ();
295301 }
302+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
296303 return {};
297304}
298305
@@ -304,12 +311,14 @@ Status Transaction::ApplyUpdateSnapshotReference(UpdateSnapshotReference& update
304311 for (auto && [name, ref] : result.to_set ) {
305312 ctx_->metadata_builder ->SetRef (std::move (name), std::move (ref));
306313 }
314+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
307315 return {};
308316}
309317
310318Status Transaction::ApplyUpdateSortOrder (UpdateSortOrder& update) {
311319 ICEBERG_ASSIGN_OR_RAISE (auto sort_order, update.Apply ());
312320 ctx_->metadata_builder ->SetDefaultSortOrder (std::move (sort_order));
321+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
313322 return {};
314323}
315324
@@ -321,6 +330,7 @@ Status Transaction::ApplyUpdateStatistics(UpdateStatistics& update) {
321330 for (const auto & snapshot_id : result.to_remove ) {
322331 ctx_->metadata_builder ->RemoveStatistics (snapshot_id);
323332 }
333+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
324334 return {};
325335}
326336
@@ -332,6 +342,7 @@ Status Transaction::ApplyUpdatePartitionStatistics(UpdatePartitionStatistics& up
332342 for (const auto & snapshot_id : result.to_remove ) {
333343 ctx_->metadata_builder ->RemovePartitionStatistics (snapshot_id);
334344 }
345+ ICEBERG_RETURN_UNEXPECTED (ctx_->metadata_builder ->CheckErrors ());
335346 return {};
336347}
337348
0 commit comments