@@ -731,7 +731,7 @@ Retry manageError(int originalIndex, Row row, Retry canRetry, Throwable throwabl
731
731
if (canRetry != Retry .YES ) {
732
732
// Batch.Callback<Res> was not called on failure in 0.94. We keep this.
733
733
setError (originalIndex , row , throwable , server );
734
- } else if (isActionComplete (originalIndex , row )) {
734
+ } else if (AsyncProcess . isReplicaGet ( row ) && isActionComplete (originalIndex )) {
735
735
canRetry = Retry .NO_OTHER_SUCCEEDED ;
736
736
}
737
737
return canRetry ;
@@ -1164,10 +1164,16 @@ private void setError(int index, Row row, Throwable throwable, ServerName server
1164
1164
* synchronize, assuming element index/field accesses are atomic. This is an opportunistic
1165
1165
* optimization check, doesn't have to be strict.
1166
1166
* @param index Original action index.
1167
- * @param row Original request.
1167
+ * @return If results are non-null, returns whether a result is currently set for action index.
1168
+ * @throws IllegalStateException If results are null. We cannot readily tell here whether an
1169
+ * action that is part of an AsyncRequestFuture that doesn't track
1170
+ * results is complete
1168
1171
*/
1169
- private boolean isActionComplete (int index , Row row ) {
1170
- if (!AsyncProcess .isReplicaGet (row )) return false ;
1172
+ private boolean isActionComplete (int index ) {
1173
+ if (results == null ) {
1174
+ throw new IllegalStateException (
1175
+ String .format ("Cannot check action %d completion when results are null" , index ));
1176
+ }
1171
1177
Object resObj = results [index ];
1172
1178
return (resObj != null )
1173
1179
&& (!(resObj instanceof ReplicaResultState ) || ((ReplicaResultState ) resObj ).callCount == 0 );
0 commit comments