Local (in memory during unit test) Node stays RED after .stop()/.start() call

Problem:
Using node.stop() and then node.start() cluster stays RED

Longer Description:
I am attempting to write some unit tests for a plugin. One of the things I
would like to test is the persistence of certain settings after node
stop/start.
I cant seem to get my node to leave the RED state once I call node.stop()
and then node.start() on it. I have set the timeout to as long as 5
minutes, no luck.

Here is a test that shows this issue:

public void testStopStartNode() throws Exception {
Settings settings = ImmutableSettings.settingsBuilder().put("http.port",
9211).put("node.http.enabled", true)
.put("index.number_of_shards", 1).put("index.number_of_replicas", 0).put(
"path.data", "target")
.put("index.cache.field.type", "soft").build();

Node mynode = nodeBuilder().local(true).settings(settings).clusterName(
"junit_test_cluster").node();
mynode.start();

mynode.client().admin().cluster().prepareHealth().setWaitForGreenStatus().
execute().actionGet();

mynode.stop();
mynode.start();

System.out.println("Waiting for Yellow Status after node.stop()......");
ClusterHealthResponse healthResponse = mynode.client().admin().cluster().
prepareHealth().setWaitForYellowStatus().setTimeout(TimeValue.
timeValueMinutes(2)).execute().actionGet();
ClusterHealthStatus healthStatus = healthResponse.getStatus();

System.out.println("Done waiting : " + healthStatus.name());
}

Output of above test:

INFO: [Needle] version[0.90.6], pid[20711],
build[e2a24ef/2013-11-04T13:54:09Z]
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] initializing ...
Nov 06, 2013 6:37:32 PM org.elasticsearch.plugins
INFO: [Needle] loaded [query-cache], sites []
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] initialized
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] starting ...
Nov 06, 2013 6:37:32 PM org.elasticsearch.transport
INFO: [Needle] bound_address {local[2]}, publish_address {local[2]}
Nov 06, 2013 6:37:32 PM org.elasticsearch.cluster.service
INFO: [Needle] new_master [Needle][2][local[2]]{http.enabled=true,
local=true}, reason: local-disco-initial_connect(master)
Nov 06, 2013 6:37:32 PM org.elasticsearch.discovery
INFO: [Needle] junit_test_cluster/2
Nov 06, 2013 6:37:32 PM org.elasticsearch.gateway
INFO: [Needle] recovered [0] indices into cluster_state
Nov 06, 2013 6:37:32 PM org.elasticsearch.http
INFO: [Needle] bound_address {inet[/0:0:0:0:0:0:0:0:9211]}, publish_address
{inet[/192.168.111.203:9211]}
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] started
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] stopping ...
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] stopped
Nov 06, 2013 6:37:32 PM org.elasticsearch.node
INFO: [Needle] starting ...
Nov 06, 2013 6:37:32 PM org.elasticsearch.transport
INFO: [Needle] bound_address {local[3]}, publish_address {local[3]}
Nov 06, 2013 6:37:32 PM org.elasticsearch.cluster.service
INFO: [Needle] new_master [Needle][3][local[3]]{http.enabled=true,
local=true}, reason: local-disco-initial_connect(master)
Nov 06, 2013 6:38:02 PM org.elasticsearch.discovery
WARNING: [Needle] waited for 30s and no initial state was set by the
discovery
Nov 06, 2013 6:38:02 PM org.elasticsearch.discovery
INFO: [Needle] junit_test_cluster/3
Nov 06, 2013 6:38:02 PM org.elasticsearch.http
INFO: [Needle] bound_address {inet[/0:0:0:0:0:0:0:0:9211]}, publish_address
{inet[/192.168.111.203:9211]}
Nov 06, 2013 6:38:02 PM org.elasticsearch.node
INFO: [Needle] started
Waiting for Yellow Status after node.stop()......
Done waiting : RED

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I think after you stopped a node, not all resources were released like you
wanted to.

Try closing the node instead of stopping.

Also, unless you set gateway.type to "none", ES tries to recover a node
when starting, which is probably not intended in junit tests.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.