klsince commented on code in PR #15334: URL: https://github.com/apache/pinot/pull/15334#discussion_r2017196015
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java: ########## @@ -849,17 +849,29 @@ public void takeSnapshot() { _logger.info("Skip taking snapshot because metadata manager is already stopped"); return; } - _snapshotLock.writeLock().lock(); + try { long startTime = System.currentTimeMillis(); - doTakeSnapshot(); - long duration = System.currentTimeMillis() - startTime; - _serverMetrics.addTimedTableValue(_tableNameWithType, ServerTimer.UPSERT_SNAPSHOT_TIME_MS, duration, - TimeUnit.MILLISECONDS); - } catch (Exception e) { - _logger.warn("Caught exception while taking snapshot", e); + while (!_snapshotLock.writeLock().tryLock(5, TimeUnit.MINUTES)) { + _logger.warn("Unable to acquire snapshotLock.writeLock in: {} ms. Retrying.", + System.currentTimeMillis() - startTime); Review Comment: looks like we can wrap this loop in a helper method to reduce the code changes ``` tryLockWithLogs(_snapshotLock.writeLock(), 5min); ... tryLockWithLogs(lock, interval) { try{ while(lock.tryLock(interval)) { log.warn(); } } catch (InterruptedException e) { ... } } ``` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org