Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify setting index.store.type with smb_simple_fs and smb_mmap_fs
This commit changes work done in #60 by using automatic store type discovery which exists in elasticsearch core. Instead of writing configuration like: ```yaml index.store.type: org.elasticsearch.index.store.fs.SmbMmapFsIndexStoreModule index.store.type: org.elasticsearch.index.store.fs.SmbSimpleFsIndexStoreModule ``` We can now use: ```yaml index.store.type: smb_mmap_fs index.store.type: smb_simple_fs ``` Note that we move `org.elasticsearch.index.store.fs.SmbMmapFsIndexStoreModule` to `org.elasticsearch.index.store.smbmmapfs.SmbMmapFsIndexStoreModule` and `org.elasticsearch.index.store.fs.SmbSimpleFsDirectoryService` to `org.elasticsearch.index.store.smbsimplefs.SmbSimpleFsDirectoryService` instead of deprecating the old classes and add new ones. It means that if users were using a 2.5.2-SNAPSHOT version, they will need to update their settings. (cherry picked from commit 613ce5a) (cherry picked from commit 7831521)
- Loading branch information
Showing
10 changed files
with
131 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/org/elasticsearch/index/store/AbstractAzureFsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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 org.elasticsearch.action.search.SearchResponse; | ||
import org.elasticsearch.test.ElasticsearchIntegrationTest; | ||
import org.junit.Test; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
|
||
abstract public class AbstractAzureFsTest extends ElasticsearchIntegrationTest { | ||
|
||
@Test | ||
public void testAzureFs() { | ||
// Create an index and index some documents | ||
createIndex("test"); | ||
long nbDocs = randomIntBetween(10, 1000); | ||
for (long i = 0; i < nbDocs; i++) { | ||
index("test", "doc", "" + i, "foo", "bar"); | ||
} | ||
refresh(); | ||
SearchResponse response = client().prepareSearch("test").get(); | ||
assertThat(response.getHits().totalHits(), is(nbDocs)); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/test/java/org/elasticsearch/index/store/SmbMMapFsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 org.elasticsearch.common.settings.ImmutableSettings; | ||
import org.elasticsearch.common.settings.Settings; | ||
|
||
|
||
public class SmbMMapFsTest extends AbstractAzureFsTest { | ||
|
||
@Override | ||
public Settings indexSettings() { | ||
return ImmutableSettings.builder() | ||
.put(super.indexSettings()) | ||
.put("index.store.type", "smb_mmap_fs") | ||
.build(); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/org/elasticsearch/index/store/SmbSimpleFsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 org.elasticsearch.common.settings.ImmutableSettings; | ||
import org.elasticsearch.common.settings.Settings; | ||
|
||
|
||
public class SmbSimpleFsTest extends AbstractAzureFsTest { | ||
@Override | ||
public Settings indexSettings() { | ||
return ImmutableSettings.builder() | ||
.put(super.indexSettings()) | ||
.put("index.store.type", "smb_simple_fs") | ||
.build(); | ||
} | ||
} |