/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
boolean doFail;
boolean hitExc;
public void setDoFail() {
this.doFail = true;
hitExc = false;
}
public void clearDoFail() {
this.doFail = false;
}
if (doFail && isTestThread()) {
boolean isDoFlush = false;
boolean isClose = false;
isDoFlush = true;
}
isClose = true;
}
}
hitExc = true;
}
}
}
}
// Make sure running BG merges still work fine even when
// we are hitting exceptions during flushing.
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2));
int extraCount = 0;
for(int i=0;i<10;i++) {
if (VERBOSE) {
}
for(int j=0;j<20;j++) {
}
// must cycle here because sometimes the merge flushes
// the doc we just added and so there's nothing to
// flush, and we don't hit the exception
while(true) {
try {
fail("failed to hit IOException");
}
extraCount++;
} catch (IOException ioe) {
if (VERBOSE) {
}
break;
}
}
}
}
// Test that deletes committed after a merge started and
// before it finishes, are correctly merged back:
// Force degenerate merging so we can get a mix of
// merging of segments with and without deletes at the
// start:
.setMergePolicy(mp));
for(int i=0;i<10;i++) {
if (VERBOSE) {
}
for(int j=0;j<100;j++) {
}
int delID = i;
if (VERBOSE) {
}
delID += 10;
}
}
// Verify that we did not lose any deletes...
}
.setMaxBufferedDocs(2));
if (VERBOSE) {
}
for(int j=0;j<21;j++) {
}
// Reopen
}
}
);
for(int j=0;j<201;j++) {
}
for(int j=0;j<20;j++) {
delID += 5;
}
// Force a bunch of merge threads to kick off so we
// stress out aborting them on close:
// Reopen
writer = new IndexWriter(
);
}
}
}