diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index a3e5884a6e4..74e71cb5a80 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -340,7 +340,9 @@ public class UpdateLog implements PluginInfoInitialized { } else { // 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 { RefCounted holder = uhandler.core.openNewSearcher(true, true); @@ -400,7 +402,9 @@ public class UpdateLog implements PluginInfoInitialized { if ((cmd.getFlags() & UpdateCommand.BUFFERING) == 0) { // given that we just did a delete-by-query, we don't know what documents were // 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()); @@ -438,7 +442,10 @@ public class UpdateLog implements PluginInfoInitialized { 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(); deleteByQueries.clear(); } diff --git a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java index 2ed35786758..775fcf0bfff 100644 --- a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java +++ b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java @@ -63,7 +63,7 @@ public class TestStressReorder extends TestRTGBase { final int commitPercent = 5 + random().nextInt(20); final int softCommitPercent = 30+random().nextInt(75); // what percent of the commits are soft 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)); 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); final AtomicInteger numCommitting = new AtomicInteger();