manuzhang commented on code in PR #1140:
URL: https://github.com/apache/iceberg-cpp/pull/1140#discussion_r4612795510


##########
src/iceberg/test/transaction_test.cc:
##########
@@ -81,6 +81,29 @@ TEST_F(TransactionTest, CommitTransactionWithPropertyUpdate) 
{
   EXPECT_EQ(props.at("txn.property"), "txn.value");
 }
 
+TEST_F(TransactionTest, BaseMetadataSurvivesTableRefresh) {
+  std::weak_ptr<TableMetadata> original_base = table_->metadata();
+  ICEBERG_UNWRAP_OR_FAIL(auto txn, table_->NewTransaction());
+  ICEBERG_UNWRAP_OR_FAIL(auto update, txn->NewUpdateProperties());
+  update->Set("txn.property", "txn.value");
+  ASSERT_THAT(update->Commit(), IsOk());
+
+  ICEBERG_UNWRAP_OR_FAIL(auto concurrent, catalog_->LoadTable(table_ident_));
+  ICEBERG_UNWRAP_OR_FAIL(auto properties, concurrent->NewUpdateProperties());
+  properties->Set("concurrent.property", "concurrent.value");
+  ASSERT_THAT(properties->Commit(), IsOk());
+  ASSERT_THAT(table_->Refresh(), IsOk());
+
+  // The builder borrows this base even after the shared Table has refreshed.
+  ASSERT_FALSE(original_base.expired());

Review Comment:
   It looks to me this is the crucial check that would fail without the fix. 
The commit and post-commit can still pass without the fix.



-- 
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]

Reply via email to