Skip to content

Commit 88eac6f

Browse files
committed
Remove more legacy stuff
1 parent ec76043 commit 88eac6f

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

server/src/main/java/org/elasticsearch/gateway/MetaDataStateFormat.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ public abstract class MetaDataStateFormat<T> {
6767
public static final String STATE_FILE_EXTENSION = ".st";
6868

6969
private static final String STATE_FILE_CODEC = "state";
70-
private static final int MIN_COMPATIBLE_STATE_FILE_VERSION = 0;
70+
private static final int MIN_COMPATIBLE_STATE_FILE_VERSION = 1;
7171
private static final int STATE_FILE_VERSION = 1;
72-
private static final int STATE_FILE_VERSION_ES_2X_AND_BELOW = 0;
7372
private static final int BUFFER_SIZE = 4096;
7473
private final String prefix;
7574
private final Pattern stateFilePattern;
@@ -183,16 +182,11 @@ public final T read(NamedXContentRegistry namedXContentRegistry, Path file) thro
183182
try (IndexInput indexInput = dir.openInput(file.getFileName().toString(), IOContext.DEFAULT)) {
184183
// We checksum the entire file before we even go and parse it. If it's corrupted we barf right here.
185184
CodecUtil.checksumEntireFile(indexInput);
186-
final int fileVersion = CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, MIN_COMPATIBLE_STATE_FILE_VERSION,
187-
STATE_FILE_VERSION);
185+
CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, MIN_COMPATIBLE_STATE_FILE_VERSION, STATE_FILE_VERSION);
188186
final XContentType xContentType = XContentType.values()[indexInput.readInt()];
189187
if (xContentType != FORMAT) {
190188
throw new IllegalStateException("expected state in " + file + " to be " + FORMAT + " format but was " + xContentType);
191189
}
192-
if (fileVersion == STATE_FILE_VERSION_ES_2X_AND_BELOW) {
193-
// format version 0, wrote a version that always came from the content state file and was never used
194-
indexInput.readLong(); // version currently unused
195-
}
196190
long filePointer = indexInput.getFilePointer();
197191
long contentSize = indexInput.length() - CodecUtil.footerLength() - filePointer;
198192
try (IndexInput slice = indexInput.slice("state_xcontent", filePointer, contentSize)) {

server/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ protected Settings prepareBackwardsDataDir(Path backwardsIndex) throws IOExcepti
8181
return builder.build();
8282
}
8383

84-
public void testUpgradeStartClusterOn_0_20_6() throws Exception {
85-
String indexName = "unsupported-0.20.6";
84+
public void testUpgradeStartClusterOn_2_4_5() throws Exception {
85+
String indexName = "unsupported-2.4.5";
8686

8787
logger.info("Checking static index {}", indexName);
8888
Settings nodeSettings = prepareBackwardsDataDir(getBwcIndicesPath().resolve(indexName + ".zip"));
8989
try {
9090
internalCluster().startNode(nodeSettings);
9191
fail();
9292
} catch (Exception ex) {
93-
assertThat(ex.getCause().getCause().getMessage(), containsString(" was created before v2.0.0.beta1 and wasn't upgraded"));
93+
assertThat(ex.getCause().getCause().getMessage(), containsString("Format version is not supported"));
9494
}
9595
}
9696
}

0 commit comments

Comments
 (0)