Skip to content

Commit

Permalink
Repro of elastic#45956
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveCTurner committed Aug 29, 2019
1 parent a6e915b commit 5f19546
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Expand Up @@ -405,10 +405,12 @@ private Releasable acquireStore(Store store) {
threadPool.generic().execute(new ActionRunnable<>(future) {
@Override
protected void doRun() {
logger.trace("calling store.decRef");
store.decRef();
listener.onResponse(null);
}
});
logger.trace("waiting for store.decRef");
FutureUtils.get(future);
});
}
Expand Down Expand Up @@ -913,6 +915,7 @@ public void close() throws IOException {

private void cleanFiles(Store store, Store.MetadataSnapshot sourceMetadata, IntSupplier translogOps,
long globalCheckpoint, ActionListener<Void> listener) {
logger.trace("waiting before cleanFiles");
// Send the CLEAN_FILES request, which takes all of the files that
// were transferred and renames them from their temporary file
// names to the actual file names. It also writes checksums for
Expand All @@ -921,6 +924,12 @@ private void cleanFiles(Store store, Store.MetadataSnapshot sourceMetadata, IntS
// Once the files have been renamed, any other files that are not
// related to this recovery (out of date segments, for example)
// are deleted
try {
Thread.sleep(1000); // NOCOMMIT
} catch (InterruptedException e) {
throw new AssertionError(e);
}
logger.trace("calling cleanFiles");
cancellableThreads.execute(() -> recoveryTarget.cleanFiles(translogOps.getAsInt(), globalCheckpoint, sourceMetadata,
ActionListener.delegateResponse(listener, (l, e) -> ActionListener.completeWith(l, () -> {
StoreFileMetaData[] mds = StreamSupport.stream(sourceMetadata.spliterator(), false).toArray(StoreFileMetaData[]::new);
Expand Down
Expand Up @@ -93,6 +93,7 @@
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.engine.MockEngineSupport;
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.test.store.MockFSIndexStore;
import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.test.transport.StubbableTransport;
Expand Down Expand Up @@ -857,6 +858,17 @@ public void sendRequest(Transport.Connection connection, long requestId, String
}
}

@TestLogging(reason = "nocommit", value = "org.elasticsearch.indices.recovery:TRACE")
public void testCloseNodeDuringRecovery() throws Exception {
internalCluster().startNode();
assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)));
ensureYellow("test");
internalCluster().startNode();
internalCluster().fullRestart();
}

@TestIssueLogging(value = "org.elasticsearch:DEBUG", issueUrl = "https://github.com/elastic/elasticsearch/issues/45953")
public void testHistoryRetention() throws Exception {
internalCluster().startNodes(3);
Expand Down

0 comments on commit 5f19546

Please sign in to comment.