You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/11/27 21:41:07 UTC

svn commit: r1642229 [5/7] - in /lucene/dev/branches/lucene6005: ./ dev-tools/ dev-tools/eclipse/dot.settings/ dev-tools/idea/lucene/benchmark/src/ dev-tools/idea/lucene/highlighter/ dev-tools/maven/ dev-tools/scripts/ lucene/ lucene/analysis/ lucene/a...

Modified: lucene/dev/branches/lucene6005/solr/bin/solr.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/bin/solr.cmd?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/bin/solr.cmd (original)
+++ lucene/dev/branches/lucene6005/solr/bin/solr.cmd Thu Nov 27 20:41:01 2014
@@ -458,7 +458,6 @@ IF NOT "%SOLR_HOST%"=="" (
   set SOLR_HOST_ARG=
 )
 
-REM TODO: Change this to "server" when we resolve SOLR-3619
 IF "%SOLR_SERVER_DIR%"=="" set SOLR_SERVER_DIR=%DEFAULT_SERVER_DIR%
 
 IF NOT EXIST "%SOLR_SERVER_DIR%" (
@@ -660,6 +659,11 @@ IF NOT "%SOLR_HOST_ARG%"=="" set START_O
 IF NOT "%SOLR_OPTS%"=="" set START_OPTS=%START_OPTS% %SOLR_OPTS%
 
 cd "%SOLR_SERVER_DIR%"
+
+IF NOT EXIST "%SOLR_SERVER_DIR%\logs" (
+  mkdir "%SOLR_SERVER_DIR%\logs"
+)
+
 @echo.
 @echo Starting Solr on port %SOLR_PORT% from %SOLR_SERVER_DIR%
 @echo.
@@ -685,21 +689,17 @@ IF "%EXAMPLE%"=="techproducts" (
 )
 
 IF NOT "!CREATE_EXAMPLE_CONFIG!"=="" (
-  timeout /T 5
+  timeout /T 10
   IF "%SOLR_MODE%"=="solrcloud" (
     "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
       -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
       org.apache.solr.util.SolrCLI create_collection -name !EXAMPLE! -shards 1 -replicationFactor 1 ^
       -config !CREATE_EXAMPLE_CONFIG! -configsetsDir "%SOLR_SERVER_DIR%\solr\configsets" -solrUrl http://localhost:%SOLR_PORT%/solr
   ) ELSE (
-    set "CREATE_URL=http://localhost:%SOLR_PORT%/solr/admin/cores?action=CREATE&name=%EXAMPLE%&configSet=!CREATE_EXAMPLE_CONFIG!"
-    @echo.
-    @echo Creating new core using command:
-    @echo !CREATE_URL!
-    @echo.
     "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
       -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-      org.apache.solr.util.SolrCLI api -get "!CREATE_URL!"
+      org.apache.solr.util.SolrCLI create_core -name !EXAMPLE! -solrUrl http://localhost:%SOLR_PORT%/solr ^
+      -config !CREATE_EXAMPLE_CONFIG! -configsetsDir "%SOLR_SERVER_DIR%\solr\configsets"
   )
 )
 
@@ -750,6 +750,30 @@ IF NOT DEFINED CLOUD_NUM_NODES (
 @echo Ok, let's start up %CLOUD_NUM_NODES% Solr nodes for your example SolrCloud cluster.
 
 :start_cloud_nodes
+
+@echo Cloning %DEFAULT_SERVER_DIR% into %SOLR_TIP%\node1
+mkdir "%SOLR_TIP%\node1"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\contexts" "%SOLR_TIP%\node1\contexts"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\etc" "%SOLR_TIP%\node1\etc"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\lib" "%SOLR_TIP%\node1\lib"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\resources" "%SOLR_TIP%\node1\resources"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\scripts" "%SOLR_TIP%\node1\scripts"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\webapps" "%SOLR_TIP%\node1\webapps"
+copy "%DEFAULT_SERVER_DIR%\start.jar" "%SOLR_TIP%\node1\start.jar"
+mkdir "%SOLR_TIP%\node1\solr-webapp"
+mkdir "%SOLR_TIP%\node1\solr"
+mkdir "%SOLR_TIP%\node1\logs"
+xcopy /Q /E /I "%DEFAULT_SERVER_DIR%\solr\configsets" "%SOLR_TIP%\node1\solr\configsets"
+copy "%DEFAULT_SERVER_DIR%\solr\solr.xml" "%SOLR_TIP%\node1\solr\solr.xml"
+copy "%DEFAULT_SERVER_DIR%\solr\zoo.cfg" "%SOLR_TIP%\node1\solr\zoo.cfg"
+
+for /l %%x in (2, 1, !CLOUD_NUM_NODES!) do (
+  IF NOT EXIST "%SOLR_TIP%\node%%x" (
+    @echo Cloning %SOLR_TIP%\node1 into %SOLR_TIP%\node%%x
+    xcopy /Q /E /I "%SOLR_TIP%\node1" "%SOLR_TIP%\node%%x"
+  )
+)
+
 for /l %%x in (1, 1, !CLOUD_NUM_NODES!) do (
   set USER_INPUT=
   set /A idx=%%x-1
@@ -776,11 +800,6 @@ for /l %%x in (1, 1, !CLOUD_NUM_NODES!) 
     @echo.
   )
 
-  IF NOT EXIST "%SOLR_TIP%\node%%x" (
-    @echo Cloning %DEFAULT_SERVER_DIR% into %SOLR_TIP%\node%%x
-    xcopy /Q /E /I "%DEFAULT_SERVER_DIR%" "%SOLR_TIP%\node%%x"
-  )
-
   IF NOT "!SOLR_HEAP!"=="" (
     set "DASHM=-m !SOLR_HEAP!"
   ) ELSE (
@@ -928,6 +947,7 @@ IF "%1"=="-n" goto set_create_name
 IF "%1"=="-name" goto set_create_name
 IF "%1"=="-shards" goto set_create_shards
 IF "%1"=="-replicationFactor" goto set_create_rf
+IF "%1"=="-p" goto set_create_port
 IF "%1"=="-help" goto usage
 IF "%1"=="-usage" goto usage
 IF "%1"=="/?" goto usage
@@ -945,6 +965,12 @@ SHIFT
 SHIFT
 goto parse_create_args
 
+:set_create_port
+set CREATE_PORT=%~2
+SHIFT
+SHIFT
+goto parse_create_args
+
 :set_create_shards
 set CREATE_NUM_SHARDS=%~2
 SHIFT
@@ -967,61 +993,34 @@ IF "!CREATE_NUM_SHARDS!"=="" set CREATE_
 IF "!CREATE_REPFACT!"=="" set CREATE_REPFACT=1
 
 REM Find a port that Solr is running on
-set CREATE_PORT=0
-for /f "usebackq" %%i in (`dir /b %SOLR_TIP\bin% ^| findstr /i "^solr-.*\.port$"`) do (
-  set SOME_SOLR_PORT=
-  For /F "Delims=" %%J In (%SOLR_TIP%\bin\%%i) do set SOME_SOLR_PORT=%%~J
-  if NOT "!SOME_SOLR_PORT!"=="" (
-    for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening" ^| find /i "!SOME_SOLR_PORT!"') do (
-      set CREATE_PORT=!SOME_SOLR_PORT!
+if "!CREATE_PORT!"=="" (
+  for /f "usebackq" %%i in (`dir /b %SOLR_TIP\bin% ^| findstr /i "^solr-.*\.port$"`) do (
+    set SOME_SOLR_PORT=
+    For /F "Delims=" %%J In (%SOLR_TIP%\bin\%%i) do set SOME_SOLR_PORT=%%~J
+    if NOT "!SOME_SOLR_PORT!"=="" (
+      for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening" ^| find /i "!SOME_SOLR_PORT!"') do (
+        set CREATE_PORT=!SOME_SOLR_PORT!
+      )
     )
   )
 )
-if "!CREATE_PORT!" EQU "0" (
-  set "SCRIPT_ERROR=Could not find a running Solr instance on this host!"
+if "!CREATE_PORT!"=="" (
+  set "SCRIPT_ERROR=Could not find a running Solr instance on this host! Please use the -p option to specify the port."
   goto err
 )
 
 @echo Found Solr node running on port !CREATE_PORT!
 
-@REM Determine if the Solr node is in cloud or standalone server mode
-"%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
-  -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-  org.apache.solr.util.SolrCLI status -solr http://localhost:!CREATE_PORT!/solr > solr_status.txt
-set /p VAR=<solr_status.txt
-del solr_status.txt
-if "!VAR!"=="!VAR:ZooKeeper=!" (
-  @REM Not in CloudMode - create core
-  if "%SCRIPT_CMD%"=="create_core" (
-    set "CREATE_URL=http://localhost:!CREATE_PORT!/solr/admin/cores?action=CREATE&name=!CREATE_NAME!&configSet=!CREATE_CONFIGSET!"
-    @echo.
-    @echo Creating new core using command:
-    @echo !CREATE_URL!
-    @echo.
-    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
-      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-      org.apache.solr.util.SolrCLI api -get "!CREATE_URL!"
-  ) else (
-    @echo.
-    @echo ERROR: Solr running on port !CREATE_PORT! is running in standalone server mode, please use the create_core command instead.
-    @echo %SCRIPT_CMD% can only be used when running in SolrCloud mode.
-    @echo.
-    goto done
-  )
-) ELSE (
-  @REM In CloudMode - create collection
-  if "%SCRIPT_CMD%"=="create_collection" (
-    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
-      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-      org.apache.solr.util.SolrCLI create_collection -name !CREATE_NAME! -shards !CREATE_NUM_SHARDS! -replicationFactor !CREATE_REPFACT! ^
-      -config !CREATE_CONFIGSET! -configsetsDir "%SOLR_TIP%\server\solr\configsets" -solrUrl http://localhost:!CREATE_PORT!/solr
-  ) else (
-    @echo.
-    @echo ERROR: Solr running on port !CREATE_PORT! is running in SolrCloud mode, please use the create_collection command instead.
-    @echo %SCRIPT_CMD% can only be used when running in standalone server mode.
-    @echo.
-    goto done
-  )
+if "%SCRIPT_CMD%"=="create_core" (
+  "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+    -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+    org.apache.solr.util.SolrCLI create_core -name !CREATE_NAME!  -solrUrl http://localhost:!CREATE_PORT!/solr ^
+    -config !CREATE_CONFIGSET! -configsetsDir "%SOLR_TIP%\server\solr\configsets"
+) else (
+  "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+    -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+    org.apache.solr.util.SolrCLI create_collection -name !CREATE_NAME! -shards !CREATE_NUM_SHARDS! -replicationFactor !CREATE_REPFACT! ^
+    -config !CREATE_CONFIGSET! -configsetsDir "%SOLR_TIP%\server\solr\configsets" -solrUrl http://localhost:!CREATE_PORT!/solr
 )
 goto done
 
@@ -1052,11 +1051,11 @@ IF "%FIRST_ARG%"=="start" (
 )
 
 :need_java_home
-@echo Please set the JAVA_HOME environment variable to the path where you installed Java 1.7+
+@echo Please set the JAVA_HOME environment variable to the path where you installed Java 1.8+
 goto done
 
 :need_java_vers
-@echo Java 1.7 or later is required to run Solr.
+@echo Java 1.8 or later is required to run Solr.
 goto done
 
 :err

Modified: lucene/dev/branches/lucene6005/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/build.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/build.xml (original)
+++ lucene/dev/branches/lucene6005/solr/build.xml Thu Nov 27 20:41:01 2014
@@ -380,7 +380,7 @@
     <svn-export-source source.dir=".."/>
 
     <!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
-    <delete dir="${svn.export.dir}/lucene/tools/javadoc/java7"/>
+    <delete dir="${svn.export.dir}/lucene/tools/javadoc/java8"/>
     <!-- Exclude clover license files incompatible with the ASL -->
     <delete dir="${svn.export.dir}/lucene/tools/clover"/>
 

Modified: lucene/dev/branches/lucene6005/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/common-build.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/common-build.xml (original)
+++ lucene/dev/branches/lucene6005/solr/common-build.xml Thu Nov 27 20:41:01 2014
@@ -25,9 +25,9 @@
   
   <property name="Name" value="Solr" />
   
-  <!-- solr uses 1.7 -->
-  <property name="javac.source" value="1.7"/>
-  <property name="javac.target" value="1.7"/>
+  <!-- solr uses 1.8 -->
+  <property name="javac.source" value="1.8"/>
+  <property name="javac.target" value="1.8"/>
   <property name="javac.args" value=""/>
   
   <property name="dest" location="${common-solr.dir}/build" />

Modified: lucene/dev/branches/lucene6005/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/schema.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/schema.xml Thu Nov 27 20:41:01 2014
@@ -244,7 +244,7 @@
              See the Java Regular Expression documentation for more
              infomation on pattern and replacement string syntax.
              
-             http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
+             http://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html
           -->
         <filter class="solr.PatternReplaceFilterFactory"
                 pattern="([^a-z])" replacement="" replace="all"

Modified: lucene/dev/branches/lucene6005/solr/contrib/contrib-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/contrib-build.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/contrib-build.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/contrib-build.xml Thu Nov 27 20:41:01 2014
@@ -49,8 +49,8 @@
 
   <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
     <sequential>
-      <ivy:retrieve conf="compile" type="jar,bundle" sync="${ivy.sync}" log="download-only"/>
-      <ivy:retrieve conf="test" type="jar,bundle,test" sync="${ivy.sync}" log="download-only"
+      <ivy:retrieve conf="compile" type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"/>
+      <ivy:retrieve conf="test" type="jar,bundle,test" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"
                     pattern="${test.lib.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
     </sequential>
   </target>

Modified: lucene/dev/branches/lucene6005/solr/contrib/dataimporthandler/src/test-files/dih/solr/collection1/conf/dataimport-solr_id-schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/dataimporthandler/src/test-files/dih/solr/collection1/conf/dataimport-solr_id-schema.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/dataimporthandler/src/test-files/dih/solr/collection1/conf/dataimport-solr_id-schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/dataimporthandler/src/test-files/dih/solr/collection1/conf/dataimport-solr_id-schema.xml Thu Nov 27 20:41:01 2014
@@ -229,7 +229,7 @@
              See the Java Regular Expression documentation for more
              infomation on pattern and replacement string syntax.
              
-             http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
+             http://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html
           -->
         <filter class="solr.PatternReplaceFilterFactory"
                 pattern="([^a-z])" replacement="" replace="all"

Modified: lucene/dev/branches/lucene6005/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java Thu Nov 27 20:41:01 2014
@@ -43,8 +43,6 @@ public class SolrCellMorphlineTest exten
   @BeforeClass
   public static void beforeClass2() {
     assumeFalse("FIXME: Morphlines currently has issues with Windows paths", Constants.WINDOWS);
-    assumeFalse("FIXME: This test fails under Java 8 due to the Saxon dependency - see SOLR-1301", Constants.JRE_IS_MINIMUM_JAVA8);
-    assumeFalse("FIXME: This test fails under J9 due to the Saxon dependency - see SOLR-1301", System.getProperty("java.vm.info", "<?>").contains("IBM J9"));
   }
 
   @Before

Modified: lucene/dev/branches/lucene6005/solr/contrib/morphlines-core/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/morphlines-core/build.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/morphlines-core/build.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/morphlines-core/build.xml Thu Nov 27 20:41:01 2014
@@ -93,8 +93,8 @@
 
   <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
     <sequential>
-      <ivy:retrieve conf="compile" type="jar,bundle" sync="${ivy.sync}" log="download-only"/>
-      <ivy:retrieve conf="test,test.DfsMiniCluster" type="jar,bundle,test" sync="${ivy.sync}" log="download-only"
+      <ivy:retrieve conf="compile" type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"/>
+      <ivy:retrieve conf="test,test.DfsMiniCluster" type="jar,bundle,test" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"
                     pattern="${test.lib.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
     </sequential>
   </target>

Modified: lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/schema.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/schema.xml Thu Nov 27 20:41:01 2014
@@ -361,7 +361,7 @@
           documentation for more information on pattern and replacement
           string syntax.
 
-          http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
+          http://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html
         -->
         <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z])"
           replacement="" replace="all" />

Modified: lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/uima-tokenizers-schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/uima-tokenizers-schema.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/uima-tokenizers-schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/contrib/uima/src/test-files/uima/uima-tokenizers-schema.xml Thu Nov 27 20:41:01 2014
@@ -357,7 +357,7 @@
           documentation for more information on pattern and replacement
           string syntax.
 
-          http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
+          http://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html
         -->
         <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z])"
           replacement="" replace="all" />

Modified: lucene/dev/branches/lucene6005/solr/core/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/build.xml?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/build.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/build.xml Thu Nov 27 20:41:01 2014
@@ -62,8 +62,8 @@
 
   <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
     <sequential>
-      <ivy:retrieve conf="compile,compile.hadoop" type="jar,bundle" sync="${ivy.sync}" log="download-only"/>
-      <ivy:retrieve conf="test,test.DfsMiniCluster" type="jar,bundle,test" sync="${ivy.sync}" log="download-only"
+      <ivy:retrieve conf="compile,compile.hadoop" type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"/>
+      <ivy:retrieve conf="test,test.DfsMiniCluster" type="jar,bundle,test" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"
                     pattern="${test.lib.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
     </sequential>
   </target>
@@ -92,7 +92,7 @@
   <target name="resolve-javacc" xmlns:ivy="antlib:org.apache.ivy.ant">
     <!-- setup a "fake" JavaCC distribution folder in ${build.dir} to make JavaCC ANT task happy: -->
     <ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0"
-      inline="true" transitive="false" type="jar" sync="true"
+      inline="true" transitive="false" type="jar" sync="true" symlink="${ivy.symlink}"
       pattern="${build.dir}/javacc/bin/lib/[artifact].[ext]"/>
   </target>
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java Thu Nov 27 20:41:01 2014
@@ -90,6 +90,7 @@ public class DistributedQueue {
     TreeMap<Long,String> orderedChildren = new TreeMap<>();
 
     List<String> childNames = zookeeper.getChildren(dir, watcher, true);
+    stats.setQueueLength(childNames.size());
     for (String childName : childNames) {
       try {
         // Check format
@@ -117,6 +118,7 @@ public class DistributedQueue {
       throws KeeperException, InterruptedException {
 
     List<String> childNames = zookeeper.getChildren(dir, null, true);
+    stats.setQueueLength(childNames.size());
     for (String childName : childNames) {
       if (childName != null) {
         try {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java Thu Nov 27 20:41:01 2014
@@ -1,9 +1,5 @@
 package org.apache.solr.cloud;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
@@ -28,6 +24,7 @@ import org.apache.zookeeper.KeeperExcept
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -136,13 +133,12 @@ class ShardLeaderElectionContextBase ext
     try {
       RetryUtil.retryOnThrowable(NodeExistsException.class, 15000, 1000,
           new RetryCmd() {
-            
             @Override
             public void execute() throws Throwable {
-              zkClient.makePath(leaderPath, ZkStateReader.toJSON(leaderProps),
-                  CreateMode.EPHEMERAL, true);
+              zkClient.makePath(leaderPath, ZkStateReader.toJSON(leaderProps), CreateMode.EPHEMERAL, true);
             }
-          });
+          }
+      );
     } catch (Throwable t) {
       if (t instanceof OutOfMemoryError) {
         throw (OutOfMemoryError) t;
@@ -407,13 +403,19 @@ final class ShardLeaderElectionContext e
     
     Slice slices = zkController.getClusterState().getSlice(collection, shardId);
     int cnt = 0;
-    while (true && !isClosed && !cc.isShutDown()) {
+    while (!isClosed && !cc.isShutDown()) {
       // wait for everyone to be up
       if (slices != null) {
         int found = 0;
         try {
           found = zkClient.getChildren(shardsElectZkPath, null, true).size();
         } catch (KeeperException e) {
+          if (e instanceof KeeperException.SessionExpiredException) {
+            // if the session has expired, then another election will be launched, so
+            // quit here
+            throw new SolrException(ErrorCode.SERVER_ERROR,
+                                    "ZK session expired - cancelling election for " + collection + " " + shardId);
+          }
           SolrException.log(log,
               "Error checking for the number of election participants", e);
         }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/Overseer.java Thu Nov 27 20:41:01 2014
@@ -216,7 +216,7 @@ public class Overseer implements Closeab
                   final String operation = message.getStr(QUEUE_OPERATION);
                   final TimerContext timerContext = stats.time(operation);
                   try {
-                    clusterState = processMessage(clusterState, message, operation);
+                    clusterState = processMessage(clusterState, message, operation, workQueue.getStats().getQueueLength());
                     stats.success(operation);
                   } catch (Exception e) {
                     // generally there is nothing we can do - in most cases, we have
@@ -314,7 +314,7 @@ public class Overseer implements Closeab
 
                 final TimerContext timerContext = stats.time(operation);
                 try {
-                  clusterState = processMessage(clusterState, message, operation);
+                  clusterState = processMessage(clusterState, message, operation, stateUpdateQueue.getStats().getQueueLength());
                   stats.success(operation);
                 } catch (Exception e) {
                   // generally there is nothing we can do - in most cases, we have
@@ -461,8 +461,8 @@ public class Overseer implements Closeab
     }
 
     private ClusterState processMessage(ClusterState clusterState,
-        final ZkNodeProps message, final String operation) {
-
+        final ZkNodeProps message, final String operation, int queueSize) {
+      log.info("processMessage: queueSize: {}, message = {}", queueSize, message);
       CollectionParams.CollectionAction collectionAction = CollectionParams.CollectionAction.get(operation);
       if (collectionAction != null) {
         switch (collectionAction) {
@@ -701,7 +701,6 @@ public class Overseer implements Closeab
     }
 
     private ClusterState createReplica(ClusterState clusterState, ZkNodeProps message) {
-      log.info("createReplica() {} ", message);
       String coll = message.getStr(ZkStateReader.COLLECTION_PROP);
       if (!checkCollectionKeyExistence(message)) return clusterState;
       String slice = message.getStr(ZkStateReader.SHARD_ID_PROP);
@@ -724,7 +723,7 @@ public class Overseer implements Closeab
 
     private ClusterState buildCollection(ClusterState clusterState, ZkNodeProps message) {
       String collection = message.getStr("name");
-      log.info("building a new collection: " + collection);
+      log.info("Building a new collection: {}", collection);
       if(clusterState.hasCollection(collection) ){
         log.warn("Collection {} already exists. exit" ,collection);
         return clusterState;
@@ -746,7 +745,7 @@ public class Overseer implements Closeab
     private ClusterState updateShardState(ClusterState clusterState, ZkNodeProps message) {
       String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
       if (!checkCollectionKeyExistence(message)) return clusterState;
-      log.info("Update shard state invoked for collection: " + collection + " with message: " + message);
+      log.info("Updating shard state for collection: {}", collection);
       for (String key : message.keySet()) {
         if (ZkStateReader.COLLECTION_PROP.equals(key)) continue;
         if (QUEUE_OPERATION.equals(key)) continue;
@@ -932,7 +931,6 @@ public class Overseer implements Closeab
         final String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
         if (!checkCollectionKeyExistence(message)) return clusterState;
         Integer numShards = message.getInt(ZkStateReader.NUM_SHARDS_PROP, null);
-        log.info("Update state numShards={} message={}", numShards, message);
 
         List<String> shardNames  = new ArrayList<>();
 
@@ -1336,7 +1334,7 @@ public class Overseer implements Closeab
       final String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
       if (!checkCollectionKeyExistence(message)) return clusterState;
 
-      log.info("Removing collection: " + collection + " shard: " + sliceId + " from clusterstate");
+      log.info("Removing collection: {}, shard: {} from cluster state", collection, sliceId);
 
       DocCollection coll = clusterState.getCollection(collection);
 
@@ -1964,6 +1962,7 @@ public class Overseer implements Closeab
     static final int MAX_STORED_FAILURES = 10;
 
     final Map<String, Stat> stats = new ConcurrentHashMap<>();
+    private volatile int queueLength;
 
     public Map<String, Stat> getStats() {
       return stats;
@@ -2034,6 +2033,14 @@ public class Overseer implements Closeab
         return ret;
       }
     }
+
+    public int getQueueLength() {
+      return queueLength;
+    }
+
+    public void setQueueLength(int queueLength) {
+      this.queueLength = queueLength;
+    }
   }
 
   public static class Stat  {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkController.java Thu Nov 27 20:41:01 2014
@@ -41,7 +41,6 @@ import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
@@ -1080,7 +1079,7 @@ public final class ZkController {
   }
   
   public void publish(final CoreDescriptor cd, final String state, boolean updateLastState) throws KeeperException, InterruptedException {
-    publish(cd, state, true, false);
+    publish(cd, state, updateLastState, false);
   }
   
   /**
@@ -1222,9 +1221,9 @@ public final class ZkController {
     overseerJobQueue.offer(ZkStateReader.toJSON(m));
 
     if(configLocation != null) {
-      synchronized (confDirectoryWatchers) {
+      synchronized (confDirectoryListeners) {
         log.info("This conf directory is no more watched {0}",configLocation);
-        confDirectoryWatchers.remove(configLocation);
+        confDirectoryListeners.remove(configLocation);
       }
     }
   }
@@ -2115,29 +2114,42 @@ public final class ZkController {
    *
    * @return true on success
    */
-  public static boolean persistConfigResourceToZooKeeper( SolrResourceLoader loader, int znodeVersion , String resourceName, byte[] content, boolean createIfNotExists) {
+  public static boolean persistConfigResourceToZooKeeper( SolrResourceLoader loader, int znodeVersion ,
+                                                          String resourceName, byte[] content,
+                                                          boolean createIfNotExists) {
     final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader)loader;
     final ZkController zkController = zkLoader.getZkController();
     final SolrZkClient zkClient = zkController.getZkClient();
     final String resourceLocation = zkLoader.getConfigSetZkPath() + "/" + resourceName;
-    String errMsg = "Failed to persist resource at {0} - version mismatch";
+    String errMsg = "Failed to persist resource at {0} - version mismatch {1}";
     try {
       try {
         zkClient.setData(resourceLocation , content,znodeVersion, true);
+        zkClient.setData(zkLoader.getConfigSetZkPath(),new byte[]{0},true);
       } catch (NoNodeException e) {
         if(createIfNotExists){
           try {
             zkClient.create(resourceLocation,content, CreateMode.PERSISTENT,true);
+            zkClient.setData(zkLoader.getConfigSetZkPath(), new byte[]{0}, true);
           } catch (KeeperException.NodeExistsException nee) {
-            log.info(MessageFormat.format(errMsg,resourceLocation));
-            throw new ResourceModifiedInZkException(ErrorCode.CONFLICT, MessageFormat.format(errMsg,resourceLocation) + ", retry.");
+            try {
+              Stat stat = zkClient.exists(resourceLocation, null, true);
+              log.info("failed to set data version in zk is {} and expected version is {} ", stat.getVersion(),znodeVersion);
+            } catch (Exception e1) {
+              log.warn("could not get stat");
+            }
+
+            log.info(MessageFormat.format(errMsg,resourceLocation,znodeVersion));
+            throw new ResourceModifiedInZkException(ErrorCode.CONFLICT, MessageFormat.format(errMsg,resourceLocation,znodeVersion) + ", retry.");
           }
         }
       }
 
     } catch (KeeperException.BadVersionException bve){
       log.info(MessageFormat.format(errMsg,resourceLocation));
-      throw new ResourceModifiedInZkException(ErrorCode.CONFLICT, MessageFormat.format(errMsg,resourceLocation) + ", retry.");
+      throw new ResourceModifiedInZkException(ErrorCode.CONFLICT, MessageFormat.format(errMsg,resourceLocation,znodeVersion) + ", retry.");
+    }catch (ResourceModifiedInZkException e){
+      throw e;
     } catch (Exception e) {
       if (e instanceof InterruptedException) {
         Thread.currentThread().interrupt(); // Restore the interrupted status
@@ -2157,9 +2169,13 @@ public final class ZkController {
 
   public void unRegisterConfListener(Runnable listener) {
     if(listener == null) return;
-    synchronized (confDirectoryWatchers){
-      for (Set<Runnable> runnables : confDirectoryWatchers.values()) {
-        if(runnables != null) runnables.remove(listener);
+    synchronized (confDirectoryListeners){
+      for (Set<Runnable> listeners : confDirectoryListeners.values()) {
+        if(listeners != null) {
+          if(listeners.remove(listener)) {
+            log.info(" a listener was removed because of core close");
+          }
+        }
       }
     }
 
@@ -2172,9 +2188,9 @@ public final class ZkController {
    */
   public void registerConfListenerForCore(String confDir,SolrCore core, final Runnable listener){
     if(listener==null) throw new NullPointerException("listener cannot be null");
-    synchronized (confDirectoryWatchers){
-      if(confDirectoryWatchers.containsKey(confDir)){
-        confDirectoryWatchers.get(confDir).add(listener);
+    synchronized (confDirectoryListeners){
+      if(confDirectoryListeners.containsKey(confDir)){
+        confDirectoryListeners.get(confDir).add(listener);
         core.addCloseHook(new CloseHook() {
           @Override
           public void preClose(SolrCore core) {
@@ -2184,69 +2200,76 @@ public final class ZkController {
           @Override
           public void postClose(SolrCore core) { }
         });
-
-
       } else {
         throw new SolrException(ErrorCode.SERVER_ERROR,"This conf directory is not valid");
       }
     }
   }
 
-  private Map<String , Set<Runnable>> confDirectoryWatchers =  new HashMap<>();
-  void watchZKConfDir(final String zkDir)  {
+  private final Map<String , Set<Runnable>> confDirectoryListeners =  new HashMap<>();
 
-      if(!confDirectoryWatchers.containsKey(zkDir)){
-        confDirectoryWatchers.put(zkDir,new HashSet<Runnable>());
-      }else{
-        //it's already watched
-        return;
-      }
+  void watchZKConfDir(final String zkDir) {
+    log.info("watch zkdir " + zkDir);
+    if (!confDirectoryListeners.containsKey(zkDir)) {
+      confDirectoryListeners.put(zkDir,  new HashSet<Runnable>());
+      setConfWatcher(zkDir, new WatcherImpl(zkDir));
 
-      Watcher watcher = new Watcher() {
-        @Override
-        public void process(WatchedEvent event) {
-          try {
-            synchronized (confDirectoryWatchers) {
-              // if this is not among directories to be watched then don't set the watcher anymore
-              if(!confDirectoryWatchers.containsKey(zkDir)) return;
-            }
+    }
 
-            if (event.getType() == Event.EventType.NodeChildrenChanged) {
-              synchronized (confDirectoryWatchers) {
-                final Set<Runnable> listeners = confDirectoryWatchers.get(zkDir);
-                if (listeners != null) {
-                  new Thread() {
-                    @Override
-                    public synchronized void run() {
-                    //running in a separate thread so that the zk event thread is not
-                    // unnecessarily held up
-                      for (Runnable listener : listeners) listener.run();
-                    }
-                  }.start();
-                }
-              }
 
-            }
-          } finally {
-            if (Event.EventType.None.equals(event.getType())) {
+  }
+  private class WatcherImpl implements Watcher{
+    private final String zkDir ;
+
+    private WatcherImpl(String dir) {
+      this.zkDir = dir;
+    }
+
+    @Override
+      public void process(WatchedEvent event) {
+        try {
+
+          synchronized (confDirectoryListeners) {
+            // if this is not among directories to be watched then don't set the watcher anymore
+            if( !confDirectoryListeners.containsKey(zkDir)) {
+              log.info("Watcher on {} is removed ", zkDir);
               return;
-            } else {
-              setConfWatcher(zkDir,this);
             }
+            final Set<Runnable> listeners = confDirectoryListeners.get(zkDir);
+            if (listeners != null && !listeners.isEmpty()) {
+              new Thread() {
+                //run these in a separate thread because this can be long running
+                public void run() {
+                  for (final Runnable listener : listeners)
+                    try {
+                      listener.run();
+                    } catch (Exception e) {
+                      log.warn("listener throws error", e);
+                    }
+                }
+              }.start();
+            }
+
           }
-        }
-      };
 
-     setConfWatcher(zkDir,watcher);
+        } finally {
+          if (Event.EventType.None.equals(event.getType())) {
+            log.info("A node got unwatched for {}", zkDir);
+            return;
+          } else {
+            setConfWatcher(zkDir,this);
+          }
+        }
+      }
     }
 
   private void setConfWatcher(String zkDir, Watcher watcher) {
     try {
-      zkClient.getChildren(zkDir,watcher,true);
+      zkClient.exists(zkDir,watcher,true);
     } catch (KeeperException e) {
       log.error("failed to set watcher for conf dir {} ", zkDir);
     } catch (InterruptedException e) {
-      Thread.interrupted();
+      Thread.currentThread().interrupt();
       log.error("failed to set watcher for conf dir {} ", zkDir);
     }
   }
@@ -2255,11 +2278,10 @@ public final class ZkController {
     return new OnReconnect() {
       @Override
       public void command() {
-        synchronized (confDirectoryWatchers){
-          for (String s : confDirectoryWatchers.keySet()) {
+        synchronized (confDirectoryListeners){
+          for (String s : confDirectoryListeners.keySet()) {
             watchZKConfDir(s);
           }
-
         }
       }
     };

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java Thu Nov 27 20:41:01 2014
@@ -111,10 +111,6 @@ public class ZkSolrResourceLoader extend
 
     }
 
-    public ZkByteArrayInputStream(byte[] buf, int offset, int length, Stat stat) {
-      super(buf, offset, length);
-      this.stat = stat;
-    }
     public Stat getStat(){
       return stat;
     }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/Config.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/Config.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/Config.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/Config.java Thu Nov 27 20:41:01 2014
@@ -18,6 +18,7 @@
 package org.apache.solr.core;
 
 import org.apache.lucene.util.Version;
+import org.apache.solr.cloud.ZkSolrResourceLoader;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.util.DOMUtil;
 import org.apache.solr.util.SystemIdResolver;
@@ -48,6 +49,7 @@ import javax.xml.xpath.XPathExpressionEx
 import javax.xml.xpath.XPathFactory;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.text.ParseException;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -74,6 +76,7 @@ public class Config {
   private final String prefix;
   private final String name;
   private final SolrResourceLoader loader;
+  private int zkVersion = -1;
 
   /**
    * Builds a config from a resource name with no xpath prefix.
@@ -113,9 +116,14 @@ public class Config {
     this.prefix = (prefix != null && !prefix.endsWith("/"))? prefix + '/' : prefix;
     try {
       javax.xml.parsers.DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-      
+
       if (is == null) {
-        is = new InputSource(loader.openConfig(name));
+        InputStream in = loader.openConfig(name);
+        if (in instanceof ZkSolrResourceLoader.ZkByteArrayInputStream) {
+          zkVersion = ((ZkSolrResourceLoader.ZkByteArrayInputStream) in).getStat().getVersion();
+          log.info("loaded config {} with version {} ",name,zkVersion);
+        }
+        is = new InputSource(in);
         is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));
       }
 
@@ -464,6 +472,12 @@ public class Config {
     return version;
   }
 
+  /**If this config is loaded from zk the version is relevant other wise -1 is returned
+   */
+  public int getZnodeVersion(){
+    return zkVersion;
+  }
+
   public Config getOriginalConfig() {
     return new Config(loader, null, origDoc);
   }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java Thu Nov 27 20:41:01 2014
@@ -34,7 +34,7 @@ import org.noggit.JSONParser;
 import org.noggit.JSONWriter;
 import org.noggit.ObjectBuilder;
 
-public class ConfigOverlay {
+public class ConfigOverlay implements MapSerializable{
   private final int znodeVersion ;
   private Map<String, Object> data;
   private Map<String,Object> props;
@@ -177,13 +177,6 @@ public class ConfigOverlay {
     return out.toString();
   }
 
-  public  Map toOutputFormat() {
-    Map result = new LinkedHashMap();
-    result.put("version",znodeVersion);
-    result.putAll(data);
-    return result;
-  }
-
 
   public static final String RESOURCE_NAME = "configoverlay.json";
 
@@ -254,4 +247,12 @@ public class ConfigOverlay {
   public Map<String, Object> getUserProps() {
     return userProps;
   }
+
+  @Override
+  public Map<String, Object> toMap() {
+    Map result = new LinkedHashMap();
+    result.put("znodeVersion",znodeVersion);
+    result.putAll(data);
+    return result;
+  }
 }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/CoreContainer.java Thu Nov 27 20:41:01 2014
@@ -22,7 +22,6 @@ import static com.google.common.base.Pre
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -602,7 +601,7 @@ public class CoreContainer {
       solrCores.waitAddPendingCoreOps(name);
       ConfigSet coreConfig = coreConfigService.getConfig(cd);
       log.info("Reloading SolrCore '{}' using configuration from {}", cd.getName(), coreConfig.getName());
-      SolrCore newCore = core.reload(coreConfig, core);
+      SolrCore newCore = core.reload(coreConfig);
       registerCore(name, newCore, false);
     }
     catch (Exception e) {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/InitParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/InitParams.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/InitParams.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/InitParams.java Thu Nov 27 20:41:01 2014
@@ -78,10 +78,16 @@ public class InitParams {
 
   }
 
-  public void apply(NamedList initArgs) {
-    merge( (NamedList) initArgs.get(PluginInfo.DEFAULTS), defaults,initArgs, PluginInfo.DEFAULTS, false);
-    merge((NamedList) initArgs.get(PluginInfo.INVARIANTS), invariants, initArgs, PluginInfo.INVARIANTS, false);
-    merge((NamedList) initArgs.get(PluginInfo.APPENDS), appends, initArgs, PluginInfo.APPENDS, true);
+  public void apply(PluginInfo info) {
+    if (info.isFromSolrConfig) {
+      //if this is a component implicitly defined in code it should be overridden by initPrams
+      merge(defaults, (NamedList) info.initArgs.get(PluginInfo.DEFAULTS) ,info.initArgs, PluginInfo.DEFAULTS, false);
+    } else {
+      //if the args is initialized from solrconfig.xml inside the requesthHandler it should be taking precedence over  initParams
+      merge( (NamedList) info.initArgs.get(PluginInfo.DEFAULTS), defaults,info.initArgs, PluginInfo.DEFAULTS, false);
+    }
+    merge((NamedList) info.initArgs.get(PluginInfo.INVARIANTS), invariants, info.initArgs, PluginInfo.INVARIANTS, false);
+    merge((NamedList) info.initArgs.get(PluginInfo.APPENDS), appends, info.initArgs, PluginInfo.APPENDS, true);
   }
 
   private static  void merge(NamedList first, NamedList second, NamedList sink, String name, boolean appends) {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java Thu Nov 27 20:41:01 2014
@@ -53,6 +53,10 @@ public class JmxMonitoredMap<K, V> exten
   private static final Logger LOG = LoggerFactory.getLogger(JmxMonitoredMap.class
           .getName());
 
+  // set to true to use cached statistics NamedLists between getMBeanInfo calls to work
+  // around over calling getStatistics on MBeanInfos when iterating over all attributes (SOLR-6586)
+  private boolean useCachedStatsBetweenGetMBeanInfoCalls = Boolean.getBoolean("useCachedStatsBetweenGetMBeanInfoCalls");
+  
   private MBeanServer server = null;
 
   private String jmxRootName;
@@ -144,7 +148,7 @@ public class JmxMonitoredMap<K, V> exten
         ObjectName name = getObjectName(key, infoBean);
         if (server.isRegistered(name))
           server.unregisterMBean(name);
-        SolrDynamicMBean mbean = new SolrDynamicMBean(coreHashCode, infoBean);
+        SolrDynamicMBean mbean = new SolrDynamicMBean(coreHashCode, infoBean, useCachedStatsBetweenGetMBeanInfoCalls);
         server.registerMBean(mbean, name);
       } catch (Exception e) {
         LOG.warn( "Failed to register info bean: " + key, e);
@@ -213,8 +217,17 @@ public class JmxMonitoredMap<K, V> exten
     private HashSet<String> staticStats;
 
     private String coreHashCode;
-
+    
+    private volatile NamedList cachedDynamicStats;
+    
+    private boolean useCachedStatsBetweenGetMBeanInfoCalls;
+    
     public SolrDynamicMBean(String coreHashCode, SolrInfoMBean managedResource) {
+      this(coreHashCode, managedResource, false);
+    }
+
+    public SolrDynamicMBean(String coreHashCode, SolrInfoMBean managedResource, boolean useCachedStatsBetweenGetMBeanInfoCalls) {
+      this.useCachedStatsBetweenGetMBeanInfoCalls = useCachedStatsBetweenGetMBeanInfoCalls;
       this.infoBean = managedResource;
       staticStats = new HashSet<>();
 
@@ -242,6 +255,11 @@ public class JmxMonitoredMap<K, V> exten
 
       try {
         NamedList dynamicStats = infoBean.getStatistics();
+        
+        if (useCachedStatsBetweenGetMBeanInfoCalls) {
+          cachedDynamicStats = dynamicStats;
+        }
+        
         if (dynamicStats != null) {
           for (int i = 0; i < dynamicStats.size(); i++) {
             String name = dynamicStats.getName(i);
@@ -303,8 +321,17 @@ public class JmxMonitoredMap<K, V> exten
           throw new AttributeNotFoundException(attribute);
         }
       } else {
-        NamedList list = infoBean.getStatistics();
-        val = list.get(attribute);
+        NamedList stats = null;
+        if (useCachedStatsBetweenGetMBeanInfoCalls) {
+          NamedList cachedStats = this.cachedDynamicStats;
+          if (cachedStats != null) {
+            stats = cachedStats;
+          }
+        }
+        if (stats == null) {
+          stats = infoBean.getStatistics();
+        }
+        val = stats.get(attribute);
       }
 
       if (val != null) {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/PluginInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/PluginInfo.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/PluginInfo.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/PluginInfo.java Thu Nov 27 20:41:01 2014
@@ -34,6 +34,7 @@ public class PluginInfo implements MapSe
   public final NamedList initArgs;
   public final Map<String, String> attributes;
   public final List<PluginInfo> children;
+  public final boolean isFromSolrConfig;
 
   public PluginInfo(String type, Map<String, String> attrs ,NamedList initArgs, List<PluginInfo> children) {
     this.type = type;
@@ -42,6 +43,7 @@ public class PluginInfo implements MapSe
     this.initArgs = initArgs;
     attributes = unmodifiableMap(attrs);
     this.children = children == null ? Collections.<PluginInfo>emptyList(): unmodifiableList(children);
+    isFromSolrConfig = false;
   }
 
 
@@ -52,6 +54,7 @@ public class PluginInfo implements MapSe
     initArgs = DOMUtil.childNodesToNamedList(node);
     attributes = unmodifiableMap(DOMUtil.toMap(node.getAttributes()));
     children = loadSubPlugins(node);
+    isFromSolrConfig = true;
   }
 
   private List<PluginInfo> loadSubPlugins(Node node) {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/RequestHandlers.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/RequestHandlers.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/RequestHandlers.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/RequestHandlers.java Thu Nov 27 20:41:01 2014
@@ -139,7 +139,8 @@ public final class RequestHandlers {
    * Handlers will be registered and initialized in the order they appear in solrconfig.xml
    */
 
-  void initHandlersFromConfig(SolrConfig config, List<PluginInfo> implicits){
+  void initHandlersFromConfig(SolrConfig config){
+    List<PluginInfo> implicits = PluginsRegistry.getHandlers(core);
     // use link map so we iterate in the same order
     Map<PluginInfo,SolrRequestHandler> handlers = new LinkedHashMap<>();
     Map<String, PluginInfo> implicitInfoMap= new HashMap<>();
@@ -212,7 +213,7 @@ public final class RequestHandlers {
     if(!ags.isEmpty()){
       info = new PluginInfo(info.type, info.attributes, info.initArgs.clone(), info.children);
       for (InitParams initParam : ags) {
-        initParam.apply(info.initArgs);
+        initParam.apply(info);
       }
     }
     return info;

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrConfig.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrConfig.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrConfig.java Thu Nov 27 20:41:01 2014
@@ -328,7 +328,7 @@ public class SolrConfig extends Config i
     }
   }
 
-  private static  ConfigOverlay getConfigOverlay(SolrResourceLoader loader) {
+  public static  ConfigOverlay getConfigOverlay(SolrResourceLoader loader) {
     InputStream in = null;
     try {
       in = loader.openResource(ConfigOverlay.RESOURCE_NAME);
@@ -712,6 +712,7 @@ public class SolrConfig extends Config i
   @Override
   public Map<String, Object> toMap() {
     LinkedHashMap result = new LinkedHashMap();
+    if(getZnodeVersion() > -1) result.put("znodeVersion",getZnodeVersion());
     result.put("luceneMatchVersion",luceneMatchVersion);
     result.put("updateHandler", getUpdateHandlerInfo().toMap());
     Map m = new LinkedHashMap();

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrCore.java Thu Nov 27 20:41:01 2014
@@ -423,18 +423,21 @@ public final class SolrCore implements S
     return responseWriters.put(name, responseWriter);
   }
 
-  public SolrCore reload(ConfigSet coreConfig, SolrCore prev) throws IOException,
+  public SolrCore reload(ConfigSet coreConfig) throws IOException,
       ParserConfigurationException, SAXException {
     
     solrCoreState.increfSolrCoreState();
+    SolrCore currentCore;
     boolean indexDirChange = !getNewIndexDir().equals(getIndexDir());
     if (indexDirChange || !coreConfig.getSolrConfig().nrtMode) {
       // the directory is changing, don't pass on state
-      prev = null;
+      currentCore = null;
+    } else {
+      currentCore = this;
     }
     
     SolrCore core = new SolrCore(getName(), getDataDir(), coreConfig.getSolrConfig(),
-        coreConfig.getIndexSchema(), coreDescriptor, updateHandler, this.solrDelPolicy, prev);
+        coreConfig.getIndexSchema(), coreDescriptor, updateHandler, this.solrDelPolicy, currentCore);
     core.solrDelPolicy = this.solrDelPolicy;
     
 
@@ -807,11 +810,7 @@ public final class SolrCore implements S
       // Processors initialized before the handlers
       updateProcessorChains = loadUpdateProcessorChains();
       reqHandlers = new RequestHandlers(this);
-      List<PluginInfo> implicitReqHandlerInfo = new ArrayList<>();
-      UpdateRequestHandler.addImplicits(implicitReqHandlerInfo);
-      SolrConfigHandler.addImplicits(implicitReqHandlerInfo);
-
-      reqHandlers.initHandlersFromConfig(solrConfig, implicitReqHandlerInfo);
+      reqHandlers.initHandlersFromConfig(solrConfig);
 
       // Handle things that should eventually go away
       initDeprecatedSupport();

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java Thu Nov 27 20:41:01 2014
@@ -695,10 +695,14 @@ public class SolrResourceLoader implemen
 
 
     for (SolrInfoMBean bean : arr) {
-      try {
-        infoRegistry.put(bean.getName(), bean);
-      } catch (Exception e) {
-        log.warn("could not register MBean '" + bean.getName() + "'.", e);
+      // Too slow? I suspect not, but we may need
+      // to start tracking this in a Set.
+      if (!infoRegistry.containsValue(bean)) {
+        try {
+          infoRegistry.put(bean.getName(), bean);
+        } catch (Exception e) {
+          log.warn("could not register MBean '" + bean.getName() + "'.", e);
+        }
       }
     }
   }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java Thu Nov 27 20:41:01 2014
@@ -19,8 +19,8 @@ package org.apache.solr.handler;
 
 
 import java.io.IOException;
-import java.net.URL;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -28,13 +28,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import org.apache.lucene.analysis.util.ResourceLoader;
-import org.apache.lucene.analysis.util.ResourceLoaderAware;
 import org.apache.solr.cloud.ZkController;
 import org.apache.solr.cloud.ZkSolrResourceLoader;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.params.CollectionParams;
 import org.apache.solr.common.params.CommonParams;
@@ -44,12 +41,11 @@ import org.apache.solr.common.params.Sol
 import org.apache.solr.common.util.ContentStream;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.StrUtils;
-import org.apache.solr.core.CloseHook;
 import org.apache.solr.core.ConfigOverlay;
+import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
-import org.apache.solr.core.SolrInfoMBean;
 import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
@@ -94,30 +90,60 @@ public class SolrConfigHandler extends R
   public void inform(final SolrCore core) {
     if( ! (core.getResourceLoader() instanceof  ZkSolrResourceLoader)) return;
     final ZkSolrResourceLoader zkSolrResourceLoader = (ZkSolrResourceLoader) core.getResourceLoader();
-    if(zkSolrResourceLoader != null){
-      Runnable listener = new Runnable() {
-        @Override
-        public void run() {
-          try {
-            if(core.isClosed()) return;
-            Stat stat = zkSolrResourceLoader.getZkController().getZkClient().exists((zkSolrResourceLoader).getConfigSetZkPath() + "/" + ConfigOverlay.RESOURCE_NAME, null, true);
-            if(stat == null) return;
-            if (stat.getVersion() >  core.getSolrConfig().getOverlay().getZnodeVersion()) {
-              core.getCoreDescriptor().getCoreContainer().reload(core.getName());
+    if(zkSolrResourceLoader != null)
+      zkSolrResourceLoader.getZkController().registerConfListenerForCore(
+          zkSolrResourceLoader.getConfigSetZkPath(),
+          core,
+          getListener(core, zkSolrResourceLoader));
+
+  }
+
+  private static Runnable getListener(SolrCore core, ZkSolrResourceLoader zkSolrResourceLoader) {
+    final String coreName = core.getName();
+    final CoreContainer cc = core.getCoreDescriptor().getCoreContainer();
+    final String overlayPath = (zkSolrResourceLoader).getConfigSetZkPath() + "/" + ConfigOverlay.RESOURCE_NAME;
+    final String solrConfigPath = (zkSolrResourceLoader).getConfigSetZkPath() + "/" + core.getSolrConfig().getName();
+    return new Runnable() {
+          @Override
+          public void run() {
+            log.info("config update_listener called");
+            SolrZkClient zkClient = cc.getZkController().getZkClient();
+            int solrConfigversion,overlayVersion;
+            try (SolrCore core = cc.getCore(coreName))  {
+              if (core.isClosed()) return;
+               solrConfigversion = core.getSolrConfig().getOverlay().getZnodeVersion();
+               overlayVersion = core.getSolrConfig().getZnodeVersion();
+            }
+
+            if (checkStale(zkClient, overlayPath, solrConfigversion) ||
+                checkStale(zkClient, solrConfigPath, overlayVersion)) {
+              log.info("core reload");
+              cc.reload(coreName);
             }
-          } catch (KeeperException.NoNodeException nne){
-            //no problem
-          } catch (KeeperException e) {
-            log.error("error refreshing solrconfig ", e);
-          } catch (InterruptedException e) {
-            Thread.currentThread().isInterrupted();
           }
-        }
-      };
+        };
+  }
 
-      zkSolrResourceLoader.getZkController().registerConfListenerForCore(zkSolrResourceLoader.getConfigSetZkPath(), core,listener);
+  private static boolean checkStale(SolrZkClient zkClient,  String zkPath, int currentVersion)  {
+    try {
+      Stat stat = zkClient.exists(zkPath, null, true);
+      if(stat == null){
+        if(currentVersion>0) return true;
+        return false;
+      }
+      if (stat.getVersion() >  currentVersion) {
+        log.info(zkPath+" is stale will need an update from {} to {}", currentVersion,stat.getVersion());
+        return true;
+      }
+      return false;
+    } catch (KeeperException.NoNodeException nne){
+      //no problem
+    } catch (KeeperException e) {
+      log.error("error refreshing solrconfig ", e);
+    } catch (InterruptedException e) {
+      Thread.currentThread().isInterrupted();
     }
-
+    return false;
   }
 
 
@@ -136,8 +162,7 @@ public class SolrConfigHandler extends R
       String path = (String) req.getContext().get("path");
       if(path == null) path="/config";
       if("/config/overlay".equals(path)){
-        resp.add("overlay", req.getCore().getSolrConfig().getOverlay().toOutputFormat());
-        return;
+        resp.add("overlay", req.getCore().getSolrConfig().getOverlay().toMap());
       } else {
         List<String> parts =StrUtils.splitSmart(path, '/');
         if(parts.get(0).isEmpty()) parts.remove(0);
@@ -152,13 +177,32 @@ public class SolrConfigHandler extends R
 
 
     private void handlePOST() throws IOException {
-    Iterable<ContentStream> streams = req.getContentStreams();
-    if(streams == null ){
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
-    }
+      Iterable<ContentStream> streams = req.getContentStreams();
+      if (streams == null) {
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
+      }
+      ArrayList<CommandOperation> ops = new ArrayList<>();
+
+      for (ContentStream stream : streams)
+        ops.addAll(CommandOperation.parse(stream.getReader()));
+      List<Map> errList = CommandOperation.captureErrors(ops);
+      if(!errList.isEmpty()) {
+        resp.add(CommandOperation.ERR_MSGS,errList);
+        return;
+      }
+
       try {
-        for (ContentStream stream : streams) {
-          runCommandsTillSuccess(stream);
+        for (;;) {
+          ArrayList<CommandOperation> opsCopy = new ArrayList<>(ops.size());
+          ConfigOverlay overlay = SolrConfig.getConfigOverlay(req.getCore().getResourceLoader());
+          for (CommandOperation op : ops) opsCopy.add(op.getCopy());
+          try {
+            handleCommands(opsCopy, overlay);
+            break;
+          } catch (ZkController.ResourceModifiedInZkException e) {
+            //retry
+            log.info("Race condition, the node is modified in ZK by someone else " +e.getMessage());
+          }
         }
       } catch (Exception e) {
         resp.setException(e);
@@ -167,30 +211,21 @@ public class SolrConfigHandler extends R
 
     }
 
-    private void runCommandsTillSuccess(ContentStream stream) throws IOException {
-      for (;;) {
-        try {
-          handleCommands(stream);
-          break;
-        } catch (ZkController.ResourceModifiedInZkException e) {
-          log.info(e.getMessage());
-
-        }
-      }
-    }
-
-    private void handleCommands( ContentStream stream) throws IOException {
-    ConfigOverlay overlay = req.getCore().getSolrConfig().getOverlay();
-    List<CommandOperation> ops = CommandOperation.parse(stream.getReader());
+    private void handleCommands(List<CommandOperation> ops, ConfigOverlay overlay ) throws IOException {
     for (CommandOperation op : ops) {
-      if(SET_PROPERTY.equals( op.name) ){
-        overlay = applySetProp(op, overlay);
-      }else if(UNSET_PROPERTY.equals(op.name)){
-        overlay = applyUnset(op,overlay);
-      }else if(SET_USER_PROPERTY.equals(op.name)){
-        overlay = applySetUserProp(op ,overlay);
-      }else if(UNSET_USER_PROPERTY.equals(op.name)){
-        overlay = applyUnsetUserProp(op, overlay);
+      switch (op.name) {
+        case SET_PROPERTY:
+          overlay = applySetProp(op, overlay);
+          break;
+        case UNSET_PROPERTY:
+          overlay = applyUnset(op, overlay);
+          break;
+        case SET_USER_PROPERTY:
+          overlay = applySetUserProp(op, overlay);
+          break;
+        case UNSET_USER_PROPERTY:
+          overlay = applyUnsetUserProp(op, overlay);
+          break;
       }
     }
     List errs = CommandOperation.captureErrors(ops);
@@ -204,21 +239,6 @@ public class SolrConfigHandler extends R
       ZkController.persistConfigResourceToZooKeeper(loader,overlay.getZnodeVersion(),
           ConfigOverlay.RESOURCE_NAME,overlay.toByteArray(),true);
 
-      String collectionName = req.getCore().getCoreDescriptor().getCloudDescriptor().getCollectionName();
-      Map map = ZkNodeProps.makeMap(CoreAdminParams.ACTION, CollectionParams.CollectionAction.RELOAD.toString() ,
-          CollectionParams.NAME, collectionName);
-
-      SolrQueryRequest  solrQueryRequest = new LocalSolrQueryRequest(req.getCore(), new MapSolrParams(map));
-      SolrQueryResponse tmpResp = new SolrQueryResponse();
-      try {
-        //doing a collection reload
-        req.getCore().getCoreDescriptor().getCoreContainer().getCollectionsHandler().handleRequestBody(solrQueryRequest,tmpResp);
-      } catch (Exception e) {
-        String msg = MessageFormat.format("Unable to reload collection {0}", collectionName);
-        log.error(msg);
-        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
-      }
-
     } else {
       SolrResourceLoader.persistConfLocally(loader, ConfigOverlay.RESOURCE_NAME, overlay.toByteArray());
       req.getCore().getCoreDescriptor().getCoreContainer().reload(req.getCore().getName());
@@ -292,14 +312,6 @@ public class SolrConfigHandler extends R
     req.setParams(SolrParams.wrapDefaults(params, new MapSolrParams(map)));
   }
 
-
-  public static void addImplicits(List<PluginInfo> infoList){
-    Map m = makeMap("name", "/config", "class", SolrConfigHandler.class.getName());
-    infoList.add(new PluginInfo(SolrRequestHandler.TYPE, m, new NamedList<>(singletonMap(DEFAULTS, new NamedList())), null));
-  }
-
-
-
   @Override
   public SolrRequestHandler getSubHandler(String path) {
     if(subPaths.contains(path)) return this;

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java Thu Nov 27 20:41:01 2014
@@ -172,17 +172,6 @@ public class UpdateRequestHandler extend
     return "Add documents using XML (with XSLT), CSV, JSON, or javabin";
   }
 
-  public static void addImplicits(List<PluginInfo> implicits) {
-    implicits.add(getPluginInfo("/update",Collections.emptyMap()));
-    implicits.add(getPluginInfo(JSON_PATH, singletonMap("update.contentType", "application/json")));
-    implicits.add(getPluginInfo(CSV_PATH, singletonMap("update.contentType", "application/csv")));
-    implicits.add(getPluginInfo(DOC_PATH, makeMap("update.contentType", "application/json", "json.command","false")));
-  }
-
-  static PluginInfo getPluginInfo(String name, Map defaults){
-    Map m = makeMap("name", name, "class", UpdateRequestHandler.class.getName());
-    return new PluginInfo("requestHandler", m, new NamedList<>( singletonMap("defaults", new NamedList(defaults))) ,null);
-  }
   public static final String DOC_PATH = "/update/json/docs";
   public static final String JSON_PATH = "/update/json";
   public static final String CSV_PATH = "/update/csv";

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/AdminHandlers.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/AdminHandlers.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/AdminHandlers.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/AdminHandlers.java Thu Nov 27 20:41:01 2014
@@ -27,14 +27,18 @@ import org.apache.solr.request.SolrQuery
 import org.apache.solr.request.SolrRequestHandler;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.util.plugin.SolrCoreAware;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A special Handler that registers all standard admin handlers
  * 
  * @since solr 1.3
  */
+@Deprecated
 public class AdminHandlers implements SolrCoreAware, SolrRequestHandler
 {
+  public static Logger log = LoggerFactory.getLogger(AdminHandlers.class);
   NamedList initArgs = null;
   
   private static class StandardHandler {
@@ -100,6 +104,7 @@ public class AdminHandlers implements So
         }
       }
     }
+    log.warn("<requestHandler name=\"/admin/\" \n class=\"solr.admin.AdminHandlers\" /> is deprecated . It is not required anymore");
   }
 
   

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Thu Nov 27 20:41:01 2014
@@ -596,14 +596,8 @@ public class LukeRequestHandler extends 
 
     final CharsRefBuilder spare = new CharsRefBuilder();
 
-    Fields fields = MultiFields.getFields(req.getSearcher().getIndexReader());
-
-    if (fields == null) { // No indexed fields
-      return;
-    }
-
-    Terms terms = fields.terms(field);
-    if (terms == null) {  // No terms in the field.
+    Terms terms = MultiFields.getTerms(req.getSearcher().getIndexReader(), field);
+    if (terms == null) {  // field does not exist
       return;
     }
     TermsEnum termsEnum = terms.iterator(null);

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java Thu Nov 27 20:41:01 2014
@@ -95,6 +95,8 @@ public class SystemInfoHandler extends R
     if (solrCloudMode) {
       rsp.add("zkHost", getCoreContainer(req, core).getZkController().getZkServerAddress());
     }
+    if (cc != null)
+      rsp.add( "solr_home", cc.getSolrHome());
     rsp.add( "lucene", getLuceneInfo() );
     rsp.add( "jvm", getJvmInfo() );
     rsp.add( "system", getSystemInfo() );

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java Thu Nov 27 20:41:01 2014
@@ -124,9 +124,9 @@ public class TermsComponent extends Sear
       NamedList<Integer> fieldTerms = new NamedList<>();
       termsResult.add(field, fieldTerms);
 
-      Terms terms = lfields == null ? null : lfields.terms(field);
+      Terms terms = lfields.terms(field);
       if (terms == null) {
-        // no terms for this field
+        // field does not exist
         continue;
       }
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java Thu Nov 27 20:41:01 2014
@@ -59,6 +59,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 
@@ -76,6 +78,11 @@ public abstract class AbstractSpatialFie
    */
   public static final String FILTER_PARAM = "filter";
 
+  //score param values:
+  public static final String DISTANCE = "distance";
+  public static final String RECIP_DISTANCE = "recipDistance";
+  public static final String NONE = "none";
+
   protected final Logger log = LoggerFactory.getLogger( getClass() );
 
   protected SpatialContext ctx;
@@ -83,6 +90,21 @@ public abstract class AbstractSpatialFie
 
   private final Cache<String, T> fieldStrategyCache = CacheBuilder.newBuilder().build();
 
+  protected final Set<String> supportedScoreModes;
+
+  protected AbstractSpatialFieldType() {
+    this(Collections.emptySet());
+  }
+
+  protected AbstractSpatialFieldType(Set<String> moreScoreModes) {
+    Set<String> set = new TreeSet<>();//sorted for consistent display order
+    set.add(NONE);
+    set.add(DISTANCE);
+    set.add(RECIP_DISTANCE);
+    set.addAll(moreScoreModes);
+    supportedScoreModes = Collections.unmodifiableSet(set);
+  }
+
   @Override
   protected void init(IndexSchema schema, Map<String, String> args) {
     super.init(schema, args);
@@ -290,16 +312,27 @@ public abstract class AbstractSpatialFie
     return new FilteredQuery(functionQuery, filter);
   }
 
+  /** The set of values supported for the score local-param. Not null. */
+  public Set<String> getSupportedScoreModes() {
+    return supportedScoreModes;
+  }
+
   protected ValueSource getValueSourceFromSpatialArgs(QParser parser, SchemaField field, SpatialArgs spatialArgs, String score, T strategy) {
-    if (score == null || "none".equals(score) || "".equals(score)) {
+    if (score == null) {
       return null;
-    } else if ("distance".equals(score)) {
-      double multiplier = 1.0;//TODO support units=kilometers
-      return strategy.makeDistanceValueSource(spatialArgs.getShape().getCenter(), multiplier);
-    } else if ("recipDistance".equals(score)) {
-      return strategy.makeRecipDistanceValueSource(spatialArgs.getShape());
-    } else {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'score' local-param must be one of 'none', 'distance', or 'recipDistance'");
+    }
+    switch (score) {
+      case NONE:
+      case "":
+        return null;
+      case DISTANCE:
+        double multiplier = 1.0;//TODO support units=kilometers
+        return strategy.makeDistanceValueSource(spatialArgs.getShape().getCenter(), multiplier);
+      case RECIP_DISTANCE:
+        return strategy.makeRecipDistanceValueSource(spatialArgs.getShape());
+      default:
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+            "'score' local-param must be one of " + supportedScoreModes);
     }
   }
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/BBoxField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/BBoxField.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/BBoxField.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/schema/BBoxField.java Thu Nov 27 20:41:01 2014
@@ -28,17 +28,29 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.search.QParser;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
 public class BBoxField extends AbstractSpatialFieldType<BBoxStrategy> implements SchemaAware {
   private static final String PARAM_QUERY_TARGET_PROPORTION = "queryTargetProportion";
   private static final String PARAM_MIN_SIDE_LENGTH = "minSideLength";
-  private String numberFieldName;//required
-  private String booleanFieldName = "boolean";
+
+  //score modes:
+  private static final String OVERLAP_RATIO = "overlapRatio";
+  private static final String AREA = "area";
+  private static final String AREA2D = "area2D";
+
+  private String numberTypeName;//required
+  private String booleanTypeName = "boolean";
 
   private IndexSchema schema;
 
+  public BBoxField() {
+    super(new HashSet<>(Arrays.asList(OVERLAP_RATIO, AREA, AREA2D)));
+  }
+
   @Override
   protected void init(IndexSchema schema, Map<String, String> args) {
     super.init(schema, args);
@@ -48,25 +60,25 @@ public class BBoxField extends AbstractS
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "The field type: " + typeName
           + " must specify the numberType attribute.");
     }
-    numberFieldName = v;
+    numberTypeName = v;
 
     v = args.remove("booleanType");
     if (v != null) {
-      booleanFieldName = v;
+      booleanTypeName = v;
     }
   }
 
   @Override
   public void inform(IndexSchema schema) {
     this.schema = schema;
-    FieldType numberType = schema.getFieldTypeByName(numberFieldName);
-    FieldType booleanType = schema.getFieldTypeByName(booleanFieldName);
+    FieldType numberType = schema.getFieldTypeByName(numberTypeName);
+    FieldType booleanType = schema.getFieldTypeByName(booleanTypeName);
 
     if (numberType == null) {
-      throw new RuntimeException("Cannot find number fieldType: " + numberFieldName);
+      throw new RuntimeException("Cannot find number fieldType: " + numberTypeName);
     }
     if (booleanType == null) {
-      throw new RuntimeException("Cannot find boolean fieldType: " + booleanFieldName);
+      throw new RuntimeException("Cannot find boolean fieldType: " + booleanTypeName);
     }
     if (!(booleanType instanceof BoolField)) {
       throw new RuntimeException("Must be a BoolField: " + booleanType);
@@ -75,33 +87,47 @@ public class BBoxField extends AbstractS
       throw new RuntimeException("Must be TrieDoubleField: " + numberType);
     }
 
+    //note: this only works for explicit fields, not dynamic fields
     List<SchemaField> fields = new ArrayList<>(schema.getFields().values());//copy, because we modify during iteration
     for (SchemaField sf : fields) {
       if (sf.getType() == this) {
         String name = sf.getName();
-        register(schema, name + BBoxStrategy.SUFFIX_MINX, numberType);
-        register(schema, name + BBoxStrategy.SUFFIX_MAXX, numberType);
-        register(schema, name + BBoxStrategy.SUFFIX_MINY, numberType);
-        register(schema, name + BBoxStrategy.SUFFIX_MAXY, numberType);
-        register(schema, name + BBoxStrategy.SUFFIX_XDL, booleanType);
+        registerSubFields(schema, name, numberType, booleanType);
       }
     }
   }
 
+  private void registerSubFields(IndexSchema schema, String name, FieldType numberType, FieldType booleanType) {
+    register(schema, name + BBoxStrategy.SUFFIX_MINX, numberType);
+    register(schema, name + BBoxStrategy.SUFFIX_MAXX, numberType);
+    register(schema, name + BBoxStrategy.SUFFIX_MINY, numberType);
+    register(schema, name + BBoxStrategy.SUFFIX_MAXY, numberType);
+    register(schema, name + BBoxStrategy.SUFFIX_XDL, booleanType);
+  }
+
+  // note: Registering the field is probably optional; it makes it show up in the schema browser and may have other
+  //  benefits.
   private void register(IndexSchema schema, String name, FieldType fieldType) {
     SchemaField sf = new SchemaField(name, fieldType);
     schema.getFields().put(sf.getName(), sf);
   }
 
   @Override
-  protected BBoxStrategy newSpatialStrategy(String s) {
-    BBoxStrategy strategy = new BBoxStrategy(ctx, s);
+  protected BBoxStrategy newSpatialStrategy(String fieldName) {
+    //if it's a dynamic field, we register the sub-fields now.
+    FieldType numberType = schema.getFieldTypeByName(numberTypeName);
+    FieldType booleanType = schema.getFieldTypeByName(booleanTypeName);
+    if (schema.isDynamicField(fieldName)) {
+      registerSubFields(schema, fieldName, numberType, booleanType);
+    }
+
+    BBoxStrategy strategy = new BBoxStrategy(ctx, fieldName);
     //Solr's FieldType ought to expose Lucene FieldType. Instead as a hack we create a Field with a dummy value.
-    SchemaField field = schema.getField(strategy.getFieldName() + BBoxStrategy.SUFFIX_MINX);
+    final SchemaField solrNumField = new SchemaField("_", numberType);//dummy temp
     org.apache.lucene.document.FieldType luceneType =
-        (org.apache.lucene.document.FieldType) field.createField(0.0, 1.0f).fieldType();
-    //and annoyingly this field isn't going to have a docValues format because Solr uses a separate Field for that
-    if (field.hasDocValues()) {
+        (org.apache.lucene.document.FieldType) solrNumField.createField(0.0, 1.0f).fieldType();
+    //and annoyingly this Field isn't going to have a docValues format because Solr uses a separate Field for that
+    if (solrNumField.hasDocValues()) {
       luceneType = new org.apache.lucene.document.FieldType(luceneType);
       luceneType.setDocValuesType(DocValuesType.NUMERIC);
     }
@@ -111,9 +137,12 @@ public class BBoxField extends AbstractS
 
   @Override
   protected ValueSource getValueSourceFromSpatialArgs(QParser parser, SchemaField field, SpatialArgs spatialArgs, String scoreParam, BBoxStrategy strategy) {
+    if (scoreParam == null) {
+      return null;
+    }
     switch (scoreParam) {
       //TODO move these to superclass after LUCENE-5804 ?
-      case "overlapRatio":
+      case OVERLAP_RATIO:
         double queryTargetProportion = 0.25;//Suggested default; weights towards target area
 
         String v = parser.getParam(PARAM_QUERY_TARGET_PROPORTION);
@@ -130,10 +159,10 @@ public class BBoxField extends AbstractS
             (Rectangle) spatialArgs.getShape(),
             queryTargetProportion, minSideLength);
 
-      case "area":
+      case AREA:
         return new ShapeAreaValueSource(strategy.makeShapeValueSource(), ctx, ctx.isGeo());
 
-      case "area2D":
+      case AREA2D:
         return new ShapeAreaValueSource(strategy.makeShapeValueSource(), ctx, false);
 
       default:

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1642229&r1=1642228&r2=1642229&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Thu Nov 27 20:41:01 2014
@@ -780,9 +780,7 @@ public class SolrIndexSearcher extends I
    * @return the first document number containing the term
    */
   public int getFirstMatch(Term t) throws IOException {
-    Fields fields = leafReader.fields();
-    if (fields == null) return -1;
-    Terms terms = fields.terms(t.field());
+    Terms terms = leafReader.terms(t.field());
     if (terms == null) return -1;
     BytesRef termBytes = t.bytes();
     final TermsEnum termsEnum = terms.iterator(null);