From be03c3b103d93bf7f0a868c145484b74113969ac Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Wed, 8 Mar 2023 15:14:02 +0800 Subject: [PATCH] optimize --- .../tispark/safepoint/ServiceSafePoint.scala | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/main/scala/com/pingcap/tispark/safepoint/ServiceSafePoint.scala b/core/src/main/scala/com/pingcap/tispark/safepoint/ServiceSafePoint.scala index de07cebc0e..1ef0add298 100644 --- a/core/src/main/scala/com/pingcap/tispark/safepoint/ServiceSafePoint.scala +++ b/core/src/main/scala/com/pingcap/tispark/safepoint/ServiceSafePoint.scala @@ -103,12 +103,17 @@ case class ServiceSafePoint( } def stopRegisterSafePoint(): Unit = { - minStartTs = Long.MaxValue - clientSession.getTiKVSession.getPDClient.updateServiceGCSafePoint( - serviceId, - ttl, - Long.MaxValue, - ConcreteBackOffer.newCustomBackOff(PD_UPDATE_SAFE_POINT_BACKOFF)) - service.shutdownNow() + try { + minStartTs = Long.MaxValue + clientSession.getTiKVSession.getPDClient.updateServiceGCSafePoint( + serviceId, + ttl, + Long.MaxValue, + ConcreteBackOffer.newCustomBackOff(PD_UPDATE_SAFE_POINT_BACKOFF)) + } catch { + case e: Exception => logger.error("Failed to stop register service GC safe point", e) + } finally { + service.shutdownNow() + } } }