Skip to content

Commit 520c70a

Browse files
committed
Rename IndexShardRoutingTable unpromotable related methods
1 parent f6d3a2c commit 520c70a

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

server/src/main/java/org/elasticsearch/action/support/broadcast/unpromotable/TransportBroadcastUnpromotableAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected TransportBroadcastUnpromotableAction(
7676

7777
@Override
7878
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
79-
final var unpromotableShards = request.indexShardRoutingTable.unpromotableShards();
79+
final var unpromotableShards = request.indexShardRoutingTable.assignedUnpromotableShards();
8080
final var responses = new ArrayList<Response>(unpromotableShards.size());
8181

8282
try (var listeners = new RefCountingListener(listener.map(v -> combineUnpromotableShardResponses(responses)))) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void onFailure(Exception e) {
6565
}
6666
});
6767
case IMMEDIATE -> immediate(indexShard, listener.delegateFailureAndWrap((l, r) -> {
68-
if (indexShard.getReplicationGroup().getRoutingTable().allUnpromotableShards().size() > 0) {
68+
if (indexShard.getReplicationGroup().getRoutingTable().unpromotableShards().size() > 0) {
6969
sendUnpromotableRequests(indexShard, r.generation(), true, l, postWriteRefreshTimeout);
7070
} else {
7171
l.onResponse(true);

server/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public List<ShardRouting> assignedShards() {
193193
*
194194
* @return a {@link List} of shards
195195
*/
196-
public List<ShardRouting> unpromotableShards() {
196+
public List<ShardRouting> assignedUnpromotableShards() {
197197
return this.assignedUnpromotableShards;
198198
}
199199

@@ -202,7 +202,7 @@ public List<ShardRouting> unpromotableShards() {
202202
*
203203
* @return a {@link List} of shards
204204
*/
205-
public List<ShardRouting> allUnpromotableShards() {
205+
public List<ShardRouting> unpromotableShards() {
206206
return this.unpromotableShards;
207207
}
208208

server/src/test/java/org/elasticsearch/action/support/broadcast/unpromotable/TransportBroadcastUnpromotableActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public void testInvalidNodes() throws Exception {
333333

334334
// We were able to mark shards as stale, so the request finishes successfully
335335
assertThat(safeAwait(broadcastUnpromotableRequest(wrongRoutingTable, true)), equalTo(ActionResponse.Empty.INSTANCE));
336-
for (var shardRouting : wrongRoutingTable.unpromotableShards()) {
336+
for (var shardRouting : wrongRoutingTable.assignedUnpromotableShards()) {
337337
Mockito.verify(shardStateAction)
338338
.remoteShardFailed(
339339
eq(shardRouting.shardId()),

server/src/test/java/org/elasticsearch/action/support/replication/PostWriteRefreshTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void testPrimaryWithUnpromotables() throws IOException {
162162
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "message"),
163163
ShardRouting.Role.SEARCH_ONLY
164164
);
165-
when(routingTable.allUnpromotableShards()).thenReturn(List.of(shardRouting));
165+
when(routingTable.unpromotableShards()).thenReturn(List.of(shardRouting));
166166
when(routingTable.shardId()).thenReturn(shardId);
167167
WriteRequest.RefreshPolicy policy = randomFrom(WriteRequest.RefreshPolicy.IMMEDIATE, WriteRequest.RefreshPolicy.WAIT_UNTIL);
168168
postWriteRefresh.refreshShard(policy, primary, result.getTranslogLocation(), f, postWriteRefreshTimeout);
@@ -238,9 +238,9 @@ public void testWaitForWithNullLocationCompletedImmediately() throws IOException
238238
);
239239
// Randomly test scenarios with and without unpromotables
240240
if (randomBoolean()) {
241-
when(routingTable.allUnpromotableShards()).thenReturn(Collections.emptyList());
241+
when(routingTable.unpromotableShards()).thenReturn(Collections.emptyList());
242242
} else {
243-
when(routingTable.allUnpromotableShards()).thenReturn(List.of(shardRouting));
243+
when(routingTable.unpromotableShards()).thenReturn(List.of(shardRouting));
244244
}
245245
WriteRequest.RefreshPolicy policy = WriteRequest.RefreshPolicy.WAIT_UNTIL;
246246
postWriteRefresh.refreshShard(policy, primary, null, f, postWriteRefreshTimeout);

0 commit comments

Comments
 (0)