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:
parent
77d9b643b2
commit
17e7a4962d
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,11 +32,8 @@
|
||||||
|
|
||||||
package org.opensearch.plugin.store.smb;
|
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.smbmmapfs.SmbMmapFsDirectoryFactory;
|
||||||
import org.opensearch.index.store.smbniofs.SmbNIOFsDirectoryFactory;
|
import org.opensearch.index.store.smbniofs.SmbNIOFsDirectoryFactory;
|
||||||
import org.opensearch.index.store.smbsimplefs.SmbSimpleFsDirectoryFactory;
|
|
||||||
import org.opensearch.plugins.IndexStorePlugin;
|
import org.opensearch.plugins.IndexStorePlugin;
|
||||||
import org.opensearch.plugins.Plugin;
|
import org.opensearch.plugins.Plugin;
|
||||||
|
|
||||||
|
@ -46,17 +43,10 @@ import java.util.Map;
|
||||||
|
|
||||||
public class SMBStorePlugin extends Plugin implements IndexStorePlugin {
|
public class SMBStorePlugin extends Plugin implements IndexStorePlugin {
|
||||||
|
|
||||||
private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(SMBStorePlugin.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, DirectoryFactory> getDirectoryFactories() {
|
public Map<String, DirectoryFactory> getDirectoryFactories() {
|
||||||
final Map<String, DirectoryFactory> indexStoreFactories = new HashMap<>(2);
|
final Map<String, DirectoryFactory> indexStoreFactories = new HashMap<>(2);
|
||||||
indexStoreFactories.put("smb_mmap_fs", new SmbMmapFsDirectoryFactory());
|
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());
|
indexStoreFactories.put("smb_nio_fs", new SmbNIOFsDirectoryFactory());
|
||||||
return Collections.unmodifiableMap(indexStoreFactories);
|
return Collections.unmodifiableMap(indexStoreFactories);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,9 +42,7 @@ import org.apache.lucene.store.LockFactory;
|
||||||
import org.apache.lucene.store.MMapDirectory;
|
import org.apache.lucene.store.MMapDirectory;
|
||||||
import org.apache.lucene.store.NIOFSDirectory;
|
import org.apache.lucene.store.NIOFSDirectory;
|
||||||
import org.apache.lucene.store.NativeFSLockFactory;
|
import org.apache.lucene.store.NativeFSLockFactory;
|
||||||
import org.apache.lucene.store.SimpleFSDirectory;
|
|
||||||
import org.apache.lucene.store.SimpleFSLockFactory;
|
import org.apache.lucene.store.SimpleFSLockFactory;
|
||||||
import org.opensearch.common.logging.DeprecationLogger;
|
|
||||||
import org.opensearch.common.settings.Setting;
|
import org.opensearch.common.settings.Setting;
|
||||||
import org.opensearch.common.settings.Setting.Property;
|
import org.opensearch.common.settings.Setting.Property;
|
||||||
import org.opensearch.core.internal.io.IOUtils;
|
import org.opensearch.core.internal.io.IOUtils;
|
||||||
|
@ -61,8 +59,6 @@ import java.util.Set;
|
||||||
|
|
||||||
public class FsDirectoryFactory implements IndexStorePlugin.DirectoryFactory {
|
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) -> {
|
public static final Setting<LockFactory> INDEX_LOCK_FACTOR_SETTING = new Setting<>("index.store.fs.fs_lock", "native", (s) -> {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case "native":
|
case "native":
|
||||||
|
@ -104,15 +100,8 @@ public class FsDirectoryFactory implements IndexStorePlugin.DirectoryFactory {
|
||||||
}
|
}
|
||||||
case MMAPFS:
|
case MMAPFS:
|
||||||
return setPreload(new MMapDirectory(location, lockFactory), lockFactory, preLoadExtensions);
|
return setPreload(new MMapDirectory(location, lockFactory), lockFactory, preLoadExtensions);
|
||||||
|
// simplefs was removed in Lucene 9; support for enum is maintained for bwc
|
||||||
case SIMPLEFS:
|
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:
|
case NIOFS:
|
||||||
return new NIOFSDirectory(location, lockFactory);
|
return new NIOFSDirectory(location, lockFactory);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.apache.lucene.store.IOContext;
|
||||||
import org.apache.lucene.store.MMapDirectory;
|
import org.apache.lucene.store.MMapDirectory;
|
||||||
import org.apache.lucene.store.NIOFSDirectory;
|
import org.apache.lucene.store.NIOFSDirectory;
|
||||||
import org.apache.lucene.store.NoLockFactory;
|
import org.apache.lucene.store.NoLockFactory;
|
||||||
import org.apache.lucene.store.SimpleFSDirectory;
|
|
||||||
import org.apache.lucene.store.SleepingLockWrapper;
|
import org.apache.lucene.store.SleepingLockWrapper;
|
||||||
import org.apache.lucene.util.Constants;
|
import org.apache.lucene.util.Constants;
|
||||||
import org.opensearch.Version;
|
import org.opensearch.Version;
|
||||||
|
@ -157,24 +156,17 @@ public class FsDirectoryFactoryTests extends OpenSearchTestCase {
|
||||||
case HYBRIDFS:
|
case HYBRIDFS:
|
||||||
assertTrue(FsDirectoryFactory.isHybridFs(directory));
|
assertTrue(FsDirectoryFactory.isHybridFs(directory));
|
||||||
break;
|
break;
|
||||||
|
// simplefs was removed in Lucene 9; support for enum is maintained for bwc
|
||||||
|
case SIMPLEFS:
|
||||||
case NIOFS:
|
case NIOFS:
|
||||||
assertTrue(type + " " + directory.toString(), directory instanceof NIOFSDirectory);
|
assertTrue(type + " " + directory.toString(), directory instanceof NIOFSDirectory);
|
||||||
break;
|
break;
|
||||||
case MMAPFS:
|
case MMAPFS:
|
||||||
assertTrue(type + " " + directory.toString(), directory instanceof MMapDirectory);
|
assertTrue(type + " " + directory.toString(), directory instanceof MMapDirectory);
|
||||||
break;
|
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:
|
case FS:
|
||||||
if (Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {
|
if (Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {
|
||||||
assertTrue(FsDirectoryFactory.isHybridFs(directory));
|
assertTrue(FsDirectoryFactory.isHybridFs(directory));
|
||||||
} else if (Constants.WINDOWS) {
|
|
||||||
assertTrue(directory.toString(), directory instanceof SimpleFSDirectory);
|
|
||||||
} else {
|
} else {
|
||||||
assertTrue(directory.toString(), directory instanceof NIOFSDirectory);
|
assertTrue(directory.toString(), directory instanceof NIOFSDirectory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue