Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4BBF18279 for ; Sat, 5 Mar 2016 22:45:06 +0000 (UTC) Received: (qmail 28931 invoked by uid 500); 5 Mar 2016 22:45:06 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 28922 invoked by uid 99); 5 Mar 2016 22:45:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Mar 2016 22:45:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 626B5DFA42; Sat, 5 Mar 2016 22:45:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: varun@apache.org To: commits@lucene.apache.org Message-Id: <291bfee5d5a4479594749e5000f51dbb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: lucene-solr git commit: SOLR-8449: Fix the core restore functionality to allow restoring multiple times on the same core Date: Sat, 5 Mar 2016 22:45:06 +0000 (UTC) Repository: lucene-solr Updated Branches: refs/heads/branch_6_0 75619f48d -> be021fcf6 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/be021fcf Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/be021fcf Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/be021fcf Branch: refs/heads/branch_6_0 Commit: be021fcf6f3c87ab5ed51fb0f5dbfd08d752a899 Parents: 75619f4 Author: Varun Thacker Authored: Sat Mar 5 13:15:19 2016 +0530 Committer: Varun Thacker Committed: Sun Mar 6 04:14:49 2016 +0530 ---------------------------------------------------------------------- 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/be021fcf/solr/CHANGES.txt ---------------------------------------------------------------------- diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index e94c36f..93439ef 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -244,6 +244,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) + Optimizations ---------------------- * SOLR-7876: Speed up queries and operations that use many terms when timeAllowed has not been http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/be021fcf/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 a6c1da9..9949d3f 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; @@ -55,7 +58,8 @@ public class RestoreCore implements Callable { 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/be021fcf/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 b219a8d..1218783 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java +++ b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java @@ -138,36 +138,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