Copilot commented on code in PR #701:
URL: https://github.com/apache/iceberg-cpp/pull/701#discussion_r3638824796
##########
src/iceberg/update/pending_update.cc:
##########
@@ -54,7 +56,16 @@ Status PendingUpdate::Commit() {
if (!txn) {
return CommitFailed("Transaction has been destroyed");
}
- return txn->Apply(*this);
+ auto metrics_context = MetricsContext::Default();
+ auto commit_metrics = CommitMetrics::Make(*metrics_context);
+ auto timed = commit_metrics->total_duration->Start();
+ auto apply_status = txn->Apply(*this);
+ timed.Stop();
+ ICEBERG_RETURN_UNEXPECTED(apply_status);
+
+ commit_metrics->attempts->Increment(1);
+ txn->ReportPendingSnapshot(*commit_metrics);
+ return {};
Review Comment:
CommitMetrics are created and updated for every PendingUpdate committed
inside a Transaction, but CommitReport is only ever emitted for
snapshot-producing updates (Transaction::pending_snapshot_report_ is only set
in ApplyUpdateSnapshot). For non-snapshot updates this is unnecessary work on
every Commit().
--
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]