You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2016/04/22 02:19:16 UTC

[1/7] lucene-solr:branch_5_5: SOLR-8771: Multi-threaded core shutdown creates executor per core.

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_5_5 66d3c2eb0 -> 297bdb63a


SOLR-8771: Multi-threaded core shutdown creates executor per core.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9698d1be
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9698d1be
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9698d1be

Branch: refs/heads/branch_5_5
Commit: 9698d1bee31eb5f103f8894246acf7f8f5479194
Parents: 66d3c2e
Author: Mark Miller <ma...@gmail.com>
Authored: Tue Mar 1 12:13:56 2016 -0800
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:55:35 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                      |  2 ++
 .../core/src/java/org/apache/solr/core/SolrCores.java | 14 +++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9698d1be/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 81ff4ab..5587714 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -103,6 +103,8 @@ Bug Fixes
 * SOLR-8738: Fixed false success response when invalid deleteByQuery requests intially hit non-leader
   cloud nodes (hossman)
 
+* SOLR-8771: Multi-threaded core shutdown creates executor per core. (Mike Drob via Mark Miller)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9698d1be/solr/core/src/java/org/apache/solr/core/SolrCores.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCores.java b/solr/core/src/java/org/apache/solr/core/SolrCores.java
index de5e0be..5302d6f 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCores.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCores.java
@@ -122,10 +122,10 @@ class SolrCores {
         pendingCloses.clear();
       }
       
