jsbali commented on code in PR #6502:
URL: https://github.com/apache/hudi/pull/6502#discussion_r961900715
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/SparkRDDWriteClient.java:
##########
@@ -470,8 +471,14 @@ protected void preCommit(HoodieInstant inflightInstant,
HoodieCommitMetadata met
// Create a Hoodie table after startTxn which encapsulated the commits and
files visible.
// Important to create this after the lock to ensure the latest commits
show up in the timeline without need for reload
HoodieTable table = createTable(config, hadoopConf);
- TransactionUtils.resolveWriteConflictIfAny(table,
this.txnManager.getCurrentTransactionOwner(),
- Option.of(metadata), config,
txnManager.getLastCompletedTransactionOwner(), false,
this.pendingInflightAndRequestedInstants);
+ try {
+ TransactionUtils.resolveWriteConflictIfAny(table,
this.txnManager.getCurrentTransactionOwner(),
+ Option.of(metadata), config,
txnManager.getLastCompletedTransactionOwner(), false,
this.pendingInflightAndRequestedInstants);
+ metrics.emitConflictResolutionSuccessful();
Review Comment:
Added
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/LockManager.java:
##########
@@ -64,10 +69,14 @@ public void lock() {
boolean acquired = false;
while (retryCount <= maxRetries) {
try {
+ metrics.startLockApiTimerContext();
acquired =
lockProvider.tryLock(writeConfig.getLockAcquireWaitTimeoutInMs(),
TimeUnit.MILLISECONDS);
if (acquired) {
+ metrics.updateLockAcquiredMetric();
+ metrics.startLockHeldTimerContext();
break;
}
+ metrics.updateLockNotAcquiredMetric();
Review Comment:
Moved it to catch as well. But can't remove it from here as tryLock can
simply return false for some implementations and not throw an exception.
--
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]