Skip to content

Commit

Permalink
Another attempt, closer to the initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Mazurov authored and jyuanca committed May 24, 2018
1 parent 96be093 commit 5b37ac9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ public static Collection<KVPair> doPartialRetry(BulkWrite bulkWrite,BulkWriteRes
* @return
*/

public static long getPauseTime(final int tries, final int pause) {
public static long getPauseTime(final int tries, final long pause) {
int ntries = tries;
if (ntries >= RETRY_BACKOFF.length) {
ntries = RETRY_BACKOFF.length - 1;
}
// DB-7022 avoid coordinated pauses from multiple threads
return RANDOM.nextInt(pause * RETRY_BACKOFF[ntries]);
long normalPause = pause * RETRY_BACKOFF[ntries];
long jitter = (long)(normalPause * (RANDOM.nextFloat() - 0.5));
return normalPause + jitter;
}

}

0 comments on commit 5b37ac9

Please sign in to comment.