Java Code Examples for org.apache.solr.update.DeleteUpdateCommand#setFlags()
The following examples show how to use
org.apache.solr.update.DeleteUpdateCommand#setFlags() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CdcrUpdateProcessor.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override protected boolean versionDelete(DeleteUpdateCommand cmd) throws IOException { /* temporarily set the PEER_SYNC flag so that DistributedUpdateProcessor.deleteAdd doesn't execute leader logic but the else part of that if. That way version remains preserved. we cannot set the flag for the whole processDelete method because DistributedUpdateProcessor.setupRequest() would set isLeader to false which wouldn't work */ if (cmd.getReq().getParams().get(CDCR_UPDATE) != null) { cmd.setFlags(cmd.getFlags() | UpdateCommand.PEER_SYNC); // we need super.versionAdd() to set leaderLogic to false } boolean result = super.versionDelete(cmd); // unset the flag to avoid unintended consequences down the chain if (cmd.getReq().getParams().get(CDCR_UPDATE) != null) { cmd.setFlags(cmd.getFlags() & ~UpdateCommand.PEER_SYNC); } return result; }
Example 2
Source File: CdcrUpdateProcessor.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override protected void versionDeleteByQuery(DeleteUpdateCommand cmd) throws IOException { /* temporarily set the PEER_SYNC flag so that DistributedUpdateProcessor.versionDeleteByQuery doesn't execute leader logic That way version remains preserved. */ if (cmd.getReq().getParams().get(CDCR_UPDATE) != null) { cmd.setFlags(cmd.getFlags() | UpdateCommand.PEER_SYNC); // we need super.versionDeleteByQuery() to set leaderLogic to false } super.versionDeleteByQuery(cmd); // unset the flag to avoid unintended consequences down the chain if (cmd.getReq().getParams().get(CDCR_UPDATE) != null) { cmd.setFlags(cmd.getFlags() & ~UpdateCommand.PEER_SYNC); } }
Example 3
Source File: DistributedUpdateProcessor.java From lucene-solr with Apache License 2.0 | 5 votes |
private void doLocalDeleteByQuery(DeleteUpdateCommand cmd, long versionOnUpdate, boolean isReplayOrPeersync) throws IOException { if (versionsStored) { final boolean leaderLogic = isLeader & !isReplayOrPeersync; if (leaderLogic) { long version = vinfo.getNewClock(); cmd.setVersion(-version); // TODO update versions in all buckets doLocalDelete(cmd); } else { cmd.setVersion(-versionOnUpdate); if (ulog.getState() != UpdateLog.State.ACTIVE && isReplayOrPeersync == false) { // we're not in an active state, and this update isn't from a replay, so buffer it. cmd.setFlags(cmd.getFlags() | UpdateCommand.BUFFERING); ulog.deleteByQuery(cmd); return; } if (!isSubShardLeader && replicaType == Replica.Type.TLOG && (cmd.getFlags() & UpdateCommand.REPLAY) == 0) { // TLOG replica not leader, don't write the DBQ to IW cmd.setFlags(cmd.getFlags() | UpdateCommand.IGNORE_INDEXWRITER); } doLocalDelete(cmd); } } }
Example 4
Source File: SolrUpdateService.java From chronix.server with Apache License 2.0 | 5 votes |
/** * Deletes documents identified by the given documents. * * @param docs the documents * @throws IOException iff something goes wrong */ public void delete(Collection<Document> docs) throws IOException { DeleteUpdateCommand cmd = new DeleteUpdateCommand(req); cmd.commitWithin = COMMIT_WITHIN; cmd.setFlags(DeleteUpdateCommand.BUFFERING); cmd.setQuery("{!terms f=" + ID + "}" + docs.stream().map(it -> it.get(ID)).collect(joining(","))); updateProcessor.processDelete(cmd); }