Skip to content

Commit 116cfce

Browse files
committed
FS Gateway: Change indices location (Requires manual upgrade), closes #188.
1 parent 32829ae commit 116cfce

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexGateway.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,23 @@
4141
*/
4242
public class FsIndexGateway extends AbstractIndexComponent implements IndexGateway {
4343

44-
private final Environment environment;
45-
46-
private final Gateway gateway;
47-
4844
private final String location;
4945

5046
private File indexGatewayHome;
5147

5248
@Inject public FsIndexGateway(Index index, @IndexSettings Settings indexSettings, Environment environment, Gateway gateway) {
5349
super(index, indexSettings);
54-
this.environment = environment;
55-
this.gateway = gateway;
5650

5751
String location = componentSettings.get("location");
5852
if (location == null) {
5953
if (gateway instanceof FsGateway) {
60-
indexGatewayHome = new File(((FsGateway) gateway).gatewayHome(), index().name());
54+
indexGatewayHome = new File(new File(((FsGateway) gateway).gatewayHome(), "indices"), index.name());
6155
} else {
62-
indexGatewayHome = new File(new File(environment.workWithClusterFile(), "gateway"), index().name());
56+
indexGatewayHome = new File(new File(new File(environment.workWithClusterFile(), "gateway"), "indices"), index.name());
6357
}
6458
location = Strings.cleanPath(indexGatewayHome.getAbsolutePath());
6559
} else {
66-
indexGatewayHome = new File(location);
60+
indexGatewayHome = new File(new File(location), index.name());
6761
}
6862
this.location = location;
6963

plugins/hadoop/src/test/java/org/elasticsearch/hadoop/gateway/HdfsGatewayTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import org.elasticsearch.util.logging.ESLogger;
3333
import org.elasticsearch.util.logging.Loggers;
3434
import org.elasticsearch.util.settings.Settings;
35-
import org.testng.annotations.AfterTest;
36-
import org.testng.annotations.BeforeTest;
35+
import org.testng.annotations.AfterMethod;
36+
import org.testng.annotations.BeforeMethod;
3737
import org.testng.annotations.Test;
3838

3939
import static org.elasticsearch.client.Requests.*;
@@ -51,7 +51,7 @@ public class HdfsGatewayTests {
5151

5252
private Node node;
5353

54-
@BeforeTest void setUpNodes() throws Exception {
54+
@BeforeMethod void setUpNodes() throws Exception {
5555
node = buildNode();
5656
((InternalNode) node).injector().getInstance(Gateway.class).reset();
5757
node.start();
@@ -66,7 +66,7 @@ private Node buildNode() {
6666
return nodeBuilder().settings(settingsBuilder().put(settings).put("node.name", "node1")).build();
6767
}
6868

69-
@AfterTest void closeNodes() throws Exception {
69+
@AfterMethod void closeNodes() throws Exception {
7070
((InternalNode) node).injector().getInstance(Gateway.class).reset();
7171
node.close();
7272
}

0 commit comments

Comments
 (0)