@google-cloud/spanner 6.7.1 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
- package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
- package/build/protos/google/spanner/v1/commit_response.proto +1 -1
- package/build/protos/google/spanner/v1/keys.proto +1 -1
- package/build/protos/google/spanner/v1/mutation.proto +1 -1
- package/build/protos/google/spanner/v1/query_plan.proto +1 -1
- package/build/protos/google/spanner/v1/result_set.proto +1 -1
- package/build/protos/google/spanner/v1/spanner.proto +15 -1
- package/build/protos/google/spanner/v1/transaction.proto +1 -1
- package/build/protos/google/spanner/v1/type.proto +1 -1
- package/build/protos/protos.d.ts +1614 -109
- package/build/protos/protos.js +4185 -286
- package/build/protos/protos.json +322 -22
- package/build/src/partial-result-stream.js +2 -6
- package/build/src/transaction-runner.d.ts +6 -0
- package/build/src/transaction-runner.js +19 -3
- package/build/src/transaction.js +1 -1
- package/build/src/v1/database_admin_client.d.ts +38 -40
- package/build/src/v1/database_admin_client.js +24 -26
- package/build/src/v1/instance_admin_client.d.ts +16 -16
- package/build/src/v1/instance_admin_client.js +6 -6
- package/build/src/v1/spanner_client.d.ts +41 -17
- package/build/src/v1/spanner_client.js +16 -4
- package/package.json +1 -1
package/build/protos/protos.json
CHANGED
|
@@ -566,6 +566,13 @@
|
|
|
566
566
|
"type": "bool",
|
|
567
567
|
"id": 7
|
|
568
568
|
},
|
|
569
|
+
"deprecatedLegacyJsonFieldConflicts": {
|
|
570
|
+
"type": "bool",
|
|
571
|
+
"id": 11,
|
|
572
|
+
"options": {
|
|
573
|
+
"deprecated": true
|
|
574
|
+
}
|
|
575
|
+
},
|
|
569
576
|
"uninterpretedOption": {
|
|
570
577
|
"rule": "repeated",
|
|
571
578
|
"type": "UninterpretedOption",
|
|
@@ -649,6 +656,21 @@
|
|
|
649
656
|
"default": false
|
|
650
657
|
}
|
|
651
658
|
},
|
|
659
|
+
"debugRedact": {
|
|
660
|
+
"type": "bool",
|
|
661
|
+
"id": 16,
|
|
662
|
+
"options": {
|
|
663
|
+
"default": false
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
"retention": {
|
|
667
|
+
"type": "OptionRetention",
|
|
668
|
+
"id": 17
|
|
669
|
+
},
|
|
670
|
+
"target": {
|
|
671
|
+
"type": "OptionTargetType",
|
|
672
|
+
"id": 18
|
|
673
|
+
},
|
|
652
674
|
"uninterpretedOption": {
|
|
653
675
|
"rule": "repeated",
|
|
654
676
|
"type": "UninterpretedOption",
|
|
@@ -681,6 +703,27 @@
|
|
|
681
703
|
"JS_STRING": 1,
|
|
682
704
|
"JS_NUMBER": 2
|
|
683
705
|
}
|
|
706
|
+
},
|
|
707
|
+
"OptionRetention": {
|
|
708
|
+
"values": {
|
|
709
|
+
"RETENTION_UNKNOWN": 0,
|
|
710
|
+
"RETENTION_RUNTIME": 1,
|
|
711
|
+
"RETENTION_SOURCE": 2
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
"OptionTargetType": {
|
|
715
|
+
"values": {
|
|
716
|
+
"TARGET_TYPE_UNKNOWN": 0,
|
|
717
|
+
"TARGET_TYPE_FILE": 1,
|
|
718
|
+
"TARGET_TYPE_EXTENSION_RANGE": 2,
|
|
719
|
+
"TARGET_TYPE_MESSAGE": 3,
|
|
720
|
+
"TARGET_TYPE_FIELD": 4,
|
|
721
|
+
"TARGET_TYPE_ONEOF": 5,
|
|
722
|
+
"TARGET_TYPE_ENUM": 6,
|
|
723
|
+
"TARGET_TYPE_ENUM_ENTRY": 7,
|
|
724
|
+
"TARGET_TYPE_SERVICE": 8,
|
|
725
|
+
"TARGET_TYPE_METHOD": 9
|
|
726
|
+
}
|
|
684
727
|
}
|
|
685
728
|
}
|
|
686
729
|
},
|
|
@@ -712,6 +755,13 @@
|
|
|
712
755
|
"default": false
|
|
713
756
|
}
|
|
714
757
|
},
|
|
758
|
+
"deprecatedLegacyJsonFieldConflicts": {
|
|
759
|
+
"type": "bool",
|
|
760
|
+
"id": 6,
|
|
761
|
+
"options": {
|
|
762
|
+
"deprecated": true
|
|
763
|
+
}
|
|
764
|
+
},
|
|
715
765
|
"uninterpretedOption": {
|
|
716
766
|
"rule": "repeated",
|
|
717
767
|
"type": "UninterpretedOption",
|
|
@@ -1056,6 +1106,23 @@
|
|
|
1056
1106
|
"cc_enable_arenas": true
|
|
1057
1107
|
},
|
|
1058
1108
|
"nested": {
|
|
1109
|
+
"ErrorInfo": {
|
|
1110
|
+
"fields": {
|
|
1111
|
+
"reason": {
|
|
1112
|
+
"type": "string",
|
|
1113
|
+
"id": 1
|
|
1114
|
+
},
|
|
1115
|
+
"domain": {
|
|
1116
|
+
"type": "string",
|
|
1117
|
+
"id": 2
|
|
1118
|
+
},
|
|
1119
|
+
"metadata": {
|
|
1120
|
+
"keyType": "string",
|
|
1121
|
+
"type": "string",
|
|
1122
|
+
"id": 3
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1059
1126
|
"RetryInfo": {
|
|
1060
1127
|
"fields": {
|
|
1061
1128
|
"retryDelay": {
|
|
@@ -1100,23 +1167,6 @@
|
|
|
1100
1167
|
}
|
|
1101
1168
|
}
|
|
1102
1169
|
},
|
|
1103
|
-
"ErrorInfo": {
|
|
1104
|
-
"fields": {
|
|
1105
|
-
"reason": {
|
|
1106
|
-
"type": "string",
|
|
1107
|
-
"id": 1
|
|
1108
|
-
},
|
|
1109
|
-
"domain": {
|
|
1110
|
-
"type": "string",
|
|
1111
|
-
"id": 2
|
|
1112
|
-
},
|
|
1113
|
-
"metadata": {
|
|
1114
|
-
"keyType": "string",
|
|
1115
|
-
"type": "string",
|
|
1116
|
-
"id": 3
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
},
|
|
1120
1170
|
"PreconditionFailure": {
|
|
1121
1171
|
"fields": {
|
|
1122
1172
|
"violations": {
|
|
@@ -1262,7 +1312,7 @@
|
|
|
1262
1312
|
"v1": {
|
|
1263
1313
|
"options": {
|
|
1264
1314
|
"csharp_namespace": "Google.Cloud.Spanner.Admin.Database.V1",
|
|
1265
|
-
"go_package": "google.
|
|
1315
|
+
"go_package": "cloud.google.com/go/spanner/admin/database/apiv1/databasepb;databasepb",
|
|
1266
1316
|
"java_multiple_files": true,
|
|
1267
1317
|
"java_outer_classname": "SpannerDatabaseAdminProto",
|
|
1268
1318
|
"java_package": "com.google.spanner.admin.database.v1",
|
|
@@ -2712,7 +2762,7 @@
|
|
|
2712
2762
|
"v1": {
|
|
2713
2763
|
"options": {
|
|
2714
2764
|
"csharp_namespace": "Google.Cloud.Spanner.Admin.Instance.V1",
|
|
2715
|
-
"go_package": "google.
|
|
2765
|
+
"go_package": "cloud.google.com/go/spanner/admin/instance/apiv1/instancepb;instancepb",
|
|
2716
2766
|
"java_multiple_files": true,
|
|
2717
2767
|
"java_outer_classname": "SpannerInstanceAdminProto",
|
|
2718
2768
|
"java_package": "com.google.spanner.admin.instance.v1",
|
|
@@ -3577,7 +3627,7 @@
|
|
|
3577
3627
|
"v1": {
|
|
3578
3628
|
"options": {
|
|
3579
3629
|
"csharp_namespace": "Google.Cloud.Spanner.V1",
|
|
3580
|
-
"go_package": "google.
|
|
3630
|
+
"go_package": "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb",
|
|
3581
3631
|
"java_multiple_files": true,
|
|
3582
3632
|
"java_outer_classname": "SpannerProto",
|
|
3583
3633
|
"java_package": "com.google.spanner.v1",
|
|
@@ -4604,6 +4654,10 @@
|
|
|
4604
4654
|
"requestOptions": {
|
|
4605
4655
|
"type": "RequestOptions",
|
|
4606
4656
|
"id": 11
|
|
4657
|
+
},
|
|
4658
|
+
"dataBoostEnabled": {
|
|
4659
|
+
"type": "bool",
|
|
4660
|
+
"id": 16
|
|
4607
4661
|
}
|
|
4608
4662
|
},
|
|
4609
4663
|
"nested": {
|
|
@@ -4868,6 +4922,10 @@
|
|
|
4868
4922
|
"requestOptions": {
|
|
4869
4923
|
"type": "RequestOptions",
|
|
4870
4924
|
"id": 11
|
|
4925
|
+
},
|
|
4926
|
+
"dataBoostEnabled": {
|
|
4927
|
+
"type": "bool",
|
|
4928
|
+
"id": 15
|
|
4871
4929
|
}
|
|
4872
4930
|
}
|
|
4873
4931
|
},
|
|
@@ -4960,9 +5018,9 @@
|
|
|
4960
5018
|
},
|
|
4961
5019
|
"api": {
|
|
4962
5020
|
"options": {
|
|
4963
|
-
"go_package": "google.golang.org/genproto/googleapis/api
|
|
5021
|
+
"go_package": "google.golang.org/genproto/googleapis/api;api",
|
|
4964
5022
|
"java_multiple_files": true,
|
|
4965
|
-
"java_outer_classname": "
|
|
5023
|
+
"java_outer_classname": "LaunchStageProto",
|
|
4966
5024
|
"java_package": "com.google.api",
|
|
4967
5025
|
"objc_class_prefix": "GAPI",
|
|
4968
5026
|
"cc_enable_arenas": true
|
|
@@ -5165,6 +5223,248 @@
|
|
|
5165
5223
|
"type": "string",
|
|
5166
5224
|
"id": 1050,
|
|
5167
5225
|
"extend": "google.protobuf.ServiceOptions"
|
|
5226
|
+
},
|
|
5227
|
+
"CommonLanguageSettings": {
|
|
5228
|
+
"fields": {
|
|
5229
|
+
"referenceDocsUri": {
|
|
5230
|
+
"type": "string",
|
|
5231
|
+
"id": 1,
|
|
5232
|
+
"options": {
|
|
5233
|
+
"deprecated": true
|
|
5234
|
+
}
|
|
5235
|
+
},
|
|
5236
|
+
"destinations": {
|
|
5237
|
+
"rule": "repeated",
|
|
5238
|
+
"type": "ClientLibraryDestination",
|
|
5239
|
+
"id": 2
|
|
5240
|
+
}
|
|
5241
|
+
}
|
|
5242
|
+
},
|
|
5243
|
+
"ClientLibrarySettings": {
|
|
5244
|
+
"fields": {
|
|
5245
|
+
"version": {
|
|
5246
|
+
"type": "string",
|
|
5247
|
+
"id": 1
|
|
5248
|
+
},
|
|
5249
|
+
"launchStage": {
|
|
5250
|
+
"type": "LaunchStage",
|
|
5251
|
+
"id": 2
|
|
5252
|
+
},
|
|
5253
|
+
"restNumericEnums": {
|
|
5254
|
+
"type": "bool",
|
|
5255
|
+
"id": 3
|
|
5256
|
+
},
|
|
5257
|
+
"javaSettings": {
|
|
5258
|
+
"type": "JavaSettings",
|
|
5259
|
+
"id": 21
|
|
5260
|
+
},
|
|
5261
|
+
"cppSettings": {
|
|
5262
|
+
"type": "CppSettings",
|
|
5263
|
+
"id": 22
|
|
5264
|
+
},
|
|
5265
|
+
"phpSettings": {
|
|
5266
|
+
"type": "PhpSettings",
|
|
5267
|
+
"id": 23
|
|
5268
|
+
},
|
|
5269
|
+
"pythonSettings": {
|
|
5270
|
+
"type": "PythonSettings",
|
|
5271
|
+
"id": 24
|
|
5272
|
+
},
|
|
5273
|
+
"nodeSettings": {
|
|
5274
|
+
"type": "NodeSettings",
|
|
5275
|
+
"id": 25
|
|
5276
|
+
},
|
|
5277
|
+
"dotnetSettings": {
|
|
5278
|
+
"type": "DotnetSettings",
|
|
5279
|
+
"id": 26
|
|
5280
|
+
},
|
|
5281
|
+
"rubySettings": {
|
|
5282
|
+
"type": "RubySettings",
|
|
5283
|
+
"id": 27
|
|
5284
|
+
},
|
|
5285
|
+
"goSettings": {
|
|
5286
|
+
"type": "GoSettings",
|
|
5287
|
+
"id": 28
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
},
|
|
5291
|
+
"Publishing": {
|
|
5292
|
+
"fields": {
|
|
5293
|
+
"methodSettings": {
|
|
5294
|
+
"rule": "repeated",
|
|
5295
|
+
"type": "MethodSettings",
|
|
5296
|
+
"id": 2
|
|
5297
|
+
},
|
|
5298
|
+
"newIssueUri": {
|
|
5299
|
+
"type": "string",
|
|
5300
|
+
"id": 101
|
|
5301
|
+
},
|
|
5302
|
+
"documentationUri": {
|
|
5303
|
+
"type": "string",
|
|
5304
|
+
"id": 102
|
|
5305
|
+
},
|
|
5306
|
+
"apiShortName": {
|
|
5307
|
+
"type": "string",
|
|
5308
|
+
"id": 103
|
|
5309
|
+
},
|
|
5310
|
+
"githubLabel": {
|
|
5311
|
+
"type": "string",
|
|
5312
|
+
"id": 104
|
|
5313
|
+
},
|
|
5314
|
+
"codeownerGithubTeams": {
|
|
5315
|
+
"rule": "repeated",
|
|
5316
|
+
"type": "string",
|
|
5317
|
+
"id": 105
|
|
5318
|
+
},
|
|
5319
|
+
"docTagPrefix": {
|
|
5320
|
+
"type": "string",
|
|
5321
|
+
"id": 106
|
|
5322
|
+
},
|
|
5323
|
+
"organization": {
|
|
5324
|
+
"type": "ClientLibraryOrganization",
|
|
5325
|
+
"id": 107
|
|
5326
|
+
},
|
|
5327
|
+
"librarySettings": {
|
|
5328
|
+
"rule": "repeated",
|
|
5329
|
+
"type": "ClientLibrarySettings",
|
|
5330
|
+
"id": 109
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
},
|
|
5334
|
+
"JavaSettings": {
|
|
5335
|
+
"fields": {
|
|
5336
|
+
"libraryPackage": {
|
|
5337
|
+
"type": "string",
|
|
5338
|
+
"id": 1
|
|
5339
|
+
},
|
|
5340
|
+
"serviceClassNames": {
|
|
5341
|
+
"keyType": "string",
|
|
5342
|
+
"type": "string",
|
|
5343
|
+
"id": 2
|
|
5344
|
+
},
|
|
5345
|
+
"common": {
|
|
5346
|
+
"type": "CommonLanguageSettings",
|
|
5347
|
+
"id": 3
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
},
|
|
5351
|
+
"CppSettings": {
|
|
5352
|
+
"fields": {
|
|
5353
|
+
"common": {
|
|
5354
|
+
"type": "CommonLanguageSettings",
|
|
5355
|
+
"id": 1
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
},
|
|
5359
|
+
"PhpSettings": {
|
|
5360
|
+
"fields": {
|
|
5361
|
+
"common": {
|
|
5362
|
+
"type": "CommonLanguageSettings",
|
|
5363
|
+
"id": 1
|
|
5364
|
+
}
|
|
5365
|
+
}
|
|
5366
|
+
},
|
|
5367
|
+
"PythonSettings": {
|
|
5368
|
+
"fields": {
|
|
5369
|
+
"common": {
|
|
5370
|
+
"type": "CommonLanguageSettings",
|
|
5371
|
+
"id": 1
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
},
|
|
5375
|
+
"NodeSettings": {
|
|
5376
|
+
"fields": {
|
|
5377
|
+
"common": {
|
|
5378
|
+
"type": "CommonLanguageSettings",
|
|
5379
|
+
"id": 1
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
},
|
|
5383
|
+
"DotnetSettings": {
|
|
5384
|
+
"fields": {
|
|
5385
|
+
"common": {
|
|
5386
|
+
"type": "CommonLanguageSettings",
|
|
5387
|
+
"id": 1
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
},
|
|
5391
|
+
"RubySettings": {
|
|
5392
|
+
"fields": {
|
|
5393
|
+
"common": {
|
|
5394
|
+
"type": "CommonLanguageSettings",
|
|
5395
|
+
"id": 1
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
},
|
|
5399
|
+
"GoSettings": {
|
|
5400
|
+
"fields": {
|
|
5401
|
+
"common": {
|
|
5402
|
+
"type": "CommonLanguageSettings",
|
|
5403
|
+
"id": 1
|
|
5404
|
+
}
|
|
5405
|
+
}
|
|
5406
|
+
},
|
|
5407
|
+
"MethodSettings": {
|
|
5408
|
+
"fields": {
|
|
5409
|
+
"selector": {
|
|
5410
|
+
"type": "string",
|
|
5411
|
+
"id": 1
|
|
5412
|
+
},
|
|
5413
|
+
"longRunning": {
|
|
5414
|
+
"type": "LongRunning",
|
|
5415
|
+
"id": 2
|
|
5416
|
+
}
|
|
5417
|
+
},
|
|
5418
|
+
"nested": {
|
|
5419
|
+
"LongRunning": {
|
|
5420
|
+
"fields": {
|
|
5421
|
+
"initialPollDelay": {
|
|
5422
|
+
"type": "google.protobuf.Duration",
|
|
5423
|
+
"id": 1
|
|
5424
|
+
},
|
|
5425
|
+
"pollDelayMultiplier": {
|
|
5426
|
+
"type": "float",
|
|
5427
|
+
"id": 2
|
|
5428
|
+
},
|
|
5429
|
+
"maxPollDelay": {
|
|
5430
|
+
"type": "google.protobuf.Duration",
|
|
5431
|
+
"id": 3
|
|
5432
|
+
},
|
|
5433
|
+
"totalPollTimeout": {
|
|
5434
|
+
"type": "google.protobuf.Duration",
|
|
5435
|
+
"id": 4
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
},
|
|
5441
|
+
"ClientLibraryOrganization": {
|
|
5442
|
+
"values": {
|
|
5443
|
+
"CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0,
|
|
5444
|
+
"CLOUD": 1,
|
|
5445
|
+
"ADS": 2,
|
|
5446
|
+
"PHOTOS": 3,
|
|
5447
|
+
"STREET_VIEW": 4
|
|
5448
|
+
}
|
|
5449
|
+
},
|
|
5450
|
+
"ClientLibraryDestination": {
|
|
5451
|
+
"values": {
|
|
5452
|
+
"CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0,
|
|
5453
|
+
"GITHUB": 10,
|
|
5454
|
+
"PACKAGE_MANAGER": 20
|
|
5455
|
+
}
|
|
5456
|
+
},
|
|
5457
|
+
"LaunchStage": {
|
|
5458
|
+
"values": {
|
|
5459
|
+
"LAUNCH_STAGE_UNSPECIFIED": 0,
|
|
5460
|
+
"UNIMPLEMENTED": 6,
|
|
5461
|
+
"PRELAUNCH": 7,
|
|
5462
|
+
"EARLY_ACCESS": 1,
|
|
5463
|
+
"ALPHA": 2,
|
|
5464
|
+
"BETA": 3,
|
|
5465
|
+
"GA": 4,
|
|
5466
|
+
"DEPRECATED": 5
|
|
5467
|
+
}
|
|
5168
5468
|
}
|
|
5169
5469
|
}
|
|
5170
5470
|
},
|
|
@@ -24,6 +24,7 @@ const mergeStream = require("merge-stream");
|
|
|
24
24
|
const stream_1 = require("stream");
|
|
25
25
|
const streamEvents = require("stream-events");
|
|
26
26
|
const google_gax_1 = require("google-gax");
|
|
27
|
+
const transaction_runner_1 = require("./transaction-runner");
|
|
27
28
|
const codec_1 = require("./codec");
|
|
28
29
|
const protos_1 = require("../protos/protos");
|
|
29
30
|
const stream = require("stream");
|
|
@@ -329,7 +330,7 @@ function partialResultStream(requestFn, options) {
|
|
|
329
330
|
};
|
|
330
331
|
const retry = (err) => {
|
|
331
332
|
if (!(err.code &&
|
|
332
|
-
(retryableCodes.includes(err.code) || isRetryableInternalError(err))) ||
|
|
333
|
+
(retryableCodes.includes(err.code) || (0, transaction_runner_1.isRetryableInternalError)(err))) ||
|
|
333
334
|
// If we have received too many chunks without a resume token, it is not
|
|
334
335
|
// safe to retry.
|
|
335
336
|
withoutCheckpointCount > maxQueued) {
|
|
@@ -379,9 +380,4 @@ exports.partialResultStream = partialResultStream;
|
|
|
379
380
|
function _hasResumeToken(chunk) {
|
|
380
381
|
return is.defined(chunk.resumeToken) && chunk.resumeToken.length > 0;
|
|
381
382
|
}
|
|
382
|
-
function isRetryableInternalError(err) {
|
|
383
|
-
return (err.code === google_gax_1.grpc.status.INTERNAL &&
|
|
384
|
-
(err.message.includes('Received unexpected EOS on DATA frame from server') ||
|
|
385
|
-
err.message.includes('Received RST_STREAM')));
|
|
386
|
-
}
|
|
387
383
|
//# sourceMappingURL=partial-result-stream.js.map
|
|
@@ -176,3 +176,9 @@ export declare class AsyncTransactionRunner<T> extends Runner<T> {
|
|
|
176
176
|
*/
|
|
177
177
|
protected _run(transaction: Transaction): Promise<T>;
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Checks whether the given error is a retryable internal error.
|
|
181
|
+
* @param error the error to check
|
|
182
|
+
* @return true if the error is a retryable internal error, and otherwise false.
|
|
183
|
+
*/
|
|
184
|
+
export declare function isRetryableInternalError(err: grpc.ServiceError): boolean;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.AsyncTransactionRunner = exports.TransactionRunner = exports.Runner = exports.DeadlineError = void 0;
|
|
18
|
+
exports.isRetryableInternalError = exports.AsyncTransactionRunner = exports.TransactionRunner = exports.Runner = exports.DeadlineError = void 0;
|
|
19
19
|
const promisify_1 = require("@google-cloud/promisify");
|
|
20
20
|
const google_gax_1 = require("google-gax");
|
|
21
21
|
const protobufjs_1 = require("protobufjs");
|
|
@@ -100,7 +100,9 @@ class Runner {
|
|
|
100
100
|
}
|
|
101
101
|
/** Returns whether the given error should cause a transaction retry. */
|
|
102
102
|
shouldRetry(err) {
|
|
103
|
-
return RETRYABLE.includes(err.code) ||
|
|
103
|
+
return (RETRYABLE.includes(err.code) ||
|
|
104
|
+
(0, session_pool_1.isSessionNotFoundError)(err) ||
|
|
105
|
+
isRetryableInternalError(err));
|
|
104
106
|
}
|
|
105
107
|
/**
|
|
106
108
|
* Retrieves a transaction to run against.
|
|
@@ -150,7 +152,8 @@ class Runner {
|
|
|
150
152
|
// Note that if the error is a 'Session not found' error, it will be
|
|
151
153
|
// thrown here. We do this to bubble this error up to the caller who is
|
|
152
154
|
// responsible for retrying the transaction on a different session.
|
|
153
|
-
if (!RETRYABLE.includes(lastError.code)
|
|
155
|
+
if (!RETRYABLE.includes(lastError.code) &&
|
|
156
|
+
!isRetryableInternalError(lastError)) {
|
|
154
157
|
throw lastError;
|
|
155
158
|
}
|
|
156
159
|
this.attempts += 1;
|
|
@@ -260,4 +263,17 @@ class AsyncTransactionRunner extends Runner {
|
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
265
|
exports.AsyncTransactionRunner = AsyncTransactionRunner;
|
|
266
|
+
/**
|
|
267
|
+
* Checks whether the given error is a retryable internal error.
|
|
268
|
+
* @param error the error to check
|
|
269
|
+
* @return true if the error is a retryable internal error, and otherwise false.
|
|
270
|
+
*/
|
|
271
|
+
function isRetryableInternalError(err) {
|
|
272
|
+
return (err.code === google_gax_1.grpc.status.INTERNAL &&
|
|
273
|
+
(err.message.includes('Received unexpected EOS on DATA frame from server') ||
|
|
274
|
+
err.message.includes('RST_STREAM') ||
|
|
275
|
+
err.message.includes('HTTP/2 error code: INTERNAL_ERROR') ||
|
|
276
|
+
err.message.includes('Connection closed with unknown cause')));
|
|
277
|
+
}
|
|
278
|
+
exports.isRetryableInternalError = isRetryableInternalError;
|
|
263
279
|
//# sourceMappingURL=transaction-runner.js.map
|
package/build/src/transaction.js
CHANGED
|
@@ -1029,7 +1029,7 @@ class Transaction extends Dml {
|
|
|
1029
1029
|
reqOpts.singleUseTransaction = this._options;
|
|
1030
1030
|
}
|
|
1031
1031
|
else {
|
|
1032
|
-
this.begin().then(() => this.commit(options, callback));
|
|
1032
|
+
this.begin().then(() => this.commit(options, callback), callback);
|
|
1033
1033
|
return;
|
|
1034
1034
|
}
|
|
1035
1035
|
if ('returnCommitStats' in options &&
|