From 7dfb04ee5e9f973fbad20c529ec091c201743398 Mon Sep 17 00:00:00 2001 From: Erick Date: Thu, 8 Mar 2018 22:00:16 -0800 Subject: [PATCH] SOLR-12072: Invalid path string using ZkConfigManager.copyConfigDir(String fromConfig, String toConfig) --- solr/CHANGES.txt | 3 +++ .../java/org/apache/solr/common/cloud/ZkConfigManager.java | 2 +- .../org/apache/solr/common/cloud/TestZkConfigManager.java | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index fe477be1ea9..7f620420ec5 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -261,6 +261,9 @@ Bug Fixes in normalization instead of all. This bug normally doesn't matter since TextField doesn't call it. (Tim Allison via David Smiley) +* SOLR-12072: Invalid path string using ZkConfigManager.copyConfigDir(String fromConfig, String toConfig) + (Alessandro Hoss via Erick Erickson) + Optimizations ---------------------- diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkConfigManager.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkConfigManager.java index 312cb907eb3..015793c03b0 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkConfigManager.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkConfigManager.java @@ -162,7 +162,7 @@ public class ZkConfigManager { * @throws IOException if an I/O error occurs */ public void copyConfigDir(String fromConfig, String toConfig) throws IOException { - copyConfigDir(CONFIGS_ZKNODE + "/" + fromConfig, CONFIGS_ZKNODE + "/" + toConfig, null); + copyConfigDir(fromConfig, toConfig, null); } /** diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java b/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java index 159ff82bc12..cf823055eb6 100644 --- a/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java +++ b/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java @@ -115,6 +115,13 @@ public class TestZkConfigManager extends SolrTestCaseJ4 { // uploading same files to a new name creates a new config configManager.uploadConfigDir(tempConfig, "config2"); assertEquals(2, configManager.listConfigs().size()); + + // Test copying a config works in both flavors + configManager.copyConfigDir("config2", "config2copy"); + configManager.copyConfigDir("config2", "config2copy2", null); + configs = configManager.listConfigs(); + assertTrue("config2copy should exist", configs.contains("config2copy")); + assertTrue("config2copy2 should exist", configs.contains("config2copy2")); } }