-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
SNAPSHOTS: Allow Parallel Restore Operations #36397
Merged
original-brownbear
merged 26 commits into
elastic:master
from
original-brownbear:parallel-restores
Dec 14, 2018
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
8e903ec
SNAPSHOTS: Allow Parallel Restore Operations
original-brownbear cee0adf
revert noisy cleanup
original-brownbear 7ceb2b6
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 9d18495
Add tests for parallel restore from single snapshot
original-brownbear 7411054
Add UUIDs and the ability to restore the same snapshot in parallel
original-brownbear f114c97
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear c0286da
CR: Add uuid to restore operations
original-brownbear d3cc957
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 8076986
Javadoc and cleanup uuid handling
original-brownbear f12d1fb
fix javadoc
original-brownbear d510c78
no need for uuid on restoreinfo
original-brownbear 87d3bf3
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 1de0350
Use map style access to restore in progress entries
original-brownbear b9e3a05
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 2a8573d
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 3c6cd85
remove noisy change
original-brownbear d4e19f5
remove noisy change
original-brownbear ff0596d
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 389ceee
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 7731a9d
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 183ded2
CR comments
original-brownbear 144aa26
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 808eac4
CR comments
original-brownbear 5c26af3
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 70e29d0
CR comments
original-brownbear 615bd69
Merge remote-tracking branch 'elastic/master' into parallel-restores
original-brownbear 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 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 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 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 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
package org.elasticsearch.cluster.routing; | ||
|
||
import org.elasticsearch.Version; | ||
import org.elasticsearch.cluster.RestoreInProgress; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.io.stream.Writeable; | ||
|
@@ -208,22 +209,33 @@ public String toString() { | |
* recovery from a snapshot | ||
*/ | ||
public static class SnapshotRecoverySource extends RecoverySource { | ||
private final String restoreUUID; | ||
private final Snapshot snapshot; | ||
private final String index; | ||
private final Version version; | ||
|
||
public SnapshotRecoverySource(Snapshot snapshot, Version version, String index) { | ||
public SnapshotRecoverySource(String restoreUUID, Snapshot snapshot, Version version, String index) { | ||
this.restoreUUID = restoreUUID; | ||
this.snapshot = Objects.requireNonNull(snapshot); | ||
this.version = Objects.requireNonNull(version); | ||
this.index = Objects.requireNonNull(index); | ||
} | ||
|
||
SnapshotRecoverySource(StreamInput in) throws IOException { | ||
if (in.getVersion().onOrAfter(Version.V_7_0_0)) { | ||
restoreUUID = in.readString(); | ||
} else { | ||
restoreUUID = RestoreInProgress.BWC_UUID; | ||
} | ||
snapshot = new Snapshot(in); | ||
version = Version.readVersion(in); | ||
index = in.readString(); | ||
} | ||
|
||
public String restoreUUID() { | ||
return restoreUUID; | ||
} | ||
|
||
public Snapshot snapshot() { | ||
return snapshot; | ||
} | ||
|
@@ -238,6 +250,9 @@ public Version version() { | |
|
||
@Override | ||
protected void writeAdditionalFields(StreamOutput out) throws IOException { | ||
if (out.getVersion().onOrAfter(Version.V_7_0_0)) { | ||
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. write this before snapshot field? |
||
out.writeString(restoreUUID); | ||
} | ||
snapshot.writeTo(out); | ||
Version.writeVersion(version, out); | ||
out.writeString(index); | ||
|
@@ -253,12 +268,13 @@ public void addAdditionalFields(XContentBuilder builder, ToXContent.Params param | |
builder.field("repository", snapshot.getRepository()) | ||
.field("snapshot", snapshot.getSnapshotId().getName()) | ||
.field("version", version.toString()) | ||
.field("index", index); | ||
.field("index", index) | ||
.field("restoreUUID", restoreUUID); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "snapshot recovery from " + snapshot.toString(); | ||
return "snapshot recovery [" + restoreUUID + "] from " + snapshot; | ||
} | ||
|
||
@Override | ||
|
@@ -271,12 +287,13 @@ public boolean equals(Object o) { | |
} | ||
|
||
SnapshotRecoverySource that = (SnapshotRecoverySource) o; | ||
return snapshot.equals(that.snapshot) && index.equals(that.index) && version.equals(that.version); | ||
return restoreUUID.equals(that.restoreUUID) && snapshot.equals(that.snapshot) | ||
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. also adapt hashCode |
||
&& index.equals(that.index) && version.equals(that.version); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(snapshot, index, version); | ||
return Objects.hash(restoreUUID, snapshot, index, version); | ||
} | ||
|
||
} | ||
|
This file contains 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.
Lookup of in progress restores works by
String
uuid
now :)