Skip to content

Commit fab8ec9

Browse files
authored
Remove assertion on refreshed result in TransportShardRefreshAction.UnpromotableReplicasRefreshProxy (#121889)
Relates ES-10700
1 parent 85acf41 commit fab8ec9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportShardRefreshAction.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.cluster.service.ClusterService;
2424
import org.elasticsearch.common.io.stream.StreamInput;
2525
import org.elasticsearch.common.settings.Settings;
26+
import org.elasticsearch.index.engine.Engine;
2627
import org.elasticsearch.index.shard.IndexShard;
2728
import org.elasticsearch.indices.IndicesService;
2829
import org.elasticsearch.injection.guice.Inject;
@@ -125,17 +126,16 @@ public void onPrimaryOperationComplete(
125126
IndexShardRoutingTable indexShardRoutingTable,
126127
ActionListener<Void> listener
127128
) {
128-
assert replicaRequest.primaryRefreshResult.refreshed() : "primary has not refreshed";
129-
UnpromotableShardRefreshRequest unpromotableReplicaRequest = new UnpromotableShardRefreshRequest(
130-
indexShardRoutingTable,
131-
replicaRequest.primaryRefreshResult.primaryTerm(),
132-
replicaRequest.primaryRefreshResult.generation(),
133-
false
134-
);
129+
var primaryTerm = replicaRequest.primaryRefreshResult.primaryTerm();
130+
assert Engine.UNKNOWN_PRIMARY_TERM < primaryTerm : primaryTerm;
131+
132+
var generation = replicaRequest.primaryRefreshResult.generation();
133+
assert Engine.RefreshResult.UNKNOWN_GENERATION < generation : generation;
134+
135135
transportService.sendRequest(
136136
transportService.getLocalNode(),
137137
TransportUnpromotableShardRefreshAction.NAME,
138-
unpromotableReplicaRequest,
138+
new UnpromotableShardRefreshRequest(indexShardRoutingTable, primaryTerm, generation, false),
139139
new ActionListenerResponseHandler<>(listener.safeMap(r -> null), in -> ActionResponse.Empty.INSTANCE, refreshExecutor)
140140
);
141141
}

0 commit comments

Comments
 (0)