LUCENE-3031: setFlushPending fails if we concurrently hit a aborting exception

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1092625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-04-15 08:26:16 +00:00
parent b95a78384c
commit 95b0aa44da
2 changed files with 8 additions and 7 deletions

View File

@ -167,12 +167,14 @@ public final class DocumentsWriterFlushControl {
*/
public synchronized void setFlushPending(ThreadState perThread) {
assert !perThread.flushPending;
assert perThread.perThread.getNumDocsInRAM() > 0;
perThread.flushPending = true; // write access synced
final long bytes = perThread.perThreadBytes;
flushBytes += bytes;
activeBytes -= bytes;
numPending++; // write access synced
if (perThread.perThread.getNumDocsInRAM() > 0) {
perThread.flushPending = true; // write access synced
final long bytes = perThread.perThreadBytes;
flushBytes += bytes;
activeBytes -= bytes;
numPending++; // write access synced
} // don't assert on numDocs since we could hit an abort excp. while selecting that dwpt for flushing
}
synchronized void doOnAbort(ThreadState state) {

View File

@ -132,7 +132,6 @@ public abstract class FlushPolicy {
}
}
}
assert maxRamUsingThreadState.perThread.getNumDocsInRAM() > 0;
assert writer.get().message(
"set largest ram consuming thread pending on lower watermark");
return maxRamUsingThreadState;