Skip to content

Commit

Permalink
Internal: fix shard state tranport action names
Browse files Browse the repository at this point in the history
When we renamed all of the transport actions in #7105, shard started and failed were flipped around by mistake.
This didn't cause any actual problem as the change was made in a backwards compatible manner. That said the action names ended up being wrong (just a naming problem, meaning that started == failed and failed ==started) and we have to fix it, still maintaining backwards compatibility.

Closes #9440
  • Loading branch information
javanna committed Jan 27, 2015
1 parent 77b4aca commit 6b6e046
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Expand Up @@ -52,8 +52,8 @@
*/
public class ShardStateAction extends AbstractComponent {

public static final String SHARD_STARTED_ACTION_NAME = "internal:cluster/shard/failure";
public static final String SHARD_FAILED_ACTION_NAME = "internal:cluster/shard/started";
public static final String SHARD_STARTED_ACTION_NAME = "internal:cluster/shard/started";
public static final String SHARD_FAILED_ACTION_NAME = "internal:cluster/shard/failure";

private final TransportService transportService;
private final ClusterService clusterService;
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/org/elasticsearch/transport/ActionNames.java
Expand Up @@ -158,6 +158,17 @@ static String incomingAction(String action, Version version) {
return post_1_4_action;
}
}
if (version.onOrAfter(Version.V_1_4_0_Beta1) && version.before(Version.V_1_5_0)) {
//when we renamed the transport actions in #7105, shard started and failed were flipped around
//this didn't cause any actual problem as it was done in a backwards compatible manner.
//That said the action names were wrong and we have to fix it still maintaining backwards compatibility
if (action.equals(ShardStateAction.SHARD_FAILED_ACTION_NAME)) {
return ShardStateAction.SHARD_STARTED_ACTION_NAME;
}
if (action.equals(ShardStateAction.SHARD_STARTED_ACTION_NAME)) {
return ShardStateAction.SHARD_FAILED_ACTION_NAME;
}
}
return action;
}

Expand All @@ -173,6 +184,17 @@ static String outgoingAction(String action, Version version) {
return pre_1_4_Action;
}
}
if (version.onOrAfter(Version.V_1_4_0_Beta1) && version.before(Version.V_1_5_0)) {
//when we renamed the transport actions in #7105, shard started and failed were flipped around
//this didn't cause any actual problem as it was done in a backwards compatible manner.
//That said the action names were wrong and we have to fix it still maintaining backwards compatibility
if (action.equals(ShardStateAction.SHARD_FAILED_ACTION_NAME)) {
return ShardStateAction.SHARD_STARTED_ACTION_NAME;
}
if (action.equals(ShardStateAction.SHARD_STARTED_ACTION_NAME)) {
return ShardStateAction.SHARD_FAILED_ACTION_NAME;
}
}
return action;
}

Expand Down

0 comments on commit 6b6e046

Please sign in to comment.