/** * Performs a rollback of all non-committed documents pending. * * Note that this is not a true rollback as in databases. Content you have previously * added may have been committed due to autoCommit, buffer full, other client performing * a commit etc. * * @return an {@link org.apache.solr.client.solrj.response.UpdateResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server */ public UpdateResponse rollback() throws SolrServerException, IOException { return rollback(null); }
/** * Performs a rollback of all non-committed documents pending. * * Note that this is not a true rollback as in databases. Content you have previously * added may have been committed due to autoCommit, buffer full, other client performing * a commit etc. * <p> * Also note that rollbacks reset changes made by <i>all</i> clients. Use this method carefully when multiple clients, * or multithreaded clients are in use. * * @return an {@link org.apache.solr.client.solrj.response.UpdateResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server */ public UpdateResponse rollback() throws SolrServerException, IOException { return rollback(null); }
@Override public void rollback() throws SolrServerException, IOException { this.logger.debug("Rollback changes to Solr"); this.server.rollback(); }
@Override public void rollback() throws IOException { try { client.rollback(); } catch (SolrServerException e) { throw new IOException(e); } }
@Override public void rollback() throws IOException { try { client.rollback(); } catch (SolrServerException e) { throw new IOException(e); } }
@Override public void rollback(String collection) { execute(solrClient -> solrClient.rollback(collection)); }
@Override public UpdateResponse rollbackTransaction() throws SolrServerException, IOException { LOGGER.trace("rollback"); if (!(client instanceof CloudSolrClient)) { return client.rollback(); } else { return new UpdateResponse(); } }
@Override public UpdateResponse rollbackTransaction() throws SolrServerException, IOException { LOGGER.trace("rollback"); SolrClient s = getNonRetryingSolrServer(); if (!(s instanceof CloudSolrClient)) { return server.rollback(); } else { return new UpdateResponse(); } }
@Override public void process(Exchange exchange) throws Exception { String operation = (String) exchange.getIn().getHeader(SolrConstants.OPERATION); if (operation == null) { throw new IllegalArgumentException(SolrConstants.OPERATION + " header is missing"); } SolrClient serverToUse = getBestSolrServer(operation); if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT)) { insert(exchange, serverToUse); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT_STREAMING)) { insert(exchange, serverToUse); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_ID)) { serverToUse.deleteById(exchange.getIn().getBody(String.class)); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_QUERY)) { serverToUse.deleteByQuery(exchange.getIn().getBody(String.class)); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEAN)) { serverToUse.addBean(exchange.getIn().getBody()); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEANS)) { serverToUse.addBeans(exchange.getIn().getBody(Collection.class)); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_COMMIT)) { serverToUse.commit(); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ROLLBACK)) { serverToUse.rollback(); } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_OPTIMIZE)) { serverToUse.optimize(); } else { throw new IllegalArgumentException( SolrConstants.OPERATION + " header value '" + operation + "' is not supported"); } }