[TEST] add more debug output when engine / store are closed
This commit is contained in:
parent
7bd389de61
commit
fdac110368
|
@ -183,7 +183,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
|||
private final AtomicInteger flushing = new AtomicInteger();
|
||||
private final Lock flushLock = new ReentrantLock();
|
||||
|
||||
private final RecoveryCounter onGoingRecoveries = new RecoveryCounter();
|
||||
protected final RecoveryCounter onGoingRecoveries = new RecoveryCounter();
|
||||
|
||||
|
||||
// A uid (in the form of BytesRef) to the version map
|
||||
|
@ -1677,10 +1677,10 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
|||
}
|
||||
}
|
||||
|
||||
private final class RecoveryCounter implements Releasable {
|
||||
protected final class RecoveryCounter implements Releasable {
|
||||
private final AtomicInteger onGoingRecoveries = new AtomicInteger();
|
||||
|
||||
public void startRecovery() {
|
||||
void startRecovery() {
|
||||
store.incRef();
|
||||
onGoingRecoveries.incrementAndGet();
|
||||
}
|
||||
|
@ -1689,7 +1689,7 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
|||
return onGoingRecoveries.get();
|
||||
}
|
||||
|
||||
public void endRecovery() throws ElasticsearchException {
|
||||
void endRecovery() throws ElasticsearchException {
|
||||
store.decRef();
|
||||
onGoingRecoveries.decrementAndGet();
|
||||
assert onGoingRecoveries.get() >= 0 : "ongoingRecoveries must be >= 0 but was: " + onGoingRecoveries.get();
|
||||
|
|
|
@ -552,7 +552,7 @@ public class InternalIndexService extends AbstractIndexComponent implements Inde
|
|||
@Override
|
||||
public void onShardCloseFailed(ShardId shardId, Throwable t) {
|
||||
assert countDown.isCountedDown() == false;
|
||||
assert shardIds.contains(shardId.getId()) : "Unkown shard id";
|
||||
assert shardIds.contains(shardId.getId()) : "Unknown shard id";
|
||||
listener.onShardCloseFailed(shardId, t);
|
||||
failures.add(t);
|
||||
if (countDown.countDown()) {
|
||||
|
|
|
@ -54,6 +54,7 @@ import org.elasticsearch.index.store.distributor.Distributor;
|
|||
import java.io.*;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.zip.Adler32;
|
||||
|
@ -350,6 +351,7 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
|||
this.onClose = onClose;
|
||||
// only do this once!
|
||||
decRef();
|
||||
logger.debug("store reference count on close: " + refCounter.refCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SearchWhileCreatingIndexTests extends ElasticsearchIntegrationTest
|
|||
int shardsNo = numberOfReplicas + 1;
|
||||
int neededNodes = shardsNo <= 2 ? 1 : shardsNo / 2 + 1;
|
||||
internalCluster().ensureAtLeastNumDataNodes(randomIntBetween(neededNodes, shardsNo));
|
||||
for (int i = 0; i < 20; i++) {
|
||||
for (int i = 0; i < 200; i++) {
|
||||
logger.info("running iteration {}", i);
|
||||
if (createIndex) {
|
||||
createIndex("test");
|
||||
|
|
|
@ -95,6 +95,7 @@ public final class MockInternalEngine extends InternalEngine implements Engine {
|
|||
}
|
||||
}
|
||||
}
|
||||
logger.debug("Ongoing recoveries after engine close: " + onGoingRecoveries.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue