From 89bd0566f988e586cb99cf1ed2760a6778e6ed6e Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Wed, 22 Nov 2017 16:29:53 +0100 Subject: [PATCH 1/3] SOLR-11161: bin/solr stop_solr function ignored $STOP_PORT used at startup. --- solr/CHANGES.txt | 2 ++ solr/bin/solr | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 2e3ff42df11..28fdaa7532b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -143,6 +143,8 @@ Bug Fixes admin UI dashboard would not display any commandline arguments. (Webster Homer via Shawn Heisey) +* SOLR-11161: bin/solr stop_solr function ignored $STOP_PORT used at startup. (Christine Poerschke) + Optimizations ---------------------- * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr diff --git a/solr/bin/solr b/solr/bin/solr index dd8d6efa21b..0a5786637f8 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -648,22 +648,40 @@ function solr_pid_by_port() { echo "$solrPID" } -# extract the value of the -Djetty.port parameter from a running Solr process -function jetty_port() { +# extract the value of a command line parameter from a running Solr process +# arg1 - pid of a running Solr process +# arg2 - parameter to extract e.g. abc.xyz to extract the -Dabc.xyz parameter +function java_system_property_by_pid() { SOLR_PID="$1" - SOLR_PROC=`ps auxww | grep -w $SOLR_PID | grep start\.jar | grep jetty\.port` + SOLR_ARG="$2" + SOLR_PROC=`ps auxww | grep -w $SOLR_PID | grep start\.jar | grep $SOLR_ARG` IFS=' ' read -a proc_args <<< "$SOLR_PROC" for arg in "${proc_args[@]}" do IFS='=' read -a pair <<< "$arg" - if [ "${pair[0]}" == "-Djetty.port" ]; then - local jetty_port="${pair[1]}" + if [ "${pair[0]}" == "-D$SOLR_ARG" ]; then + local arg_val="${pair[1]}" break fi done - echo "$jetty_port" + echo "$arg_val" +} # end java_system_property_by_pid func + +# extract the value of the -Djetty.port parameter from a running Solr process +function jetty_port() { + java_system_property_by_pid "$1" "jetty.port" } # end jetty_port func +# extract the value of the -DSTOP.PORT parameter from a running Solr process +function stop_port_by_pid() { + java_system_property_by_pid "$1" "STOP.PORT" +} # end stop_port_by_pid func + +# extract the value of the -DSTOP.KEY parameter from a running Solr process +function stop_key_by_pid() { + java_system_property_by_pid "$1" "STOP.KEY" +} # end stop_key_by_pid func + # run a Solr command-line tool using the SolrCLI class; # useful for doing cross-platform work from the command-line using Java function run_tool() { @@ -729,11 +747,13 @@ function stop_solr() { DIR="$1" SOLR_PORT="$2" - STOP_PORT=`expr $SOLR_PORT - 1000` - STOP_KEY="$3" - SOLR_PID="$4" + SOLR_PID="$3" if [ "$SOLR_PID" != "" ]; then + + STOP_PORT=`stop_port_by_pid $SOLR_PID` + STOP_KEY=`stop_key_by_pid $SOLR_PID` + echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully." "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -jar "$DIR/start.jar" "STOP.PORT=$STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true (loops=0 @@ -1633,7 +1653,7 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then NEXT_PID=`cat "$PIDF"` port=`jetty_port "$NEXT_PID"` if [ "$port" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$NEXT_PID" + stop_solr "$SOLR_SERVER_DIR" "$port" "$NEXT_PID" none_stopped=false fi rm -f "$PIDF" @@ -1654,7 +1674,7 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then if [ "$CHECK_PID" != "" ]; then port=`jetty_port "$CHECK_PID"` if [ "$port" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$CHECK_PID" + stop_solr "$SOLR_SERVER_DIR" "$port" "$CHECK_PID" none_stopped=false fi fi @@ -1710,7 +1730,7 @@ else SOLR_PID=`ps auxww | grep start\.jar | grep -w "\-Djetty\.port=$SOLR_PORT" | grep -v grep | awk '{print $2}' | sort -r` fi if [ "$SOLR_PID" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID" + stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$SOLR_PID" else if [ "$SCRIPT_CMD" == "stop" ]; then echo -e "No process found for Solr node running on port $SOLR_PORT" From 5a2ed01e75d7185c0dfaa32a82b58edc8e7b280f Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Wed, 22 Nov 2017 17:25:24 +0000 Subject: [PATCH 2/3] Revert "SOLR-11161: bin/solr stop_solr function ignored $STOP_PORT used at startup." This reverts commit 89bd0566f988e586cb99cf1ed2760a6778e6ed6e. --- solr/CHANGES.txt | 2 -- solr/bin/solr | 44 ++++++++++++-------------------------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 28fdaa7532b..2e3ff42df11 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -143,8 +143,6 @@ Bug Fixes admin UI dashboard would not display any commandline arguments. (Webster Homer via Shawn Heisey) -* SOLR-11161: bin/solr stop_solr function ignored $STOP_PORT used at startup. (Christine Poerschke) - Optimizations ---------------------- * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr diff --git a/solr/bin/solr b/solr/bin/solr index 0a5786637f8..dd8d6efa21b 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -648,40 +648,22 @@ function solr_pid_by_port() { echo "$solrPID" } -# extract the value of a command line parameter from a running Solr process -# arg1 - pid of a running Solr process -# arg2 - parameter to extract e.g. abc.xyz to extract the -Dabc.xyz parameter -function java_system_property_by_pid() { +# extract the value of the -Djetty.port parameter from a running Solr process +function jetty_port() { SOLR_PID="$1" - SOLR_ARG="$2" - SOLR_PROC=`ps auxww | grep -w $SOLR_PID | grep start\.jar | grep $SOLR_ARG` + SOLR_PROC=`ps auxww | grep -w $SOLR_PID | grep start\.jar | grep jetty\.port` IFS=' ' read -a proc_args <<< "$SOLR_PROC" for arg in "${proc_args[@]}" do IFS='=' read -a pair <<< "$arg" - if [ "${pair[0]}" == "-D$SOLR_ARG" ]; then - local arg_val="${pair[1]}" + if [ "${pair[0]}" == "-Djetty.port" ]; then + local jetty_port="${pair[1]}" break fi done - echo "$arg_val" -} # end java_system_property_by_pid func - -# extract the value of the -Djetty.port parameter from a running Solr process -function jetty_port() { - java_system_property_by_pid "$1" "jetty.port" + echo "$jetty_port" } # end jetty_port func -# extract the value of the -DSTOP.PORT parameter from a running Solr process -function stop_port_by_pid() { - java_system_property_by_pid "$1" "STOP.PORT" -} # end stop_port_by_pid func - -# extract the value of the -DSTOP.KEY parameter from a running Solr process -function stop_key_by_pid() { - java_system_property_by_pid "$1" "STOP.KEY" -} # end stop_key_by_pid func - # run a Solr command-line tool using the SolrCLI class; # useful for doing cross-platform work from the command-line using Java function run_tool() { @@ -747,13 +729,11 @@ function stop_solr() { DIR="$1" SOLR_PORT="$2" - SOLR_PID="$3" + STOP_PORT=`expr $SOLR_PORT - 1000` + STOP_KEY="$3" + SOLR_PID="$4" if [ "$SOLR_PID" != "" ]; then - - STOP_PORT=`stop_port_by_pid $SOLR_PID` - STOP_KEY=`stop_key_by_pid $SOLR_PID` - echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully." "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -jar "$DIR/start.jar" "STOP.PORT=$STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true (loops=0 @@ -1653,7 +1633,7 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then NEXT_PID=`cat "$PIDF"` port=`jetty_port "$NEXT_PID"` if [ "$port" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$port" "$NEXT_PID" + stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$NEXT_PID" none_stopped=false fi rm -f "$PIDF" @@ -1674,7 +1654,7 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then if [ "$CHECK_PID" != "" ]; then port=`jetty_port "$CHECK_PID"` if [ "$port" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$port" "$CHECK_PID" + stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$CHECK_PID" none_stopped=false fi fi @@ -1730,7 +1710,7 @@ else SOLR_PID=`ps auxww | grep start\.jar | grep -w "\-Djetty\.port=$SOLR_PORT" | grep -v grep | awk '{print $2}' | sort -r` fi if [ "$SOLR_PID" != "" ]; then - stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$SOLR_PID" + stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID" else if [ "$SCRIPT_CMD" == "stop" ]; then echo -e "No process found for Solr node running on port $SOLR_PORT" From 3f0b240853dac1e9fad3b29042d9aaf6e9f0e634 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 22 Nov 2017 18:29:47 +0100 Subject: [PATCH 3/3] LUCENE-7736: CoveringQuery needs to rewrite its ValuesSource. --- .../src/java/org/apache/lucene/search/CoveringQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lucene/sandbox/src/java/org/apache/lucene/search/CoveringQuery.java b/lucene/sandbox/src/java/org/apache/lucene/search/CoveringQuery.java index 2890eddb9bf..807e1c95410 100644 --- a/lucene/sandbox/src/java/org/apache/lucene/search/CoveringQuery.java +++ b/lucene/sandbox/src/java/org/apache/lucene/search/CoveringQuery.java @@ -115,7 +115,7 @@ public final class CoveringQuery extends Query { for (Query query : queries) { weights.add(searcher.createWeight(query, needsScores, boost)); } - return new CoveringWeight(this, weights, minimumNumberMatch); + return new CoveringWeight(this, weights, minimumNumberMatch.rewrite(searcher)); } private static class CoveringWeight extends Weight {