SOLR-8633: DistributedUpdateProcess processCommit/deleteByQuery call finish on DUP and SolrCmdDistributor, which violates the lifecycle and can cause bugs.

This commit is contained in:
markrmiller 2016-02-19 14:59:46 -05:00
parent e30d638c51
commit 8cd53a076b
3 changed files with 17 additions and 4 deletions

View File

@ -188,6 +188,9 @@ Bug Fixes
* SOLR-8695: Ensure ZK watchers are not triggering our watch logic on connection events and * SOLR-8695: Ensure ZK watchers are not triggering our watch logic on connection events and
make this handling more consistent. (Scott Blum via Mark Miller) make this handling more consistent. (Scott Blum via Mark Miller)
* SOLR-8633: DistributedUpdateProcess processCommit/deleteByQuery call finish on DUP and
SolrCmdDistributor, which violates the lifecycle and can cause bugs. (hossman via Mark Miller)
Optimizations Optimizations
---------------------- ----------------------
* SOLR-7876: Speed up queries and operations that use many terms when timeAllowed has not been * SOLR-7876: Speed up queries and operations that use many terms when timeAllowed has not been

View File

@ -55,7 +55,8 @@ public class SolrCmdDistributor {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private StreamingSolrClients clients; private StreamingSolrClients clients;
private boolean finished = false; // see finish()
private int retryPause = 500; private int retryPause = 500;
private int maxRetriesOnForward = MAX_RETRIES_ON_FORWARD; private int maxRetriesOnForward = MAX_RETRIES_ON_FORWARD;
@ -86,6 +87,9 @@ public class SolrCmdDistributor {
public void finish() { public void finish() {
try { try {
assert ! finished : "lifecycle sanity check";
finished = true;
blockAndDoRetries(); blockAndDoRetries();
} finally { } finally {
clients.shutdown(); clients.shutdown();
@ -227,7 +231,7 @@ public class SolrCmdDistributor {
} }
private void blockAndDoRetries() { public void blockAndDoRetries() {
clients.blockUntilFinished(); clients.blockUntilFinished();
// wait for any async commits to complete // wait for any async commits to complete

View File

@ -221,6 +221,9 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
public static final String COMMIT_END_POINT = "commit_end_point"; public static final String COMMIT_END_POINT = "commit_end_point";
public static final String LOG_REPLAY = "log_replay"; public static final String LOG_REPLAY = "log_replay";
// used to assert we don't call finish more than once, see finish()
private boolean finished = false;
private final SolrQueryRequest req; private final SolrQueryRequest req;
private final SolrQueryResponse rsp; private final SolrQueryResponse rsp;
@ -1373,7 +1376,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
} }
if (someReplicas) { if (someReplicas) {
cmdDistrib.finish(); cmdDistrib.blockAndDoRetries();
} }
} }
@ -1618,7 +1621,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
zkController.getBaseUrl(), req.getCore().getName())); zkController.getBaseUrl(), req.getCore().getName()));
if (nodes != null) { if (nodes != null) {
cmdDistrib.distribCommit(cmd, nodes, params); cmdDistrib.distribCommit(cmd, nodes, params);
finish(); cmdDistrib.blockAndDoRetries();
} }
} }
} }
@ -1645,6 +1648,9 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
@Override @Override
public void finish() throws IOException { public void finish() throws IOException {
assert ! finished : "lifecycle sanity check";
finished = true;
if (zkEnabled) doFinish(); if (zkEnabled) doFinish();
if (next != null && nodes == null) next.finish(); if (next != null && nodes == null) next.finish();