You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2021/02/03 00:51:35 UTC
[lucene-solr] branch reference_impl_dev updated: @1309 Fix up fg
start, docker module tests.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl_dev by this push:
new c25588a @1309 Fix up fg start, docker module tests.
c25588a is described below
commit c25588a610ee581d99fc9fa305906ab50cc4bd63
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Feb 2 18:50:33 2021 -0600
@1309 Fix up fg start, docker module tests.
---
solr/bin/jetty.sh | 2 +-
solr/bin/solr | 4 +-
.../apache/solr/servlet/SolrDispatchFilter.java | 2 +-
.../java/org/apache/solr/util/SimplePostTool.java | 52 +++++-----------------
solr/docker/tests/shared.sh | 5 ++-
5 files changed, 18 insertions(+), 47 deletions(-)
diff --git a/solr/bin/jetty.sh b/solr/bin/jetty.sh
index 677d5e4..edcb03a 100644
--- a/solr/bin/jetty.sh
+++ b/solr/bin/jetty.sh
@@ -326,7 +326,7 @@ CYGWIN*) JETTY_STATE="`cygpath -w $JETTY_STATE`";;
esac
-JETTY_ARGS=(${JETTY_ARGS[*]} "jetty.state=$JETTY_STATE")
+JETTY_ARGS=(${JETTY_ARGS[*]} "-Djetty.state=$JETTY_STATE")
##################################################
# Get the list of config.xml files from jetty.conf
diff --git a/solr/bin/solr b/solr/bin/solr
index f925570..0439f4b 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -2214,7 +2214,7 @@ function start_solr() {
fi
if [ "$run_in_foreground" == "true" ]; then
- exec "$JAVA" -Djetty.state="${SOLR_HOME}"/jetty.state "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -XX:-UseBiasedLocking -Dsolr.log.muteconsole -jar start.jar "${SOLR_JETTY_CONFIG[@]}" $SOLR_JETTY_ADDL_CONFIG
+ exec "$JAVA" -Djetty.state=${SOLR_PID_DIR}/jetty.state -Dsolr.log.muteconsole "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -XX:-UseBiasedLocking -jar start.jar "${SOLR_JETTY_CONFIG[@]}" $SOLR_JETTY_ADDL_CONFIG
else
# run Solr in the background
export JAVA=$JAVA
@@ -2222,7 +2222,7 @@ function start_solr() {
export JETTY_PID="$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
export JETTY_ARGS="${SOLR_JETTY_CONFIG[@]} $SOLR_JETTY_ADDL_CONFIG"
export JAVA_OPTIONS="${SOLR_START_OPTS[@]} $SOLR_ADDL_ARGS -XX:-UseBiasedLocking -Dsolr.log.muteconsole"
- export JETTY_STATE="${SOLR_HOME}/jetty.state"
+ export JETTY_STATE="${SOLR_PID_DIR}/jetty.state"
bash $SOLR_SERVER_DIR/../bin/jetty.sh start
fi
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index b1c54e5..dc57a1c 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -194,7 +194,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
logWelcomeBanner();
String muteConsole = System.getProperty(SOLR_LOG_MUTECONSOLE);
- if (muteConsole != null && !Arrays.asList("false", "0", "off", "no").contains(muteConsole.toLowerCase(Locale.ROOT))) {
+ if (muteConsole != null && (!muteConsole.equalsIgnoreCase("false")) && !Arrays.asList("false", "0", "off", "no").contains(muteConsole.toLowerCase(Locale.ROOT))) {
StartupLoggingUtils.muteConsole();
}
String logLevel = System.getProperty(SOLR_LOG_LEVEL);
diff --git a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
index c145b1d..54ec6b2 100644
--- a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
+++ b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
@@ -16,13 +16,13 @@
*/
package org.apache.solr.util;
-import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -62,9 +62,6 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
-import net.sf.saxon.Configuration;
-import net.sf.saxon.xpath.XPathFactoryImpl;
-import org.apache.solr.common.ParWork;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -102,16 +99,6 @@ public class SimplePostTool {
static final String DATA_MODE_WEB = "web";
static final String DEFAULT_DATA_MODE = DATA_MODE_FILES;
- private static DocumentBuilder DOC_BUILDER;
-
- static {
- try {
- DOC_BUILDER = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- }
- }
-
// Input args
boolean auto = false;
int recursive = 0;
@@ -187,11 +174,6 @@ public class SimplePostTool {
}
}
- Configuration conf = Configuration.newConfiguration();
-
- public final XPathFactoryImpl xpathFactory;
-
-
/**
* After initialization, call execute to start the post job.
* This method delegates to the correct mode method.
@@ -327,18 +309,9 @@ public class SimplePostTool {
this.optimize = optimize;
this.args = args;
pageFetcher = new PageFetcher();
- conf.setValidation(false);
- conf.setXIncludeAware(true);
- conf.setExpandAttributeDefaults(true);
- xpathFactory = new XPathFactoryImpl(conf);
}
- public SimplePostTool() {
- conf.setValidation(false);
- conf.setXIncludeAware(true);
- conf.setExpandAttributeDefaults(true);
- xpathFactory = new XPathFactoryImpl(conf);
- }
+ public SimplePostTool() {}
//
// Do some action depending on which mode we have
@@ -554,7 +527,6 @@ public class SimplePostTool {
Thread.sleep(delay * 1000);
filesPosted++;
} catch (InterruptedException e) {
- Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
@@ -669,7 +641,6 @@ public class SimplePostTool {
} catch (IOException e) {
warn("Caught exception when trying to open connection to "+u+": "+e.getMessage());
} catch (InterruptedException e) {
- Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
@@ -916,7 +887,6 @@ public class SimplePostTool {
} catch (IOException e) {
warn("An error occurred getting data from "+url+". Please check that Solr is running.");
} catch (Exception e) {
- ParWork.propagateInterrupt(e);
warn("An error occurred getting data from "+url+". Message: " + e.getMessage());
}
}
@@ -956,7 +926,6 @@ public class SimplePostTool {
fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e);
success = false;
} catch (Exception e) {
- ParWork.propagateInterrupt(e);
fatal("POST failed with error " + e.getMessage());
}
@@ -1070,7 +1039,9 @@ public class SimplePostTool {
/**
* Gets all nodes matching an XPath
*/
- public static NodeList getNodesFromXP(XPath xp, Node n, String xpath) throws XPathExpressionException {
+ public static NodeList getNodesFromXP(Node n, String xpath) throws XPathExpressionException {
+ XPathFactory factory = XPathFactory.newInstance();
+ XPath xp = factory.newXPath();
XPathExpression expr = xp.compile(xpath);
return (NodeList) expr.evaluate(n, XPathConstants.NODESET);
}
@@ -1081,9 +1052,9 @@ public class SimplePostTool {
* @param xpath the xpath string
* @param concatAll if true, text from all matching nodes will be concatenated, else only the first returned
*/
- public static String getXP(XPath xp, Node n, String xpath, boolean concatAll)
+ public static String getXP(Node n, String xpath, boolean concatAll)
throws XPathExpressionException {
- NodeList nodes = getNodesFromXP(xp, n, xpath);
+ NodeList nodes = getNodesFromXP(n, xpath);
StringBuilder sb = new StringBuilder();
if (nodes.getLength() > 0) {
for(int i = 0; i < nodes.getLength() ; i++) {
@@ -1101,7 +1072,8 @@ public class SimplePostTool {
public static Document makeDom(byte[] in) throws SAXException, IOException,
ParserConfigurationException {
InputStream is = new ByteArrayInputStream(in);
- Document dom = DOC_BUILDER.parse(is);
+ Document dom = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder().parse(is);
return dom;
}
@@ -1273,10 +1245,9 @@ public class SimplePostTool {
boolean success = postData(is, null, os, type, extractUrl);
if(success) {
Document d = makeDom(os.toByteArray());
- XPath xpath = xpathFactory.newXPath();
- String innerXml = getXP(xpath, d, "/response/str/text()[1]", false);
+ String innerXml = getXP(d, "/response/str/text()[1]", false);
d = makeDom(innerXml.getBytes(StandardCharsets.UTF_8));
- NodeList links = getNodesFromXP(xpath, d, "/html/body//a/@href");
+ NodeList links = getNodesFromXP(d, "/html/body//a/@href");
for(int i = 0; i < links.getLength(); i++) {
String link = links.item(i).getTextContent();
link = computeFullUrl(u, link);
@@ -1293,7 +1264,6 @@ public class SimplePostTool {
} catch (IOException e) {
warn("IOException opening URL "+url+": "+e.getMessage());
} catch (Exception e) {
- ParWork.propagateInterrupt(e);
throw new RuntimeException(e);
}
return l;
diff --git a/solr/docker/tests/shared.sh b/solr/docker/tests/shared.sh
index 0537db7..e034387 100755
--- a/solr/docker/tests/shared.sh
+++ b/solr/docker/tests/shared.sh
@@ -53,8 +53,9 @@ function wait_for_server_started {
local log
log="${BUILD_DIR}/${container_name}.log"
while true; do
- docker logs "$container_name" > "${log}" 2>&1
- if grep -E -q '(o\.e\.j\.s\.Server Started|Started SocketConnector)' "${log}" ; then
+ set -x
+ docker cp "${container_name}":/var/solr/logs/solr.log "${log}" || echo "log not found"
+ if grep -E -q '(o\.e\.j\.s\.Server Started|Started SocketConnector|SolrDispatchFilter\.init\(\) end)' "${log}" ; then
break
fi