Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected TransportBroadcastUnpromotableAction(

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

try (var listeners = new RefCountingListener(listener.map(v -> combineUnpromotableShardResponses(responses)))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void onFailure(Exception e) {
}
});
case IMMEDIATE -> immediate(indexShard, listener.delegateFailureAndWrap((l, r) -> {
if (indexShard.getReplicationGroup().getRoutingTable().allUnpromotableShards().size() > 0) {
if (indexShard.getReplicationGroup().getRoutingTable().unpromotableShards().size() > 0) {
sendUnpromotableRequests(indexShard, r.generation(), true, l, postWriteRefreshTimeout);
} else {
l.onResponse(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public List<ShardRouting> assignedShards() {
*
* @return a {@link List} of shards
*/
public List<ShardRouting> unpromotableShards() {
public List<ShardRouting> assignedUnpromotableShards() {
return this.assignedUnpromotableShards;
}

Expand All @@ -202,7 +202,7 @@ public List<ShardRouting> unpromotableShards() {
*
* @return a {@link List} of shards
*/
public List<ShardRouting> allUnpromotableShards() {
public List<ShardRouting> unpromotableShards() {
return this.unpromotableShards;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public void testInvalidNodes() throws Exception {

// We were able to mark shards as stale, so the request finishes successfully
assertThat(safeAwait(broadcastUnpromotableRequest(wrongRoutingTable, true)), equalTo(ActionResponse.Empty.INSTANCE));
for (var shardRouting : wrongRoutingTable.unpromotableShards()) {
for (var shardRouting : wrongRoutingTable.assignedUnpromotableShards()) {
Mockito.verify(shardStateAction)
.remoteShardFailed(
eq(shardRouting.shardId()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void testPrimaryWithUnpromotables() throws IOException {
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "message"),
ShardRouting.Role.SEARCH_ONLY
);
when(routingTable.allUnpromotableShards()).thenReturn(List.of(shardRouting));
when(routingTable.unpromotableShards()).thenReturn(List.of(shardRouting));
when(routingTable.shardId()).thenReturn(shardId);
WriteRequest.RefreshPolicy policy = randomFrom(WriteRequest.RefreshPolicy.IMMEDIATE, WriteRequest.RefreshPolicy.WAIT_UNTIL);
postWriteRefresh.refreshShard(policy, primary, result.getTranslogLocation(), f, postWriteRefreshTimeout);
Expand Down Expand Up @@ -238,9 +238,9 @@ public void testWaitForWithNullLocationCompletedImmediately() throws IOException
);
// Randomly test scenarios with and without unpromotables
if (randomBoolean()) {
when(routingTable.allUnpromotableShards()).thenReturn(Collections.emptyList());
when(routingTable.unpromotableShards()).thenReturn(Collections.emptyList());
} else {
when(routingTable.allUnpromotableShards()).thenReturn(List.of(shardRouting));
when(routingTable.unpromotableShards()).thenReturn(List.of(shardRouting));
}
WriteRequest.RefreshPolicy policy = WriteRequest.RefreshPolicy.WAIT_UNTIL;
postWriteRefresh.refreshShard(policy, primary, null, f, postWriteRefreshTimeout);
Expand Down