remove unnecessary bwc tests

This commit is contained in:
Simon Willnauer 2015-10-08 16:04:07 +02:00
parent 4d38b8f959
commit 867882cd32
2 changed files with 0 additions and 122 deletions

View File

@ -113,49 +113,10 @@ public class MetaDataIndexUpgradeService extends AbstractComponent {
IndexMetaData newMetaData = upgradeLegacyRoutingSettings(indexMetaData); IndexMetaData newMetaData = upgradeLegacyRoutingSettings(indexMetaData);
newMetaData = addDefaultUnitsIfNeeded(newMetaData); newMetaData = addDefaultUnitsIfNeeded(newMetaData);
checkMappingsCompatibility(newMetaData); checkMappingsCompatibility(newMetaData);
newMetaData = upgradeSettings(newMetaData);
newMetaData = markAsUpgraded(newMetaData); newMetaData = markAsUpgraded(newMetaData);
return newMetaData; return newMetaData;
} }
IndexMetaData upgradeSettings(IndexMetaData indexMetaData) {
final String storeType = indexMetaData.getSettings().get(IndexStoreModule.STORE_TYPE);
if (storeType != null) {
final String upgradeStoreType;
switch (storeType.toLowerCase(Locale.ROOT)) {
case "nio_fs":
case "niofs":
upgradeStoreType = "niofs";
break;
case "mmap_fs":
case "mmapfs":
upgradeStoreType = "mmapfs";
break;
case "simple_fs":
case "simplefs":
upgradeStoreType = "simplefs";
break;
case "default":
upgradeStoreType = "default";
break;
case "fs":
upgradeStoreType = "fs";
break;
default:
upgradeStoreType = storeType;
}
if (storeType.equals(upgradeStoreType) == false) {
Settings indexSettings = Settings.builder().put(indexMetaData.settings())
.put(IndexStoreModule.STORE_TYPE, upgradeStoreType)
.build();
return IndexMetaData.builder(indexMetaData)
.version(indexMetaData.version())
.settings(indexSettings)
.build();
}
}
return indexMetaData;
}
/** /**
* Checks if the index was already opened by this version of Elasticsearch and doesn't require any additional checks. * Checks if the index was already opened by this version of Elasticsearch and doesn't require any additional checks.

View File

@ -1,83 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.index.store;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.lucene.store.*;
import org.apache.lucene.util.Constants;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.ESTestCase;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Locale;
/**
*/
public class IndexStoreBWCTests extends ESSingleNodeTestCase {
public void testOldCoreTypesFail() {
try {
createIndex("test", Settings.builder().put(IndexStoreModule.STORE_TYPE, "nio_fs").build());
fail();
} catch (Exception ex) {
}
try {
createIndex("test", Settings.builder().put(IndexStoreModule.STORE_TYPE, "mmap_fs").build());
fail();
} catch (Exception ex) {
}
try {
createIndex("test", Settings.builder().put(IndexStoreModule.STORE_TYPE, "simple_fs").build());
fail();
} catch (Exception ex) {
}
}
public void testUpgradeCoreTypes() throws IOException {
String type = RandomPicks.randomFrom(random(), Arrays.asList("nio", "mmap", "simple"));
createIndex("test", Settings.builder()
.put(IndexStoreModule.STORE_TYPE, type+"fs")
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_7_0)
.build());
client().admin().indices().prepareClose("test").get();
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder()
.put(IndexStoreModule.STORE_TYPE, type + "_fs").build()).get();
GetSettingsResponse getSettingsResponse = client().admin().indices().prepareGetSettings("test").get();
String actualType = getSettingsResponse.getSetting("test", IndexStoreModule.STORE_TYPE);
assertEquals(type + "_fs", actualType);
// now reopen and upgrade
client().admin().indices().prepareOpen("test").get();
getSettingsResponse = client().admin().indices().prepareGetSettings("test").get();
actualType = getSettingsResponse.getSetting("test", IndexStoreModule.STORE_TYPE);
assertEquals(type+"fs", actualType);
}
}