Skip to content

Commit fd06ad2

Browse files
authored
fix: allow retry on connection establishing exceptions (#1666)
1 parent 66878c3 commit fd06ad2

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public com.google.api.services.bigquery.model.Dataset call() {
270270
}
271271
},
272272
getOptions().getRetrySettings(),
273-
EXCEPTION_HANDLER,
273+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
274274
getOptions().getClock()));
275275
} catch (RetryHelper.RetryHelperException e) {
276276
throw BigQueryException.translateAndThrow(e);
@@ -298,7 +298,7 @@ public com.google.api.services.bigquery.model.Table call() {
298298
}
299299
},
300300
getOptions().getRetrySettings(),
301-
EXCEPTION_HANDLER,
301+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
302302
getOptions().getClock()));
303303
} catch (RetryHelper.RetryHelperException e) {
304304
throw BigQueryException.translateAndThrow(e);
@@ -326,7 +326,7 @@ public com.google.api.services.bigquery.model.Routine call() {
326326
}
327327
},
328328
getOptions().getRetrySettings(),
329-
EXCEPTION_HANDLER,
329+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
330330
getOptions().getClock()));
331331
} catch (RetryHelper.RetryHelperException e) {
332332
throw BigQueryException.translateAndThrow(e);
@@ -375,7 +375,7 @@ public com.google.api.services.bigquery.model.Job call() {
375375
}
376376
},
377377
getOptions().getRetrySettings(),
378-
EXCEPTION_HANDLER,
378+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
379379
getOptions().getClock()));
380380
} catch (RetryHelper.RetryHelperException e) {
381381
throw BigQueryException.translateAndThrow(e);
@@ -426,7 +426,7 @@ public com.google.api.services.bigquery.model.Dataset call() {
426426
}
427427
},
428428
getOptions().getRetrySettings(),
429-
EXCEPTION_HANDLER,
429+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
430430
getOptions().getClock());
431431
if (getOptions().getThrowNotFound() && answer == null) {
432432
throw new BigQueryException(HTTP_NOT_FOUND, "Dataset not found");
@@ -501,7 +501,7 @@ public Boolean call() {
501501
}
502502
},
503503
getOptions().getRetrySettings(),
504-
EXCEPTION_HANDLER,
504+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
505505
getOptions().getClock());
506506
} catch (RetryHelper.RetryHelperException e) {
507507
throw BigQueryException.translateAndThrow(e);
@@ -532,7 +532,7 @@ public Boolean call() {
532532
}
533533
},
534534
getOptions().getRetrySettings(),
535-
EXCEPTION_HANDLER,
535+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
536536
getOptions().getClock());
537537
} catch (RetryHelper.RetryHelperException e) {
538538
throw BigQueryException.translateAndThrow(e);
@@ -558,7 +558,7 @@ public Boolean call() {
558558
}
559559
},
560560
getOptions().getRetrySettings(),
561-
EXCEPTION_HANDLER,
561+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
562562
getOptions().getClock());
563563
} catch (RetryHelper.RetryHelperException e) {
564564
throw BigQueryException.translateAndThrow(e);
@@ -584,7 +584,7 @@ public Boolean call() {
584584
}
585585
},
586586
getOptions().getRetrySettings(),
587-
EXCEPTION_HANDLER,
587+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
588588
getOptions().getClock());
589589
} catch (RetryHelper.RetryHelperException e) {
590590
throw BigQueryException.translateAndThrow(e);
@@ -608,7 +608,7 @@ public Boolean call() {
608608
}
609609
},
610610
getOptions().getRetrySettings(),
611-
EXCEPTION_HANDLER,
611+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
612612
getOptions().getClock());
613613
} catch (RetryHelper.RetryHelperException e) {
614614
throw BigQueryException.translateAndThrow(e);
@@ -631,7 +631,7 @@ public com.google.api.services.bigquery.model.Dataset call() {
631631
}
632632
},
633633
getOptions().getRetrySettings(),
634-
EXCEPTION_HANDLER,
634+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
635635
getOptions().getClock()));
636636
} catch (RetryHelper.RetryHelperException e) {
637637
throw BigQueryException.translateAndThrow(e);
@@ -659,7 +659,7 @@ public com.google.api.services.bigquery.model.Table call() {
659659
}
660660
},
661661
getOptions().getRetrySettings(),
662-
EXCEPTION_HANDLER,
662+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
663663
getOptions().getClock()));
664664
} catch (RetryHelper.RetryHelperException e) {
665665
throw BigQueryException.translateAndThrow(e);
@@ -687,7 +687,7 @@ public com.google.api.services.bigquery.model.Model call() {
687687
}
688688
},
689689
getOptions().getRetrySettings(),
690-
EXCEPTION_HANDLER,
690+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
691691
getOptions().getClock()));
692692
} catch (RetryHelper.RetryHelperException e) {
693693
throw BigQueryException.translateAndThrow(e);
@@ -715,7 +715,7 @@ public com.google.api.services.bigquery.model.Routine call() {
715715
}
716716
},
717717
getOptions().getRetrySettings(),
718-
EXCEPTION_HANDLER,
718+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
719719
getOptions().getClock()));
720720
} catch (RetryHelper.RetryHelperException e) {
721721
throw BigQueryException.translateAndThrow(e);
@@ -751,7 +751,7 @@ public com.google.api.services.bigquery.model.Table call() {
751751
}
752752
},
753753
getOptions().getRetrySettings(),
754-
EXCEPTION_HANDLER,
754+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
755755
getOptions().getClock());
756756
if (getOptions().getThrowNotFound() && answer == null) {
757757
throw new BigQueryException(HTTP_NOT_FOUND, "Table not found");
@@ -789,7 +789,7 @@ public com.google.api.services.bigquery.model.Model call() {
789789
}
790790
},
791791
getOptions().getRetrySettings(),
792-
EXCEPTION_HANDLER,
792+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
793793
getOptions().getClock());
794794
if (getOptions().getThrowNotFound() && answer == null) {
795795
throw new BigQueryException(HTTP_NOT_FOUND, "Model not found");
@@ -827,7 +827,7 @@ public com.google.api.services.bigquery.model.Routine call() {
827827
}
828828
},
829829
getOptions().getRetrySettings(),
830-
EXCEPTION_HANDLER,
830+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
831831
getOptions().getClock());
832832
if (getOptions().getThrowNotFound() && answer == null) {
833833
throw new BigQueryException(HTTP_NOT_FOUND, "Routine not found");
@@ -916,7 +916,7 @@ private static Page<Table> listTables(
916916
}
917917
},
918918
serviceOptions.getRetrySettings(),
919-
EXCEPTION_HANDLER,
919+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
920920
serviceOptions.getClock());
921921
String cursor = result.x();
922922
Iterable<Table> tables =
@@ -953,7 +953,7 @@ private static Page<Model> listModels(
953953
}
954954
},
955955
serviceOptions.getRetrySettings(),
956-
EXCEPTION_HANDLER,
956+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
957957
serviceOptions.getClock());
958958
String cursor = result.x();
959959
Iterable<Model> models =
@@ -990,7 +990,7 @@ private static Page<Routine> listRoutines(
990990
}
991991
},
992992
serviceOptions.getRetrySettings(),
993-
EXCEPTION_HANDLER,
993+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
994994
serviceOptions.getClock());
995995
String cursor = result.x();
996996
Iterable<Routine> routines =
@@ -1055,7 +1055,7 @@ public TableDataInsertAllResponse call() throws Exception {
10551055
}
10561056
},
10571057
getOptions().getRetrySettings(),
1058-
EXCEPTION_HANDLER,
1058+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
10591059
getOptions().getClock());
10601060
} catch (RetryHelperException e) {
10611061
throw BigQueryException.translateAndThrow(e);
@@ -1119,7 +1119,7 @@ public TableDataList call() {
11191119
}
11201120
},
11211121
serviceOptions.getRetrySettings(),
1122-
EXCEPTION_HANDLER,
1122+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
11231123
serviceOptions.getClock());
11241124
String cursor = result.getPageToken();
11251125
Map<BigQueryRpc.Option, ?> pageOptionMap =
@@ -1179,7 +1179,7 @@ public com.google.api.services.bigquery.model.Job call() {
11791179
}
11801180
},
11811181
getOptions().getRetrySettings(),
1182-
EXCEPTION_HANDLER,
1182+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
11831183
getOptions().getClock());
11841184
if (getOptions().getThrowNotFound() && answer == null) {
11851185
throw new BigQueryException(HTTP_NOT_FOUND, "Job not found");
@@ -1208,7 +1208,7 @@ public Tuple<String, Iterable<com.google.api.services.bigquery.model.Job>> call(
12081208
}
12091209
},
12101210
serviceOptions.getRetrySettings(),
1211-
EXCEPTION_HANDLER,
1211+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
12121212
serviceOptions.getClock());
12131213
String cursor = result.x();
12141214
Iterable<Job> jobs =
@@ -1247,7 +1247,7 @@ public Boolean call() {
12471247
}
12481248
},
12491249
getOptions().getRetrySettings(),
1250-
EXCEPTION_HANDLER,
1250+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
12511251
getOptions().getClock());
12521252
} catch (RetryHelper.RetryHelperException e) {
12531253
throw BigQueryException.translateAndThrow(e);
@@ -1440,7 +1440,7 @@ public com.google.api.services.bigquery.model.Policy call() {
14401440
}
14411441
},
14421442
getOptions().getRetrySettings(),
1443-
EXCEPTION_HANDLER,
1443+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
14441444
getOptions().getClock()));
14451445
} catch (RetryHelper.RetryHelperException e) {
14461446
throw BigQueryException.translateAndThrow(e);
@@ -1466,7 +1466,7 @@ public com.google.api.services.bigquery.model.Policy call() {
14661466
}
14671467
},
14681468
getOptions().getRetrySettings(),
1469-
EXCEPTION_HANDLER,
1469+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
14701470
getOptions().getClock()));
14711471
} catch (RetryHelperException e) {
14721472
throw BigQueryException.translateAndThrow(e);
@@ -1493,7 +1493,7 @@ public com.google.api.services.bigquery.model.TestIamPermissionsResponse call()
14931493
}
14941494
},
14951495
getOptions().getRetrySettings(),
1496-
EXCEPTION_HANDLER,
1496+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
14971497
getOptions().getClock());
14981498
return response.getPermissions() == null
14991499
? ImmutableList.of()

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableDataWriteChannel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public com.google.api.services.bigquery.model.Job call() {
6060
}
6161
},
6262
getOptions().getRetrySettings(),
63-
BigQueryImpl.EXCEPTION_HANDLER,
63+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
6464
getOptions().getClock());
6565
job = jobPb != null ? Job.fromPb(getOptions().getService(), jobPb) : null;
6666
} catch (RetryHelper.RetryHelperException e) {
@@ -91,7 +91,7 @@ public String call() {
9191
}
9292
},
9393
options.getRetrySettings(),
94-
BigQueryImpl.EXCEPTION_HANDLER,
94+
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER,
9595
options.getClock());
9696
} catch (RetryHelper.RetryHelperException e) {
9797
throw BigQueryException.translateAndThrow(e);

0 commit comments

Comments
 (0)