diff --git a/plugins/store-smb/src/internalClusterTest/java/org/opensearch/index/store/SmbSimpleFsTests.java b/plugins/store-smb/src/internalClusterTest/java/org/opensearch/index/store/SmbSimpleFsTests.java deleted file mode 100644 index 266801829d4..00000000000 --- a/plugins/store-smb/src/internalClusterTest/java/org/opensearch/index/store/SmbSimpleFsTests.java +++ /dev/null @@ -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(); - } -} diff --git a/plugins/store-smb/src/main/java/org/opensearch/index/store/smbsimplefs/SmbSimpleFsDirectoryFactory.java b/plugins/store-smb/src/main/java/org/opensearch/index/store/smbsimplefs/SmbSimpleFsDirectoryFactory.java deleted file mode 100644 index 83f176e99dd..00000000000 --- a/plugins/store-smb/src/main/java/org/opensearch/index/store/smbsimplefs/SmbSimpleFsDirectoryFactory.java +++ /dev/null @@ -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)); - } -} diff --git a/plugins/store-smb/src/main/java/org/opensearch/plugin/store/smb/SMBStorePlugin.java b/plugins/store-smb/src/main/java/org/opensearch/plugin/store/smb/SMBStorePlugin.java index 22fb6de8299..d5ad34eef0e 100644 --- a/plugins/store-smb/src/main/java/org/opensearch/plugin/store/smb/SMBStorePlugin.java +++ b/plugins/store-smb/src/main/java/org/opensearch/plugin/store/smb/SMBStorePlugin.java @@ -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 getDirectoryFactories() { final Map 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); } diff --git a/plugins/store-smb/src/test/java/org/opensearch/index/store/SmbSimpleFSDirectoryTests.java b/plugins/store-smb/src/test/java/org/opensearch/index/store/SmbSimpleFSDirectoryTests.java deleted file mode 100644 index 95a069a5d05..00000000000 --- a/plugins/store-smb/src/test/java/org/opensearch/index/store/SmbSimpleFSDirectoryTests.java +++ /dev/null @@ -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. - */ - } -} diff --git a/server/src/main/java/org/opensearch/index/store/FsDirectoryFactory.java b/server/src/main/java/org/opensearch/index/store/FsDirectoryFactory.java index 49302d5fe8e..2539968b20b 100644 --- a/server/src/main/java/org/opensearch/index/store/FsDirectoryFactory.java +++ b/server/src/main/java/org/opensearch/index/store/FsDirectoryFactory.java @@ -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 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: diff --git a/server/src/test/java/org/opensearch/index/store/FsDirectoryFactoryTests.java b/server/src/test/java/org/opensearch/index/store/FsDirectoryFactoryTests.java index c725222a048..70d4ae790f1 100644 --- a/server/src/test/java/org/opensearch/index/store/FsDirectoryFactoryTests.java +++ b/server/src/test/java/org/opensearch/index/store/FsDirectoryFactoryTests.java @@ -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); }