Skip to content

Commit b1e673d

Browse files
committed
remove replica
1 parent 37c3409 commit b1e673d

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,6 @@ private final class AsyncReplicaAction extends AbstractRunnable implements Actio
663663
// something we want to avoid at all costs
664664
private final ClusterStateObserver observer = new ClusterStateObserver(clusterService, null, logger, threadPool.getThreadContext());
665665
private final ConcreteReplicaRequest<ReplicaRequest> replicaRequest;
666-
private final Supplier<Long> localCheckpointSupplier;
667-
private final Supplier<Long> globalCheckpointSupplier;
668666

669667
AsyncReplicaAction(
670668
ConcreteReplicaRequest<ReplicaRequest> replicaRequest,
@@ -677,9 +675,6 @@ private final class AsyncReplicaAction extends AbstractRunnable implements Actio
677675
final ShardId shardId = replicaRequest.getRequest().shardId();
678676
assert shardId != null : "request shardId must be set";
679677
this.replica = getIndexShard(shardId);
680-
this.localCheckpointSupplier = replica.getLocalCheckpointSupplier();
681-
this.globalCheckpointSupplier = replica.getLastSyncedGlobalCheckpointSupplier();
682-
683678
}
684679

685680
@Override
@@ -690,7 +685,10 @@ public void onResponse(Releasable releasable) {
690685
replicaRequest.getRequest(),
691686
replica,
692687
ActionListener.wrap((replicaResult) -> replicaResult.runPostReplicaActions(ActionListener.wrap(r -> {
693-
final ReplicaResponse response = new ReplicaResponse(localCheckpointSupplier.get(), globalCheckpointSupplier.get());
688+
final ReplicaResponse response = new ReplicaResponse(
689+
replica.getLocalCheckpoint(),
690+
replica.getLastSyncedGlobalCheckpoint()
691+
);
694692
releasable.close(); // release shard operation lock before responding to caller
695693
if (logger.isTraceEnabled()) {
696694
logger.trace(

server/src/main/java/org/elasticsearch/index/engine/SafeEngineAccessThreadLocal.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,14 @@ public static void accessEnd() {
8282
/**
8383
* Use this method to assert that the current thread has not entered a protected execution code block.
8484
*/
85-
public static boolean assertNoAccessByCurrentThread() {
85+
public static void checkAccess() {
8686
ensureAssertionsEnabled();
8787
final var accessor = getAccessorSafe();
8888
if (accessor != null) {
8989
var message = "thread [" + accessor + "] should not access the engine using the getEngineOrNull() method";
9090
accessor.setFailure(new AssertionError(message)); // to be thrown later
9191
assert false : message;
9292
}
93-
return true;
9493
}
9594

9695
private static void ensureAssertionsEnabled() {

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3364,7 +3364,7 @@ Engine getEngine() {
33643364
* closed.
33653365
*/
33663366
public Engine getEngineOrNull() {
3367-
assert SafeEngineAccessThreadLocal.assertNoAccessByCurrentThread();
3367+
SafeEngineAccessThreadLocal.checkAccess();
33683368
return this.currentEngineReference.get();
33693369
}
33703370

0 commit comments

Comments
 (0)