-      for (final SolrCore core : coreList) {
-        ExecutorService coreCloseExecutor = ExecutorUtil.newMDCAwareFixedThreadPool(Integer.MAX_VALUE,
-            new DefaultSolrThreadFactory("coreCloseExecutor"));
-        try {
+      ExecutorService coreCloseExecutor = ExecutorUtil.newMDCAwareFixedThreadPool(Integer.MAX_VALUE,
+          new DefaultSolrThreadFactory("coreCloseExecutor"));
+      try {
+        for (SolrCore core : coreList) {
           coreCloseExecutor.submit(new Callable<SolrCore>() {
             @Override
             public SolrCore call() throws Exception {
@@ -143,11 +143,11 @@ class SolrCores {
               return core;
             }
           });
-        } finally {
-          ExecutorUtil.shutdownAndAwaitTermination(coreCloseExecutor);
         }
-
+      } finally {
+        ExecutorUtil.shutdownAndAwaitTermination(coreCloseExecutor);
       }
+
     } while (coreList.size() > 0);
   }
 


[2/7] lucene-solr:branch_5_5: SOLR-8145: Fix position of OOM killer script when starting Solr in the background

Posted by an...@apache.org.
SOLR-8145: Fix position of OOM killer script when starting Solr in the background


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/851a6029
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/851a6029
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/851a6029

Branch: refs/heads/branch_5_5
Commit: 851a6029e889860951fdb480bf2d658c89639862
Parents: 9698d1b
Author: thelabdude <th...@gmail.com>
Authored: Wed Mar 2 11:22:27 2016 -0700
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:56:44 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt | 3 +++
 solr/bin/solr    | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/851a6029/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5587714..04e3088 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -105,6 +105,9 @@ Bug Fixes
 
 * SOLR-8771: Multi-threaded core shutdown creates executor per core. (Mike Drob via Mark Miller)
 
+* SOLR-8145: Fix position of OOM killer script when starting Solr in the background (Jurian Broertjes via
+  Timothy Potter)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/851a6029/solr/bin/solr
----------------------------------------------------------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index 8366e01..2d2daf8 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1420,8 +1420,9 @@ function launch_solr() {
     exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
   else
     # run Solr in the background
-    nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar \
-	"-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT $SOLR_LOGS_DIR" "${SOLR_JETTY_CONFIG[@]}" \
+    nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS \
+	"-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT $SOLR_LOGS_DIR" \
+        -jar start.jar "${SOLR_JETTY_CONFIG[@]}" \
 	1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
 
     # no lsof on cygwin though


[5/7] lucene-solr:branch_5_5: SOLR-8779: Fix missing InterruptedException handling in ZkStateReader

Posted by an...@apache.org.
SOLR-8779: Fix missing InterruptedException handling in ZkStateReader


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6024572a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6024572a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6024572a

Branch: refs/heads/branch_5_5
Commit: 6024572a53fc3af8fbb2f3d0cf51cf46d7406350
Parents: 5601f83
Author: Varun Thacker <va...@gmail.com>
Authored: Fri Mar 4 18:08:53 2016 +0530
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:57:10 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../apache/solr/common/cloud/ZkStateReader.java | 32 ++++++++++++--------
 2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6024572a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1a972e4..0c29924 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -114,6 +114,8 @@ Bug Fixes
 * SOLR-8728: ReplicaAssigner throws NPE when a partial list of nodes are only participating in replica
   placement. splitshard should preassign nodes using rules, if rules are present (noble, Shai Erera)
 
+* SOLR-8779: Fix missing InterruptedException handling in ZkStateReader.java (Varun Thacker)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6024572a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 49b02a2..8fa3be9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -165,12 +165,10 @@ public class ZkStateReader implements Closeable {
       } else {
         throw new ZooKeeperException(ErrorCode.INVALID_STATE, "No config data found at path: " + path);
       }
-    }
-    catch (KeeperException e) {
+    } catch (KeeperException e) {
       throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
-    }
-    catch (InterruptedException e) {
-      Thread.interrupted();
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
       throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
     }
 
@@ -710,14 +708,17 @@ public class ZkStateReader implements Closeable {
     this.aliases = ClusterState.load(data);
   }
   
-  public Map getClusterProps(){
+  public Map getClusterProps() {
     try {
       if (getZkClient().exists(ZkStateReader.CLUSTER_PROPS, true)) {
         return (Map) Utils.fromJSON(getZkClient().getData(ZkStateReader.CLUSTER_PROPS, null, new Stat(), true)) ;
       } else {
         return new LinkedHashMap();
       }
-    } catch (Exception e) {
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new SolrException(ErrorCode.SERVER_ERROR, "Thread interrupted. Error reading cluster properties", e);
+    } catch (KeeperException e) {
       throw new SolrException(ErrorCode.SERVER_ERROR, "Error reading cluster properties", e);
     }
   }
@@ -760,9 +761,13 @@ public class ZkStateReader implements Closeable {
         LOG.warn("Race condition while trying to set a new cluster prop on current version [{}]", s.getVersion());
         //race condition
         continue;
-      } catch (Exception ex) {
-        LOG.error("Error updating path [{}]", CLUSTER_PROPS, ex);
-        throw new SolrException(ErrorCode.SERVER_ERROR, "Error updating cluster property " + propertyName, ex);
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+        LOG.error("Thread Interrupted. Error updating path [{}]", CLUSTER_PROPS, e);
+        throw new SolrException(ErrorCode.SERVER_ERROR, "Thread Interrupted. Error updating cluster property " + propertyName, e);
+      } catch (KeeperException e) {
+        LOG.error("Error updating path [{}]", CLUSTER_PROPS, e);
+        throw new SolrException(ErrorCode.SERVER_ERROR, "Error updating cluster property " + propertyName, e);
       }
       break;
     }
@@ -785,8 +790,11 @@ public class ZkStateReader implements Closeable {
             new ConfigData((Map<String, Object>) Utils.fromJSON(data), stat.getVersion()) :
             null;
       }
-    } catch (KeeperException | InterruptedException e) {
-      throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties",e) ;
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties", e) ;
+    } catch (KeeperException e) {
+      throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties", e) ;
     }
     return null;
   }


[3/7] lucene-solr:branch_5_5: SOLR-8769: Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-'id' unique field

Posted by an...@apache.org.
SOLR-8769: Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-'id' unique field


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/66f47a53
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/66f47a53
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/66f47a53

