SOLR-3559: clear all tlog maps else an RTG lookup could find the udpate during a concurrent commit

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1357359 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-07-04 18:21:12 +00:00
parent 458cb4e59a
commit b1b9c913df
2 changed files with 14 additions and 4 deletions

View File

@ -340,7 +340,9 @@ public class UpdateLog implements PluginInfoInitialized {
} else { } else {
// replicate the deleteByQuery logic. See deleteByQuery for comments. // replicate the deleteByQuery logic. See deleteByQuery for comments.
map.clear(); if (map != null) map.clear();
if (prevMap != null) prevMap.clear();
if (prevMap2 != null) prevMap2.clear();
try { try {
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true); RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
@ -400,7 +402,9 @@ public class UpdateLog implements PluginInfoInitialized {
if ((cmd.getFlags() & UpdateCommand.BUFFERING) == 0) { if ((cmd.getFlags() & UpdateCommand.BUFFERING) == 0) {
// given that we just did a delete-by-query, we don't know what documents were // given that we just did a delete-by-query, we don't know what documents were
// affected and hence we must purge our caches. // affected and hence we must purge our caches.
map.clear(); if (map != null) map.clear();
if (prevMap != null) prevMap.clear();
if (prevMap2 != null) prevMap2.clear();
trackDeleteByQuery(cmd.getQuery(), cmd.getVersion()); trackDeleteByQuery(cmd.getQuery(), cmd.getVersion());
@ -438,7 +442,10 @@ public class UpdateLog implements PluginInfoInitialized {
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e); SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
} }
map.clear(); if (map != null) map.clear();
if (prevMap != null) prevMap.clear();
if (prevMap2 != null) prevMap2.clear();
oldDeletes.clear(); oldDeletes.clear();
deleteByQueries.clear(); deleteByQueries.clear();
} }

View File

@ -63,7 +63,7 @@ public class TestStressReorder extends TestRTGBase {
final int commitPercent = 5 + random().nextInt(20); final int commitPercent = 5 + random().nextInt(20);
final int softCommitPercent = 30+random().nextInt(75); // what percent of the commits are soft final int softCommitPercent = 30+random().nextInt(75); // what percent of the commits are soft
final int deletePercent = 4+random().nextInt(25); final int deletePercent = 4+random().nextInt(25);
final int deleteByQueryPercent = 0; // 1+random().nextInt(7); final int deleteByQueryPercent = random().nextInt(8);
final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200)); final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));
int nWriteThreads = 5 + random().nextInt(25); int nWriteThreads = 5 + random().nextInt(25);
@ -92,6 +92,9 @@ public class TestStressReorder extends TestRTGBase {
**/ **/
verbose("commitPercent",commitPercent, "softCommitPercent",softCommitPercent, "deletePercent",deletePercent, "deleteByQueryPercent",deleteByQueryPercent
, "ndocs",ndocs,"nWriteThreads",nWriteThreads,"percentRealtimeQuery",percentRealtimeQuery,"operations",operations, "nReadThreads",nReadThreads);
initModel(ndocs); initModel(ndocs);
final AtomicInteger numCommitting = new AtomicInteger(); final AtomicInteger numCommitting = new AtomicInteger();