-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Cleanup TransportReplicationAction #12395
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
Closed
martijnvg
wants to merge
10
commits into
elastic:master
from
martijnvg:cleanup_transport_replication_action
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b06485
Split the actual primary operation from the primary phase into a dedi…
martijnvg d5b551c
don't fall back to the coordinating node if RetryOnPrimaryException o…
martijnvg 5ba4283
In the event that a primary or replica action needs to be retried loc…
martijnvg 405402c
test: removed the custom shardId integer and instead use the Replicat…
martijnvg 07ef93f
Added test from Britta's PR #12574 that shows how an index request ca…
martijnvg 51bfdb8
Execute the retry logic only on the coordinating node.
martijnvg b35f12c
applied feedback
martijnvg 2abe7c4
use mock transport via plugin instead of setting it directly via a se…
martijnvg 3f64076
bring back the primary shard chasing to the PrimaryPhase
martijnvg 356161e
removed endless indexing test, since the chasing primary logic was br…
martijnvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,10 @@ | |
import org.elasticsearch.action.IndicesRequest; | ||
import org.elasticsearch.action.WriteConsistencyLevel; | ||
import org.elasticsearch.action.support.IndicesOptions; | ||
import org.elasticsearch.cluster.routing.ShardRouting; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.unit.TimeValue; | ||
import org.elasticsearch.index.shard.ShardId; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
|
@@ -41,12 +41,11 @@ public abstract class ReplicationRequest<T extends ReplicationRequest> extends A | |
|
||
public static final TimeValue DEFAULT_TIMEOUT = new TimeValue(1, TimeUnit.MINUTES); | ||
|
||
ShardId internalShardId; | ||
ShardRouting internalShardRouting; | ||
|
||
protected TimeValue timeout = DEFAULT_TIMEOUT; | ||
protected String index; | ||
|
||
private boolean threadedOperation = true; | ||
private WriteConsistencyLevel consistencyLevel = WriteConsistencyLevel.DEFAULT; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. w00t :) |
||
private volatile boolean canHaveDuplicates = false; | ||
|
||
|
@@ -76,7 +75,6 @@ protected ReplicationRequest(T request, ActionRequest originalRequest) { | |
super(originalRequest); | ||
this.timeout = request.timeout(); | ||
this.index = request.index(); | ||
this.threadedOperation = request.operationThreaded(); | ||
this.consistencyLevel = request.consistencyLevel(); | ||
} | ||
|
||
|
@@ -91,23 +89,6 @@ public boolean canHaveDuplicates() { | |
return canHaveDuplicates; | ||
} | ||
|
||
/** | ||
* Controls if the operation will be executed on a separate thread when executed locally. | ||
*/ | ||
public final boolean operationThreaded() { | ||
return threadedOperation; | ||
} | ||
|
||
/** | ||
* Controls if the operation will be executed on a separate thread when executed locally. Defaults | ||
* to <tt>true</tt> when running in embedded mode. | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
public final T operationThreaded(boolean threadedOperation) { | ||
this.threadedOperation = threadedOperation; | ||
return (T) this; | ||
} | ||
|
||
/** | ||
* A timeout to wait if the index operation can't be performed immediately. Defaults to <tt>1m</tt>. | ||
*/ | ||
|
@@ -174,19 +155,18 @@ public ActionRequestValidationException validate() { | |
public void readFrom(StreamInput in) throws IOException { | ||
super.readFrom(in); | ||
if (in.readBoolean()) { | ||
internalShardId = ShardId.readShardId(in); | ||
internalShardRouting = ShardRouting.readShardRoutingEntry(in); | ||
} | ||
consistencyLevel = WriteConsistencyLevel.fromId(in.readByte()); | ||
timeout = TimeValue.readTimeValue(in); | ||
index = in.readString(); | ||
canHaveDuplicates = in.readBoolean(); | ||
// no need to serialize threaded* parameters, since they only matter locally | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
out.writeOptionalStreamable(internalShardId); | ||
out.writeOptionalStreamable(internalShardRouting); | ||
out.writeByte(consistencyLevel.id()); | ||
timeout.writeTo(out); | ||
out.writeString(index); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this change? see other comment on transport replication action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
AsyncPrimaryAction
is using this now. We can remove this but then we need to resolve the primary twice. I don't have a real preference, since it is all local now.