-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Snapshot Stability Fixes #39502
Merged
original-brownbear
merged 2 commits into
elastic:6.7
from
original-brownbear:backport-snapshot-fixes-6.7
Mar 1, 2019
Merged
Snapshot Stability Fixes #39502
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import com.carrotsearch.hppc.cursors.ObjectObjectCursor; | ||
import org.elasticsearch.Version; | ||
import org.elasticsearch.cluster.ClusterState.Custom; | ||
import org.elasticsearch.common.Nullable; | ||
import org.elasticsearch.common.collect.ImmutableOpenMap; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
|
@@ -93,9 +94,11 @@ public static class Entry { | |
private final ImmutableOpenMap<String, List<ShardId>> waitingIndices; | ||
private final long startTime; | ||
private final long repositoryStateId; | ||
@Nullable private final String failure; | ||
|
||
public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, State state, List<IndexId> indices, | ||
long startTime, long repositoryStateId, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards) { | ||
long startTime, long repositoryStateId, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards, | ||
String failure) { | ||
this.state = state; | ||
this.snapshot = snapshot; | ||
this.includeGlobalState = includeGlobalState; | ||
|
@@ -110,15 +113,26 @@ public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, Sta | |
this.waitingIndices = findWaitingIndices(shards); | ||
} | ||
this.repositoryStateId = repositoryStateId; | ||
this.failure = failure; | ||
} | ||
|
||
public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, State state, List<IndexId> indices, | ||
long startTime, long repositoryStateId, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards) { | ||
this(snapshot, includeGlobalState, partial, state, indices, startTime, repositoryStateId, shards, null); | ||
} | ||
|
||
public Entry(Entry entry, State state, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards) { | ||
this(entry.snapshot, entry.includeGlobalState, entry.partial, state, entry.indices, entry.startTime, | ||
entry.repositoryStateId, shards); | ||
entry.repositoryStateId, shards, entry.failure); | ||
} | ||
|
||
public Entry(Entry entry, State state, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards, String failure) { | ||
this(entry.snapshot, entry.includeGlobalState, entry.partial, state, entry.indices, entry.startTime, | ||
entry.repositoryStateId, shards, failure); | ||
} | ||
|
||
public Entry(Entry entry, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards) { | ||
this(entry, entry.state, shards); | ||
this(entry, entry.state, shards, entry.failure); | ||
} | ||
|
||
public Snapshot snapshot() { | ||
|
@@ -157,6 +171,10 @@ public long getRepositoryStateId() { | |
return repositoryStateId; | ||
} | ||
|
||
public String failure() { | ||
return failure; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
|
@@ -437,14 +455,21 @@ public SnapshotsInProgress(StreamInput in) throws IOException { | |
if (in.getVersion().onOrAfter(REPOSITORY_ID_INTRODUCED_VERSION)) { | ||
repositoryStateId = in.readLong(); | ||
} | ||
final String failure; | ||
if (in.getVersion().onOrAfter(Version.V_6_7_0)) { | ||
failure = in.readOptionalString(); | ||
} else { | ||
failure = null; | ||
} | ||
entries[i] = new Entry(snapshot, | ||
includeGlobalState, | ||
partial, | ||
state, | ||
Collections.unmodifiableList(indexBuilder), | ||
startTime, | ||
repositoryStateId, | ||
builder.build()); | ||
builder.build(), | ||
failure); | ||
} | ||
this.entries = Arrays.asList(entries); | ||
} | ||
|
@@ -476,6 +501,9 @@ public void writeTo(StreamOutput out) throws IOException { | |
if (out.getVersion().onOrAfter(REPOSITORY_ID_INTRODUCED_VERSION)) { | ||
out.writeLong(entry.repositoryStateId); | ||
} | ||
if (out.getVersion().onOrAfter(Version.V_6_7_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. We will have to mute BwC tests before merging this and then adjust this version to |
||
out.writeOptionalString(entry.failure); | ||
} | ||
} | ||
} | ||
|
||
|
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.
We will have to mute BwC tests before merging this and then adjust this version to
6.7
inmaster
afterwards, currently we have a7.0.0
here in master.