mirror of https://github.com/apache/lucene.git
LUCENE-5871: test bugs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1618063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b49aa49762
commit
ce7e43e7e3
|
@ -253,7 +253,7 @@ public class TestIndexWriterThreadsToSegments extends LuceneTestCase {
|
|||
startingGun.await();
|
||||
Document doc = new Document();
|
||||
doc.add(new TextField("field", "here is some text that is a bit longer than normal trivial text", Field.Store.NO));
|
||||
while (true) {
|
||||
for(int j=0;j<1000;j++) {
|
||||
w.addDocument(doc);
|
||||
}
|
||||
} catch (AlreadyClosedException ace) {
|
||||
|
@ -269,10 +269,15 @@ public class TestIndexWriterThreadsToSegments extends LuceneTestCase {
|
|||
startingGun.countDown();
|
||||
|
||||
Thread.sleep(100);
|
||||
w.close();
|
||||
try {
|
||||
w.close();
|
||||
} catch (IllegalStateException ise) {
|
||||
// OK but not required
|
||||
}
|
||||
for(Thread t : threads) {
|
||||
t.join();
|
||||
}
|
||||
w.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -351,12 +351,12 @@ public class RandomIndexWriter implements Closeable {
|
|||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (!w.isClosed()) {
|
||||
if (w.isClosed() == false) {
|
||||
LuceneTestCase.maybeChangeLiveIndexWriterConfig(r, w.getConfig());
|
||||
}
|
||||
// if someone isn't using getReader() API, we want to be sure to
|
||||
// forceMerge since presumably they might open a reader on the dir.
|
||||
if (getReaderCalled == false && r.nextInt(8) == 2) {
|
||||
if (getReaderCalled == false && r.nextInt(8) == 2 && w.isClosed() == false) {
|
||||
doRandomForceMerge();
|
||||
if (w.getConfig().getCommitOnClose() == false) {
|
||||
// index may have changed, must commit the changes, or otherwise they are discarded by the call to close()
|
||||
|
|
Loading…
Reference in New Issue