Yicong-Huang commented on code in PR #5647:
URL: https://github.com/apache/texera/pull/5647#discussion_r3408317014
##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClient.scala:
##########
@@ -69,11 +74,30 @@ object LakeFSStorageClient {
private val branchName: String = "main"
def healthCheck(): Unit = {
- try {
- this.healthCheckApi.healthCheck().execute()
- } catch {
- case e: Exception =>
- throw new RuntimeException(s"Failed to connect to lake fs server:
${e.getMessage}")
+ var attempt = 1
+ while (true) {
+ try {
+ this.healthCheckApi.healthCheck().execute()
+ return
+ } catch {
+ case ie: InterruptedException =>
+ // Restore the interrupt status and fail fast rather than retrying.
+ Thread.currentThread().interrupt()
+ throw new RuntimeException("Interrupted while waiting to retry lake
fs health check", ie)
+ case e: Exception =>
+ if (attempt >= HealthCheckMaxAttempts) {
+ throw new RuntimeException(
+ s"Failed to connect to lake fs server after
$HealthCheckMaxAttempts attempts: ${e.getMessage}",
+ e
+ )
+ }
+ logger.warn(
+ s"LakeFS not reachable (attempt $attempt/$HealthCheckMaxAttempts):
${e.getMessage}. " +
+ s"Retrying in ${HealthCheckRetryDelayMillis}ms..."
+ )
+ Thread.sleep(HealthCheckRetryDelayMillis)
Review Comment:
it might be a good idea to do backoff waiting, like 200ms, 400ms, 800ms
instead of 3 seconds constantly
and I feel 10 attempts is a bit too many. usually 3-5 times should be
enough. and with backoff 5 attempts will be done in 5~6 seconds. while 3s * 10
attempts is 30s, do we need to wait that long?
--
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]