Remove Deprecated SimpleFS (#1639)

Lucene 9 removes support for SimpleFS File System format. This PR completely
removes SimpleFS support which was deprecated in a previous PR.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-12-03 10:57:59 -05:00 committed by GitHub
parent 77d9b643b2
commit 17e7a4962d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 193 deletions

View File

@ -1,42 +0,0 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* 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.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
package org.opensearch.index.store;
import org.opensearch.common.settings.Settings;
public class SmbSimpleFsTests extends AbstractAzureFsTestCase {
@Override
public Settings indexSettings() {
return Settings.builder().put(super.indexSettings()).put("index.store.type", "smb_simple_fs").build();
}
}

View File

@ -1,65 +0,0 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* 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.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
package org.opensearch.index.store.smbsimplefs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.SimpleFSDirectory;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.store.FsDirectoryFactory;
import org.opensearch.index.store.SmbDirectoryWrapper;
import java.io.IOException;
import java.nio.file.Path;
/**
* Factory to create a new Simple File System type directory accessible as a SMB share
*
* @deprecated use {@link org.opensearch.index.store.smbniofs.SmbNIOFsDirectoryFactory} instead
*/
@Deprecated
public final class SmbSimpleFsDirectoryFactory extends FsDirectoryFactory {
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(SmbSimpleFsDirectoryFactory.class);
@Override
protected Directory newFSDirectory(Path location, LockFactory lockFactory, IndexSettings indexSettings) throws IOException {
DEPRECATION_LOGGER.deprecate(
IndexModule.Type.SIMPLEFS.getSettingsKey(),
IndexModule.Type.SIMPLEFS.getSettingsKey() + " is deprecated and will be removed in 2.0"
);
return new SmbDirectoryWrapper(new SimpleFSDirectory(location, lockFactory));
}
}

View File

@ -32,11 +32,8 @@
package org.opensearch.plugin.store.smb;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.index.IndexModule;
import org.opensearch.index.store.smbmmapfs.SmbMmapFsDirectoryFactory;
import org.opensearch.index.store.smbniofs.SmbNIOFsDirectoryFactory;
import org.opensearch.index.store.smbsimplefs.SmbSimpleFsDirectoryFactory;
import org.opensearch.plugins.IndexStorePlugin;
import org.opensearch.plugins.Plugin;
@ -46,17 +43,10 @@ import java.util.Map;
public class SMBStorePlugin extends Plugin implements IndexStorePlugin {
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(SMBStorePlugin.class);
@Override
public Map<String, DirectoryFactory> getDirectoryFactories() {
final Map<String, DirectoryFactory> indexStoreFactories = new HashMap<>(2);
indexStoreFactories.put("smb_mmap_fs", new SmbMmapFsDirectoryFactory());
DEPRECATION_LOGGER.deprecate(
IndexModule.Type.SIMPLEFS.getSettingsKey(),
IndexModule.Type.SIMPLEFS.getSettingsKey() + " is deprecated and will be removed in 2.0"
);
indexStoreFactories.put("smb_simple_fs", new SmbSimpleFsDirectoryFactory());
indexStoreFactories.put("smb_nio_fs", new SmbNIOFsDirectoryFactory());
return Collections.unmodifiableMap(indexStoreFactories);
}

View File

@ -1,54 +0,0 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* 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.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
package org.opensearch.index.store;
import java.io.IOException;
import java.nio.file.Path;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.SimpleFSDirectory;
public class SmbSimpleFSDirectoryTests extends OpenSearchBaseDirectoryTestCase {
@Override
protected Directory getDirectory(Path file) throws IOException {
return new SmbDirectoryWrapper(new SimpleFSDirectory(file));
}
@Override
public void testCreateOutputForExistingFile() throws IOException {
/**
* This test is disabled because {@link SmbDirectoryWrapper} opens existing file
* with an explicit StandardOpenOption.TRUNCATE_EXISTING option.
*/
}
}

View File

@ -42,9 +42,7 @@ import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.store.NativeFSLockFactory;
import org.apache.lucene.store.SimpleFSDirectory;
import org.apache.lucene.store.SimpleFSLockFactory;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
import org.opensearch.core.internal.io.IOUtils;
@ -61,8 +59,6 @@ import java.util.Set;
public class FsDirectoryFactory implements IndexStorePlugin.DirectoryFactory {
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(FsDirectoryFactory.class);
public static final Setting<LockFactory> INDEX_LOCK_FACTOR_SETTING = new Setting<>("index.store.fs.fs_lock", "native", (s) -> {
switch (s) {
case "native":
@ -104,15 +100,8 @@ public class FsDirectoryFactory implements IndexStorePlugin.DirectoryFactory {
}
case MMAPFS:
return setPreload(new MMapDirectory(location, lockFactory), lockFactory, preLoadExtensions);
// simplefs was removed in Lucene 9; support for enum is maintained for bwc
case SIMPLEFS:
DEPRECATION_LOGGER.deprecate(
IndexModule.Type.SIMPLEFS.getSettingsKey(),
IndexModule.Type.SIMPLEFS.getSettingsKey()
+ " is no longer supported and will be removed in 2.0. Use ["
+ IndexModule.Type.NIOFS.getSettingsKey()
+ "], which offers equal or better performance, instead."
);
return new SimpleFSDirectory(location, lockFactory);
case NIOFS:
return new NIOFSDirectory(location, lockFactory);
default:

View File

@ -37,7 +37,6 @@ import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.store.NoLockFactory;
import org.apache.lucene.store.SimpleFSDirectory;
import org.apache.lucene.store.SleepingLockWrapper;
import org.apache.lucene.util.Constants;
import org.opensearch.Version;
@ -157,24 +156,17 @@ public class FsDirectoryFactoryTests extends OpenSearchTestCase {
case HYBRIDFS:
assertTrue(FsDirectoryFactory.isHybridFs(directory));
break;
// simplefs was removed in Lucene 9; support for enum is maintained for bwc
case SIMPLEFS:
case NIOFS:
assertTrue(type + " " + directory.toString(), directory instanceof NIOFSDirectory);
break;
case MMAPFS:
assertTrue(type + " " + directory.toString(), directory instanceof MMapDirectory);
break;
case SIMPLEFS:
assertWarnings(
"simplefs is no longer supported and will be removed in 2.0. Use [niofs], which offers equal "
+ "or better performance, instead."
);
assertTrue(type + " " + directory.toString(), directory instanceof SimpleFSDirectory);
break;
case FS:
if (Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {
assertTrue(FsDirectoryFactory.isHybridFs(directory));
} else if (Constants.WINDOWS) {
assertTrue(directory.toString(), directory instanceof SimpleFSDirectory);
} else {
assertTrue(directory.toString(), directory instanceof NIOFSDirectory);
}