File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -360,8 +360,12 @@ and reflects the flow described above.
360
360
*/
361
361
function executeRetryableRead(command , session ) {
362
362
Exception previousError = null ;
363
+ retrying = false ;
363
364
Server previousServer = null ;
364
365
while true {
366
+ if (previousError != null ) {
367
+ retrying = true ;
368
+ }
365
369
try {
366
370
if (previousServer == null ) {
367
371
server = selectServer ();
@@ -438,8 +442,16 @@ and reflects the flow described above.
438
442
}
439
443
throw error;
440
444
}
441
- /* CSOT is enabled and the operation has timed out. */
442
- if (timeoutMS != null && isExpired (timeoutMS ) {
445
+
446
+ if (timeoutMS == null ) {
447
+ /* If CSOT is not enabled, allow any retryable error from the second
448
+ * attempt to propagate to our caller, as it will be just as relevant
449
+ * (if not more relevant) than the original error. */
450
+ if (retrying ) {
451
+ throw previousError ;
452
+ }
453
+ } else if (isExpired (timeoutMS )) {
454
+ /* CSOT is enabled and the operation has timed out. */
443
455
throw previousError;
444
456
}
445
457
}
You can’t perform that action at this time.
0 commit comments