mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Removed unused method, that accidentally got back in after merging master in yesterday.
This commit is contained in:
parent
95608faa88
commit
07c45b3213
@ -1392,71 +1392,6 @@ public class InternalEngineTests extends EngineTestCase {
|
||||
assertOpsOnReplica(ops, replicaEngine, true, logger);
|
||||
}
|
||||
|
||||
private void assertOpsOnReplica(List<Engine.Operation> ops, InternalEngine replicaEngine, boolean shuffleOps) throws IOException {
|
||||
final Engine.Operation lastOp = ops.get(ops.size() - 1);
|
||||
final String lastFieldValue;
|
||||
if (lastOp instanceof Engine.Index) {
|
||||
Engine.Index index = (Engine.Index) lastOp;
|
||||
lastFieldValue = index.docs().get(0).get("value");
|
||||
} else {
|
||||
// delete
|
||||
lastFieldValue = null;
|
||||
}
|
||||
if (shuffleOps) {
|
||||
int firstOpWithSeqNo = 0;
|
||||
while (firstOpWithSeqNo < ops.size() && ops.get(firstOpWithSeqNo).seqNo() < 0) {
|
||||
firstOpWithSeqNo++;
|
||||
}
|
||||
// shuffle ops but make sure legacy ops are first
|
||||
shuffle(ops.subList(0, firstOpWithSeqNo), random());
|
||||
shuffle(ops.subList(firstOpWithSeqNo, ops.size()), random());
|
||||
}
|
||||
boolean firstOp = true;
|
||||
for (Engine.Operation op : ops) {
|
||||
logger.info("performing [{}], v [{}], seq# [{}], term [{}]",
|
||||
op.operationType().name().charAt(0), op.version(), op.seqNo(), op.primaryTerm());
|
||||
if (op instanceof Engine.Index) {
|
||||
Engine.IndexResult result = replicaEngine.index((Engine.Index) op);
|
||||
// replicas don't really care to about creation status of documents
|
||||
// this allows to ignore the case where a document was found in the live version maps in
|
||||
// a delete state and return false for the created flag in favor of code simplicity
|
||||
// as deleted or not. This check is just signal regression so a decision can be made if it's
|
||||
// intentional
|
||||
assertThat(result.isCreated(), equalTo(firstOp));
|
||||
assertThat(result.getVersion(), equalTo(op.version()));
|
||||
assertThat(result.hasFailure(), equalTo(false));
|
||||
|
||||
} else {
|
||||
Engine.DeleteResult result = replicaEngine.delete((Engine.Delete) op);
|
||||
// Replicas don't really care to about found status of documents
|
||||
// this allows to ignore the case where a document was found in the live version maps in
|
||||
// a delete state and return true for the found flag in favor of code simplicity
|
||||
// his check is just signal regression so a decision can be made if it's
|
||||
// intentional
|
||||
assertThat(result.isFound(), equalTo(firstOp == false));
|
||||
assertThat(result.getVersion(), equalTo(op.version()));
|
||||
assertThat(result.hasFailure(), equalTo(false));
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
engine.refresh("test");
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
engine.flush();
|
||||
engine.refresh("test");
|
||||
}
|
||||
firstOp = false;
|
||||
}
|
||||
|
||||
assertVisibleCount(replicaEngine, lastFieldValue == null ? 0 : 1);
|
||||
if (lastFieldValue != null) {
|
||||
try (Searcher searcher = replicaEngine.acquireSearcher("test")) {
|
||||
final TotalHitCountCollector collector = new TotalHitCountCollector();
|
||||
searcher.searcher().search(new TermQuery(new Term("value", lastFieldValue)), collector);
|
||||
assertThat(collector.getTotalHits(), equalTo(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testConcurrentOutOfDocsOnReplica() throws IOException, InterruptedException {
|
||||
final List<Engine.Operation> ops = generateSingleDocHistory(true, randomFrom(VersionType.INTERNAL, VersionType.EXTERNAL), false, 2, 100, 300);
|
||||
final Engine.Operation lastOp = ops.get(ops.size() - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user