Upgrade: Fix version check in bytes to upgrade that spans major versions

The previous check did not account for major version, so upgrading to
5.1 caused 4.1 (from 0.90.0.Beta1) to look the same as current master.
This commit is contained in:
Ryan Ernst 2015-01-16 10:33:35 -08:00
parent b9358ccca8
commit 795c347db3
2 changed files with 2 additions and 8 deletions

View File

@ -112,7 +112,8 @@ public class RestUpgradeAction extends BaseRestHandler {
for (ShardSegments segs : shard.getShards()) {
for (Segment seg : segs.getSegments()) {
total_bytes += seg.sizeInBytes;
if (seg.version.minor != Version.CURRENT.luceneVersion.minor) {
if (seg.version.major != Version.CURRENT.luceneVersion.major ||
seg.version.minor != Version.CURRENT.luceneVersion.minor) {
// TODO: this comparison is bogus! it would cause us to upgrade even with the same format
// instead, we should check if the codec has changed
to_upgrade_bytes += seg.sizeInBytes;

View File

@ -33,24 +33,17 @@ import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
import org.elasticsearch.test.rest.client.http.HttpRequestBuilder;
import org.hamcrest.Matchers;
import org.junit.Ignore;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
@Ignore(value="index-0.90.0.Beta1.zip fails the test")
public class OldIndexBackwardsCompatibilityTests extends StaticIndexBackwardCompatibilityTest {
// TODO: test for proper exception on unsupported indexes (maybe via separate test?)
// We have a 0.20.6.zip etc for this.