mirror of https://github.com/apache/lucene.git
SOLR-7680: Use POST instead of GET when finding versions for mismatches with CloudInspectUtil
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1685488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac2f610009
commit
f9cca2eba1
|
@ -193,6 +193,9 @@ Other Changes
|
||||||
* SOLR-7678: Switch RTimer to use nanoTime (improves accuracy of QTime, and other times
|
* SOLR-7678: Switch RTimer to use nanoTime (improves accuracy of QTime, and other times
|
||||||
returned by Solr handlers) (Ramkumar Aiyengar)
|
returned by Solr handlers) (Ramkumar Aiyengar)
|
||||||
|
|
||||||
|
* SOLR-7680: Use POST instead of GET when finding versions for mismatches with
|
||||||
|
CloudInspectUtil for tests (Ramkumar Aiyengar)
|
||||||
|
|
||||||
================== 5.2.1 ==================
|
================== 5.2.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
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.apache.solr.cloud;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrClient;
|
import org.apache.solr.client.solrj.SolrClient;
|
||||||
|
import org.apache.solr.client.solrj.SolrRequest;
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.common.SolrDocument;
|
import org.apache.solr.common.SolrDocument;
|
||||||
import org.apache.solr.common.SolrDocumentList;
|
import org.apache.solr.common.SolrDocumentList;
|
||||||
|
@ -145,7 +146,7 @@ public class CloudInspectUtil {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder("SolrDocumentList[sz=" + lst.size());
|
StringBuilder sb = new StringBuilder("SolrDocumentList[sz=" + lst.size());
|
||||||
if (lst.size() != lst.getNumFound()) {
|
if (lst.size() != lst.getNumFound()) {
|
||||||
sb.append(" numFound=" + lst.getNumFound());
|
sb.append(" numFound=").append(lst.getNumFound());
|
||||||
}
|
}
|
||||||
sb.append("]=");
|
sb.append("]=");
|
||||||
sb.append(lst.subList(0, maxSz / 2).toString());
|
sb.append(lst.subList(0, maxSz / 2).toString());
|
||||||
|
@ -187,12 +188,12 @@ public class CloudInspectUtil {
|
||||||
controlDocList = controlClient.query(q).getResults();
|
controlDocList = controlClient.query(q).getResults();
|
||||||
if (controlDocs != controlDocList.getNumFound()) {
|
if (controlDocs != controlDocList.getNumFound()) {
|
||||||
log.error("Something changed! control now " + controlDocList.getNumFound());
|
log.error("Something changed! control now " + controlDocList.getNumFound());
|
||||||
};
|
}
|
||||||
|
|
||||||
cloudDocList = cloudClient.query(q).getResults();
|
cloudDocList = cloudClient.query(q).getResults();
|
||||||
if (cloudClientDocs != cloudDocList.getNumFound()) {
|
if (cloudClientDocs != cloudDocList.getNumFound()) {
|
||||||
log.error("Something changed! cloudClient now " + cloudDocList.getNumFound());
|
log.error("Something changed! cloudClient now " + cloudDocList.getNumFound());
|
||||||
};
|
}
|
||||||
|
|
||||||
if (controlDocs != cloudClientDocs && (addFails != null || deleteFails != null)) {
|
if (controlDocs != cloudClientDocs && (addFails != null || deleteFails != null)) {
|
||||||
boolean legal = CloudInspectUtil.checkIfDiffIsLegal(controlDocList, cloudDocList,
|
boolean legal = CloudInspectUtil.checkIfDiffIsLegal(controlDocList, cloudDocList,
|
||||||
|
@ -205,26 +206,33 @@ public class CloudInspectUtil {
|
||||||
Set<Map> differences = CloudInspectUtil.showDiff(controlDocList, cloudDocList,
|
Set<Map> differences = CloudInspectUtil.showDiff(controlDocList, cloudDocList,
|
||||||
"controlDocList", "cloudDocList");
|
"controlDocList", "cloudDocList");
|
||||||
|
|
||||||
// get versions for the mismatched ids
|
try {
|
||||||
boolean foundId = false;
|
// get versions for the mismatched ids
|
||||||
StringBuilder ids = new StringBuilder("id:(");
|
boolean foundId = false;
|
||||||
for (Map doc : differences) {
|
StringBuilder ids = new StringBuilder("id:(");
|
||||||
ids.append(" "+doc.get("id"));
|
for (Map doc : differences) {
|
||||||
foundId = true;
|
ids.append(" ").append(doc.get("id"));
|
||||||
}
|
foundId = true;
|
||||||
ids.append(")");
|
}
|
||||||
|
ids.append(")");
|
||||||
|
|
||||||
if (foundId) {
|
if (foundId) {
|
||||||
// get versions for those ids that don't match
|
// get versions for those ids that don't match
|
||||||
q = SolrTestCaseJ4.params("q", ids.toString(), "rows", "100000", "fl", "id,_version_",
|
q = SolrTestCaseJ4.params("q", ids.toString(), "rows", "100000", "fl", "id,_version_",
|
||||||
"sort", "id asc", "tests",
|
"sort", "id asc", "tests",
|
||||||
"checkShardConsistency(vsControl)/getVers"); // add a tag to aid in
|
"checkShardConsistency(vsControl)/getVers"); // add a tag to aid in
|
||||||
// debugging via logs
|
// debugging via logs
|
||||||
|
|
||||||
SolrDocumentList a = controlClient.query(q).getResults();
|
// use POST, the ids in the query above is constructed and could be huge
|
||||||
SolrDocumentList b = cloudClient.query(q).getResults();
|
SolrDocumentList a = controlClient.query(q, SolrRequest.METHOD.POST).getResults();
|
||||||
|
SolrDocumentList b = cloudClient.query(q, SolrRequest.METHOD.POST).getResults();
|
||||||
|
|
||||||
log.error("controlClient :" + a + "\n\tcloudClient :" + b);
|
log.error("controlClient :" + a + "\n\tcloudClient :" + b);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// swallow any exceptions, this is just useful for producing debug output,
|
||||||
|
// and shouldn't usurp the original issue with mismatches.
|
||||||
|
log.error("Unable to find versions for mismatched ids", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue