mirror of https://github.com/apache/lucene.git
SOLR-13566: REINDEXCOLLECTION does not work with (basic) authentication.
This commit is contained in:
parent
94ecd3a7f6
commit
4d1058db6e
|
@ -228,6 +228,8 @@ Bug Fixes
|
||||||
weren't using nested docs. In-place updates were not affected (worked).
|
weren't using nested docs. In-place updates were not affected (worked).
|
||||||
Reminder: if you don't need nested docs then remove both _root_ and _nest_path_ ! (David Smiley)
|
Reminder: if you don't need nested docs then remove both _root_ and _nest_path_ ! (David Smiley)
|
||||||
|
|
||||||
|
* SOLR-13566: REINDEXCOLLECTION does not work with (basic) authentication. (Colvin Cowie, ab)
|
||||||
|
|
||||||
================== 8.1.1 ==================
|
================== 8.1.1 ==================
|
||||||
|
|
||||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||||
|
|
|
@ -296,15 +296,22 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
|
||||||
assertAuthMetricsMinimums(23, 11, 9, 1, 2, 0);
|
assertAuthMetricsMinimums(23, 11, 9, 1, 2, 0);
|
||||||
assertPkiAuthMetricsMinimums(14, 14, 0, 0, 0, 0);
|
assertPkiAuthMetricsMinimums(14, 14, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
// Reindex collection depends on streaming request that needs to authenticate against new collection
|
||||||
|
CollectionAdminRequest.ReindexCollection reindexReq = CollectionAdminRequest.reindexCollection(COLLECTION);
|
||||||
|
reindexReq.setBasicAuthCredentials("harry", "HarryIsUberCool");
|
||||||
|
cluster.getSolrClient().request(reindexReq, COLLECTION);
|
||||||
|
assertAuthMetricsMinimums(24, 12, 9, 1, 2, 0);
|
||||||
|
assertPkiAuthMetricsMinimums(15, 15, 0, 0, 0, 0);
|
||||||
|
|
||||||
// Validate forwardCredentials
|
// Validate forwardCredentials
|
||||||
assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
|
assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
|
||||||
assertAuthMetricsMinimums(24, 12, 9, 1, 2, 0);
|
assertAuthMetricsMinimums(25, 13, 9, 1, 2, 0);
|
||||||
assertPkiAuthMetricsMinimums(18, 18, 0, 0, 0, 0);
|
assertPkiAuthMetricsMinimums(19, 19, 0, 0, 0, 0);
|
||||||
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { forwardCredentials: true}}", "harry", "HarryIsUberCool");
|
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { forwardCredentials: true}}", "harry", "HarryIsUberCool");
|
||||||
verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/forwardCredentials", "true", 20, "harry", "HarryIsUberCool");
|
verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/forwardCredentials", "true", 20, "harry", "HarryIsUberCool");
|
||||||
assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
|
assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
|
||||||
assertAuthMetricsMinimums(31, 19, 9, 1, 2, 0);
|
assertAuthMetricsMinimums(32, 20, 9, 1, 2, 0);
|
||||||
assertPkiAuthMetricsMinimums(18, 18, 0, 0, 0, 0);
|
assertPkiAuthMetricsMinimums(19, 19, 0, 0, 0, 0);
|
||||||
|
|
||||||
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
|
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -514,7 +514,7 @@ The `/stream` handler supports a small set commands for listing and controlling
|
||||||
http://localhost:8983/collection/stream?action=list
|
http://localhost:8983/collection/stream?action=list
|
||||||
----
|
----
|
||||||
|
|
||||||
This command will provide a listing of the current daemon's running on the specific node along with there current state.
|
This command will provide a listing of the current daemons running on the specific node along with their current state.
|
||||||
|
|
||||||
[source,text]
|
[source,text]
|
||||||
----
|
----
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.solr.client.solrj.io.stream;
|
package org.apache.solr.client.solrj.io.stream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.Thread.State;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -25,12 +26,15 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.solr.client.solrj.io.Tuple;
|
import org.apache.solr.client.solrj.io.Tuple;
|
||||||
import org.apache.solr.client.solrj.io.comp.StreamComparator;
|
import org.apache.solr.client.solrj.io.comp.StreamComparator;
|
||||||
import org.apache.solr.client.solrj.io.stream.expr.Explanation;
|
import org.apache.solr.client.solrj.io.stream.expr.Explanation;
|
||||||
import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
|
import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
|
||||||
|
import org.apache.solr.common.util.ExecutorUtil;
|
||||||
|
import org.apache.solr.common.util.SolrjNamedThreadFactory;
|
||||||
import org.apache.solr.client.solrj.io.stream.expr.Expressible;
|
import org.apache.solr.client.solrj.io.stream.expr.Expressible;
|
||||||
import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
|
import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
|
||||||
import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
|
import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
|
||||||
|
@ -202,7 +206,13 @@ public class DaemonStream extends TupleStream implements Expressible {
|
||||||
}
|
}
|
||||||
this.closed = false;
|
this.closed = false;
|
||||||
this.streamRunner = new StreamRunner(runInterval, id);
|
this.streamRunner = new StreamRunner(runInterval, id);
|
||||||
this.streamRunner.start();
|
ExecutorService service = ExecutorUtil.newMDCAwareSingleThreadExecutor(new SolrjNamedThreadFactory("DaemonStream-" + id));
|
||||||
|
try {
|
||||||
|
service.submit(this.streamRunner);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
service.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tuple read() throws IOException {
|
public Tuple read() throws IOException {
|
||||||
|
@ -267,13 +277,15 @@ public class DaemonStream extends TupleStream implements Expressible {
|
||||||
this.stopTime = stopTime;
|
this.stopTime = stopTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StreamRunner extends Thread {
|
private class StreamRunner implements Runnable {
|
||||||
|
|
||||||
private long sleepMillis = 1000;
|
private long sleepMillis = 1000;
|
||||||
private long runInterval;
|
private long runInterval;
|
||||||
private long lastRun;
|
private long lastRun;
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
// a reference to the Thread that is executing the stream to track its state
|
||||||
|
private volatile Thread executingThread;
|
||||||
private boolean shutdown;
|
private boolean shutdown;
|
||||||
|
|
||||||
public StreamRunner(long runInterval, String id) {
|
public StreamRunner(long runInterval, String id) {
|
||||||
|
@ -289,7 +301,29 @@ public class DaemonStream extends TupleStream implements Expressible {
|
||||||
return shutdown;
|
return shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public State getState() {
|
||||||
|
if (executingThread == null) {
|
||||||
|
if (shutdown) {
|
||||||
|
return Thread.State.TERMINATED;
|
||||||
|
} else {
|
||||||
|
return Thread.State.NEW;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return executingThread.getState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
executingThread = Thread.currentThread();
|
||||||
|
try {
|
||||||
|
stream();
|
||||||
|
} finally {
|
||||||
|
setShutdown(true);
|
||||||
|
executingThread = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stream() {
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
setStartTime(new Date().getTime());
|
setStartTime(new Date().getTime());
|
||||||
OUTER:
|
OUTER:
|
||||||
|
|
Loading…
Reference in New Issue