mirror of https://github.com/apache/lucene.git
LUCENE-3023: push global deletes if no document was flushed during global flush
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1097510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ee258ae1b
commit
726654c1ab
|
@ -488,7 +488,7 @@ final class DocumentsWriter {
|
||||||
* two stage operation; the caller must ensure (in try/finally) that finishFlush
|
* two stage operation; the caller must ensure (in try/finally) that finishFlush
|
||||||
* is called after this method, to release the flush lock in DWFlushControl
|
* is called after this method, to release the flush lock in DWFlushControl
|
||||||
*/
|
*/
|
||||||
final boolean flushAllThreads(final boolean flushDeletes)
|
final boolean flushAllThreads()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final DocumentsWriterDeleteQueue flushingDeleteQueue;
|
final DocumentsWriterDeleteQueue flushingDeleteQueue;
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ final class DocumentsWriter {
|
||||||
while (flushControl.anyFlushing()) {
|
while (flushControl.anyFlushing()) {
|
||||||
flushControl.waitForFlush();
|
flushControl.waitForFlush();
|
||||||
}
|
}
|
||||||
if (!anythingFlushed && flushDeletes) {
|
if (!anythingFlushed) { // apply deletes if we did not flush any document
|
||||||
synchronized (ticketQueue) {
|
synchronized (ticketQueue) {
|
||||||
ticketQueue.add(new FlushTicket(flushingDeleteQueue.freezeGlobalBuffer(null), false));
|
ticketQueue.add(new FlushTicket(flushingDeleteQueue.freezeGlobalBuffer(null), false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ public class IndexWriter implements Closeable {
|
||||||
poolReaders = true;
|
poolReaders = true;
|
||||||
final IndexReader r;
|
final IndexReader r;
|
||||||
doBeforeFlush();
|
doBeforeFlush();
|
||||||
final boolean maybeMerge;
|
final boolean anySegmentFlushed;
|
||||||
/*
|
/*
|
||||||
* for releasing a NRT reader we must ensure that
|
* for releasing a NRT reader we must ensure that
|
||||||
* DW doesn't add any segments or deletes until we are
|
* DW doesn't add any segments or deletes until we are
|
||||||
|
@ -367,8 +367,10 @@ public class IndexWriter implements Closeable {
|
||||||
synchronized (fullFlushLock) {
|
synchronized (fullFlushLock) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
maybeMerge = docWriter.flushAllThreads(applyAllDeletes);
|
anySegmentFlushed = docWriter.flushAllThreads();
|
||||||
if (!maybeMerge) {
|
if (!anySegmentFlushed) {
|
||||||
|
// prevent double increment since docWriter#doFlush increments the flushcount
|
||||||
|
// if we flushed anything.
|
||||||
flushCount.incrementAndGet();
|
flushCount.incrementAndGet();
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
|
@ -391,7 +393,7 @@ public class IndexWriter implements Closeable {
|
||||||
doAfterFlush();
|
doAfterFlush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(maybeMerge) {
|
if(anySegmentFlushed) {
|
||||||
maybeMerge();
|
maybeMerge();
|
||||||
}
|
}
|
||||||
if (infoStream != null) {
|
if (infoStream != null) {
|
||||||
|
@ -2614,7 +2616,7 @@ public class IndexWriter implements Closeable {
|
||||||
|
|
||||||
synchronized (fullFlushLock) {
|
synchronized (fullFlushLock) {
|
||||||
try {
|
try {
|
||||||
maybeMerge = docWriter.flushAllThreads(applyAllDeletes);
|
maybeMerge = docWriter.flushAllThreads();
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
docWriter.finishFullFlush(success);
|
docWriter.finishFullFlush(success);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class TestPerSegmentDeletes extends LuceneTestCase {
|
||||||
// merge segments 0 and 1
|
// merge segments 0 and 1
|
||||||
// which should apply the delete id:2
|
// which should apply the delete id:2
|
||||||
writer.deleteDocuments(new Term("id", "2"));
|
writer.deleteDocuments(new Term("id", "2"));
|
||||||
writer.flush(false, true);
|
writer.flush(false, false);
|
||||||
fsmp.doMerge = true;
|
fsmp.doMerge = true;
|
||||||
fsmp.start = 0;
|
fsmp.start = 0;
|
||||||
fsmp.length = 2;
|
fsmp.length = 2;
|
||||||
|
|
Loading…
Reference in New Issue