Remove unnecessary method from index shard
This commit removes a convenience method from index shard that is used at exactly one call site. This method is used to callback a listener when an operation is on too old of a primary term. Since it is only used at one call site, we simply inline the method.
This commit is contained in:
parent
4cd70cf986
commit
3666092099
|
@ -1896,7 +1896,13 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|||
public void onResponse(final Releasable releasable) {
|
||||
if (operationPrimaryTerm < primaryTerm) {
|
||||
releasable.close();
|
||||
onOperationPrimaryTermIsTooOld(shardId, operationPrimaryTerm, primaryTerm, onPermitAcquired);
|
||||
final String message = String.format(
|
||||
Locale.ROOT,
|
||||
"%s operation primary term [%d] is too old (current [%d])",
|
||||
shardId,
|
||||
operationPrimaryTerm,
|
||||
primaryTerm);
|
||||
onPermitAcquired.onFailure(new IllegalStateException(message));
|
||||
} else {
|
||||
onPermitAcquired.onResponse(releasable);
|
||||
}
|
||||
|
@ -1911,20 +1917,6 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|||
true);
|
||||
}
|
||||
|
||||
private static void onOperationPrimaryTermIsTooOld(
|
||||
final ShardId shardId,
|
||||
final long operationPrimaryTerm,
|
||||
final long primaryTerm,
|
||||
final ActionListener<Releasable> onPermitAcquired) {
|
||||
final String message = String.format(
|
||||
Locale.ROOT,
|
||||
"%s operation primary term [%d] is too old (current [%d])",
|
||||
shardId,
|
||||
operationPrimaryTerm,
|
||||
primaryTerm);
|
||||
onPermitAcquired.onFailure(new IllegalStateException(message));
|
||||
}
|
||||
|
||||
public int getActiveOperationsCount() {
|
||||
return indexShardOperationPermits.getActiveOperationsCount(); // refCount is incremented on successful acquire and decremented on close
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue