File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed
paimon-core/src/main/java/org/apache/paimon/utils Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change 2424import org .apache .paimon .table .Instant ;
2525
2626import org .apache .paimon .shade .caffeine2 .com .github .benmanes .caffeine .cache .Cache ;
27+ import org .apache .paimon .shade .jackson2 .com .fasterxml .jackson .databind .exc .MismatchedInputException ;
2728
2829import org .slf4j .Logger ;
2930import org .slf4j .LoggerFactory ;
@@ -770,12 +771,26 @@ public static Snapshot fromPath(FileIO fileIO, Path path) {
770771 }
771772
772773 public static Snapshot tryFromPath (FileIO fileIO , Path path ) throws FileNotFoundException {
773- try {
774- return Snapshot .fromJson (fileIO .readFileUtf8 (path ));
775- } catch (FileNotFoundException e ) {
776- throw e ;
777- } catch (IOException e ) {
778- throw new RuntimeException ("Fails to read snapshot from path " + path , e );
774+ int retryNumber = 0 ;
775+ MismatchedInputException exception = null ;
776+ while (retryNumber ++ < 10 ) {
777+ try {
778+ return Snapshot .fromJson (fileIO .readFileUtf8 (path ));
779+ } catch (MismatchedInputException e ) {
780+ // retry
781+ exception = e ;
782+ try {
783+ Thread .sleep (1_000 );
784+ } catch (InterruptedException ie ) {
785+ Thread .currentThread ().interrupt ();
786+ throw new RuntimeException (ie );
787+ }
788+ } catch (FileNotFoundException e ) {
789+ throw e ;
790+ } catch (IOException e ) {
791+ throw new RuntimeException ("Fails to read snapshot from path " + path , e );
792+ }
779793 }
794+ throw new UncheckedIOException (exception );
780795 }
781796}
You can’t perform that action at this time.
0 commit comments