Branch: refs/heads/branch_5_5
Commit: 66f47a53f904bab2d845a1a3baf2e0090830cfc7
Parents: 851a602
Author: anshum <an...@apache.org>
Authored: Thu Mar 3 15:27:04 2016 -0800
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:56:53 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                                  | 3 +++
 .../core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66f47a53/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 04e3088..f097f2a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -108,6 +108,9 @@ Bug Fixes
 * SOLR-8145: Fix position of OOM killer script when starting Solr in the background (Jurian Broertjes via
   Timothy Potter)
 
+* SOLR-8769: Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-"id"
+  unique field (Erik Hatcher, Anshum Gupta)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66f47a53/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
index 13e864f..ddf28fe 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
@@ -163,7 +163,7 @@ public class CloudMLTQParser extends QParser {
       BooleanQuery.Builder realMLTQuery = new BooleanQuery.Builder();
       realMLTQuery.setDisableCoord(true);
       realMLTQuery.add(boostedMLTQuery, BooleanClause.Occur.MUST);
-      realMLTQuery.add(createIdQuery("id", id), BooleanClause.Occur.MUST_NOT);
+      realMLTQuery.add(createIdQuery(req.getSchema().getUniqueKeyField().getName(), id), BooleanClause.Occur.MUST_NOT);
 
       return realMLTQuery.build();
     } catch (IOException e) {


[4/7] lucene-solr:branch_5_5: SOLR-8728: Add missing change log entry for 5.5.1

Posted by an...@apache.org.
SOLR-8728: Add missing change log entry for 5.5.1


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5601f839
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5601f839
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5601f839

Branch: refs/heads/branch_5_5
Commit: 5601f839c5001b1c2cce44b3b6349b1c1de23230
Parents: 66f47a5
Author: anshum <an...@apache.org>
Authored: Thu Apr 21 15:59:25 2016 -0700
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:57:01 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5601f839/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f097f2a..1a972e4 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -111,6 +111,9 @@ Bug Fixes
 * SOLR-8769: Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-"id"
   unique field (Erik Hatcher, Anshum Gupta)
 
+* SOLR-8728: ReplicaAssigner throws NPE when a partial list of nodes are only participating in replica
+  placement. splitshard should preassign nodes using rules, if rules are present (noble, Shai Erera)
+
 Other Changes
 ----------------------
 


[7/7] lucene-solr:branch_5_5: SOLR-8771: Fix broken build that broke during backporting to 5x

Posted by an...@apache.org.
SOLR-8771: Fix broken build that broke during backporting to 5x


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/297bdb63
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/297bdb63
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/297bdb63

Branch: refs/heads/branch_5_5
Commit: 297bdb63aa6720c6c204ce921f8bfc5854b4cfd4
Parents: efb7d44
Author: anshum <an...@apache.org>
Authored: Thu Apr 21 16:53:15 2016 -0700
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:57:28 2016 -0700

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/core/SolrCores.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/297bdb63/solr/core/src/java/org/apache/solr/core/SolrCores.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCores.java b/solr/core/src/java/org/apache/solr/core/SolrCores.java
index 5302d6f..65b9e21 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCores.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCores.java
@@ -125,7 +125,7 @@ class SolrCores {
       ExecutorService coreCloseExecutor = ExecutorUtil.newMDCAwareFixedThreadPool(Integer.MAX_VALUE,
           new DefaultSolrThreadFactory("coreCloseExecutor"));
       try {
-        for (SolrCore core : coreList) {
+        for (final SolrCore core : coreList) {
           coreCloseExecutor.submit(new Callable<SolrCore>() {
             @Override
             public SolrCore call() throws Exception {


[6/7] lucene-solr:branch_5_5: SOLR-8449: Fix the core restore functionality to allow restoring multiple times on the same core

Posted by an...@apache.org.
SOLR-8449: Fix the core restore functionality to allow restoring multiple times on the same core


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/efb7d446
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/efb7d446
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/efb7d446

Branch: refs/heads/branch_5_5
Commit: efb7d4463ee5f1146ee193a46f6a146ca3f48d67
Parents: 6024572
Author: Varun Thacker <va...@gmail.com>
Authored: Sat Mar 5 13:15:19 2016 +0530
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:57:19 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  3 ++
 .../org/apache/solr/handler/RestoreCore.java    |  6 ++-
 .../apache/solr/handler/TestRestoreCore.java    | 55 +++++++++++---------
 3 files changed, 39 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/efb7d446/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0c29924..bf41eec 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -116,6 +116,9 @@ Bug Fixes
 
 * SOLR-8779: Fix missing InterruptedException handling in ZkStateReader.java (Varun Thacker)
 
+* SOLR-8449: Fix the core restore functionality to allow restoring multiple times on the same core
+  (Johannes Brucher, Varun Thacker)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/efb7d446/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
index ddcad22..4de3ab0 100644
--- a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
+++ b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
@@ -19,6 +19,9 @@ package org.apache.solr.handler;
 import java.lang.invoke.MethodHandles;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
 
@@ -57,7 +60,8 @@ public class RestoreCore implements Callable<Boolean> {
   private boolean doRestore() throws Exception {
 
     Path backupPath = Paths.get(backupLocation).resolve(backupName);
-    String restoreIndexName = "restore." + backupName;
+    SimpleDateFormat dateFormat = new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT);
+    String restoreIndexName = "restore." + dateFormat.format(new Date());
     String restoreIndexPath = core.getDataDir() + restoreIndexName;
 
     Directory restoreIndexDir = null;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/efb7d446/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
index d89b217..dcad0e4 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java
@@ -134,36 +134,43 @@ public class TestRestoreCore extends SolrJettyTestBase {
       Thread.sleep(1000);
     }
 
-    //Modify existing index before we call restore.
 
-    //Delete a few docs
-    int numDeletes = TestUtil.nextInt(random(), 1, nDocs);
-    for(int i=0; i<numDeletes; i++) {
-      masterClient.deleteByQuery("id:" + i);
-    }
-    masterClient.commit();
-
-    //Add a few more
-    int moreAdds = TestUtil.nextInt(random(), 1, 100);
-    for (int i=0; i<moreAdds; i++) {
-      SolrInputDocument doc = new SolrInputDocument();
-      doc.addField("id", i + nDocs);
-      doc.addField("name", "name = " + (i + nDocs));
-      masterClient.add(doc);
-    }
-    //Purposely not calling commit once in a while. There can be some docs which are not committed
-    if (usually()) {
+
+    int numRestoreTests = TestUtil.nextInt(random(), 1, 5);
+
+    for (int attempts=0; attempts<numRestoreTests; attempts++) {
+      //Modify existing index before we call restore.
+
+      //Delete a few docs
+      int numDeletes = TestUtil.nextInt(random(), 1, nDocs);
+      for(int i=0; i<numDeletes; i++) {
+        masterClient.deleteByQuery("id:" + i);
+      }
       masterClient.commit();
-    }
 
-    TestReplicationHandlerBackup.runBackupCommand(masterJetty, ReplicationHandler.CMD_RESTORE, params);
+      //Add a few more
+      int moreAdds = TestUtil.nextInt(random(), 1, 100);
+      for (int i=0; i<moreAdds; i++) {
+        SolrInputDocument doc = new SolrInputDocument();
+        doc.addField("id", i + nDocs);
+        doc.addField("name", "name = " + (i + nDocs));
+        masterClient.add(doc);
+      }
+      //Purposely not calling commit once in a while. There can be some docs which are not committed
+      if (usually()) {
+        masterClient.commit();
+      }
 
-    while (!fetchRestoreStatus()) {
-      Thread.sleep(1000);
+      TestReplicationHandlerBackup.runBackupCommand(masterJetty, ReplicationHandler.CMD_RESTORE, params);
+
+      while (!fetchRestoreStatus()) {
+        Thread.sleep(1000);
+      }
+
+      //See if restore was successful by checking if all the docs are present again
+      verifyDocs(nDocs);
     }
 
-    //See if restore was successful by checking if all the docs are present again
-    verifyDocs(nDocs);
   }
 
   @Test