|
23 | 23 | import org.elasticsearch.cluster.service.ClusterService; |
24 | 24 | import org.elasticsearch.common.io.stream.StreamInput; |
25 | 25 | import org.elasticsearch.common.settings.Settings; |
| 26 | +import org.elasticsearch.index.engine.Engine; |
26 | 27 | import org.elasticsearch.index.shard.IndexShard; |
27 | 28 | import org.elasticsearch.indices.IndicesService; |
28 | 29 | import org.elasticsearch.injection.guice.Inject; |
@@ -125,17 +126,16 @@ public void onPrimaryOperationComplete( |
125 | 126 | IndexShardRoutingTable indexShardRoutingTable, |
126 | 127 | ActionListener<Void> listener |
127 | 128 | ) { |
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 | + |
135 | 135 | transportService.sendRequest( |
136 | 136 | transportService.getLocalNode(), |
137 | 137 | TransportUnpromotableShardRefreshAction.NAME, |
138 | | - unpromotableReplicaRequest, |
| 138 | + new UnpromotableShardRefreshRequest(indexShardRoutingTable, primaryTerm, generation, false), |
139 | 139 | new ActionListenerResponseHandler<>(listener.safeMap(r -> null), in -> ActionResponse.Empty.INSTANCE, refreshExecutor) |
140 | 140 | ); |
141 | 141 | } |
|
0 commit comments