Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Replication unit tests using real shards #18930

Merged
merged 2 commits into from
Jun 18, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -78,11 +78,11 @@ public class ReplicationOperation<

private final List<ReplicationResponse.ShardInfo.Failure> shardReplicaFailures = Collections.synchronizedList(new ArrayList<>());

ReplicationOperation(Request request, Primary<Request, ReplicaRequest, PrimaryResultT> primary,
ActionListener<PrimaryResultT> listener,
boolean executeOnReplicas, boolean checkWriteConsistency,
Replicas<ReplicaRequest> replicas,
Supplier<ClusterState> clusterStateSupplier, ESLogger logger, String opType) {
public ReplicationOperation(Request request, Primary<Request, ReplicaRequest, PrimaryResultT> primary,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of making it public maybe we move this entire package into core/src/test/java/org/elasticsearch/index/replication/ or even move everything into core/src/test/java/org/elasticsearch/index/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could, problem is that ReplicationOperation is currently part of the universe of actions and is also used by TransportReplicationAction (which is subclassed by TransportIndexAction, for example) - so moving it will cause problems with those actions. IMO it's not a big deal to make this public?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure - I just think we can move all of them in one package :)

ActionListener<PrimaryResultT> listener,
boolean executeOnReplicas, boolean checkWriteConsistency,
Replicas<ReplicaRequest> replicas,
Supplier<ClusterState> clusterStateSupplier, ESLogger logger, String opType) {
this.checkWriteConsistency = checkWriteConsistency;
this.executeOnReplicas = executeOnReplicas;
this.replicasProxy = replicas;
Expand All @@ -94,7 +94,7 @@ public class ReplicationOperation<
this.opType = opType;
}

void execute() throws Exception {
public void execute() throws Exception {
final String writeConsistencyFailure = checkWriteConsistency ? checkWriteConsistency() : null;
final ShardRouting primaryRouting = primary.routingEntry();
final ShardId primaryId = primaryRouting.shardId();
Expand Down Expand Up @@ -294,7 +294,7 @@ public static boolean isConflictException(Throwable e) {
}


interface Primary<
public interface Primary<
Request extends ReplicationRequest<Request>,
ReplicaRequest extends ReplicationRequest<ReplicaRequest>,
PrimaryResultT extends PrimaryResult<ReplicaRequest>
Expand Down Expand Up @@ -322,7 +322,7 @@ interface Primary<

}

interface Replicas<ReplicaRequest extends ReplicationRequest<ReplicaRequest>> {
public interface Replicas<ReplicaRequest extends ReplicationRequest<ReplicaRequest>> {

/**
* performs the the given request on the specified replica
Expand Down Expand Up @@ -366,7 +366,7 @@ public RetryOnPrimaryException(StreamInput in) throws IOException {
}
}

interface PrimaryResult<R extends ReplicationRequest<R>> {
public interface PrimaryResult<R extends ReplicationRequest<R>> {

R replicaRequest();

Expand Down
Loading