in crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateProcessor.java [328:372]
public void processCommit(CommitUpdateCommand cmd) throws IOException {
log.debug("process commit cmd={}", cmd);
if (next != null) next.processCommit(cmd);
if (!mirrorCommits) {
return;
}
UpdateRequest req = createMirrorRequest();
// mirror only once from the first shard leader
boolean shouldMirror = shouldMirrorCommit(cmd.getReq());
if (doMirroring && shouldMirror) {
req.setParam(UpdateParams.COMMIT, "true");
// transfer other params
if (cmd.optimize) {
req.setParam(UpdateParams.OPTIMIZE, "true");
}
if (cmd.softCommit) {
req.setParam(UpdateParams.SOFT_COMMIT, "true");
}
if (cmd.prepareCommit) {
req.setParam(UpdateParams.PREPARE_COMMIT, "true");
}
if (cmd.waitSearcher) {
req.setParam(UpdateParams.WAIT_SEARCHER, "true");
}
if (cmd.openSearcher) {
req.setParam(UpdateParams.OPEN_SEARCHER, "true");
}
if (cmd.expungeDeletes) {
req.setParam(UpdateParams.EXPUNGE_DELETES, "true");
}
if (cmd.maxOptimizeSegments != 0) {
req.setParam(UpdateParams.MAX_OPTIMIZE_SEGMENTS, Integer.toString(cmd.maxOptimizeSegments));
}
log.debug(" --doMirroring commit req={}", req);
try {
requestMirroringHandler.mirror(req);
} catch (Exception e) {
log.error("mirror submit failed", e);
throw new SolrException(SERVER_ERROR, "mirror submit failed", e);
}
} else {
log.debug(" -- skip commit mirroring, doMirroring={}, shouldMirror={}", doMirroring, shouldMirror);
}
}