Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,6 @@ private void closeShard(String reason, ShardId sId, IndexShard indexShard, Store
try {
// only flush we are we closed (closed index or shutdown) and if we are not deleted
final boolean flushEngine = deleted.get() == false && closed.get();
logger.trace("[{}] closing shard (flushEngine: {}, deleted: {}, closed: {})", shardId, flushEngine, deleted.get(),
closed.get());
indexShard.close(reason, flushEngine);
} catch (Exception e) {
logger.debug(() -> new ParameterizedMessage("[{}] failed to close index shard", shardId), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,6 @@ public void flushAndClose() throws IOException {
close(); // double close is not a problem
}
}
} else {
logger.trace("skipping flushAndClose as already closed");
}
awaitPendingClose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.InternalTestCluster.RestartCallback;
import org.elasticsearch.test.junit.annotations.TestLogging;

import java.io.IOException;
import java.util.List;
Expand All @@ -76,6 +75,12 @@ public class GatewayIndexStateIT extends ESIntegTestCase {

private final Logger logger = LogManager.getLogger(GatewayIndexStateIT.class);

@Override
protected boolean addMockInternalEngine() {
// testRecoverBrokenIndexMetadata replies on the flushing on shutdown behavior which can be randomly disabled in MockInternalEngine.
return false;
}

public void testMappingMetaDataParsed() throws Exception {
logger.info("--> starting 1 nodes");
internalCluster().startNode();
Expand Down Expand Up @@ -346,8 +351,6 @@ public Settings onNodeStopped(final String nodeName) throws Exception {
* allocated in our metadata that we recover. In that case we now have the ability to check the index on local recovery from disk
* if it is sane and if we can successfully create an IndexService. This also includes plugins etc.
*/
// temporarily enabling TRACE to aid debugging https://github.com/elastic/elasticsearch/issues/43034
@TestLogging("_root:TRACE")
public void testRecoverBrokenIndexMetadata() throws Exception {
logger.info("--> starting one node");
internalCluster().startNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
Expand All @@ -70,10 +68,8 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
}

@Override
protected Collection<Class<? extends Plugin>> getMockPlugins() {
Set<Class<? extends Plugin>> mocks = new HashSet<>(super.getMockPlugins());
mocks.remove(MockEngineFactoryPlugin.class);
return mocks;
protected boolean addMockInternalEngine() {
return false;
}

public void testBreakerWithRandomExceptions() throws IOException, InterruptedException, ExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
Expand All @@ -65,10 +63,8 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
}

@Override
protected Collection<Class<? extends Plugin>> getMockPlugins() {
Set<Class<? extends Plugin>> mocks = new HashSet<>(super.getMockPlugins());
mocks.remove(MockEngineFactoryPlugin.class);
return mocks;
protected boolean addMockInternalEngine() {
return false;
}

public void testRandomExceptions() throws IOException, InterruptedException, ExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,13 @@ protected boolean addMockHttpTransport() {
return true;
}

/**
* Returns {@code true} if this test cluster can use a mock internal engine. Defaults to true.
*/
protected boolean addMockInternalEngine() {
return true;
}

/**
* Returns a function that allows to wrap / filter all clients that are exposed by the test cluster. This is useful
* for debugging or request / response pre and post processing. It also allows to intercept all calls done by the test
Expand All @@ -1913,7 +1920,7 @@ protected Collection<Class<? extends Plugin>> getMockPlugins() {
if (randomBoolean()) {
mocks.add(NodeMocksPlugin.class);
}
if (randomBoolean()) {
if (addMockInternalEngine() && randomBoolean()) {
mocks.add(MockEngineFactoryPlugin.class);
}
if (randomBoolean()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.MockEngineFactoryPlugin;
import org.elasticsearch.index.engine.EngineFactory;
import org.elasticsearch.index.mapper.SeqNoFieldMapper;
import org.elasticsearch.index.query.QueryBuilders;
Expand Down Expand Up @@ -65,10 +64,8 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
}

@Override
protected Collection<Class<? extends Plugin>> getMockPlugins() {
Collection<Class<? extends Plugin>> classes = new ArrayList<>(super.getMockPlugins());
classes.remove(MockEngineFactoryPlugin.class);
return classes;
protected boolean addMockInternalEngine() {
return false;
}

public static final class MyPlugin extends Plugin implements RepositoryPlugin, EnginePlugin {
Expand Down