void resetWriterState() throws IOException { if ( writer != null ) { // Note that 'rollback' closes the writer. writer.rollback(); } openWriter(); }
private void finishWriting() throws IOException { boolean hasPendingCommit = false; try { writeAnalysisSettings(); writer.prepareCommit(); hasPendingCommit = true; int n = completer.complete(); LOGGER.log(Level.FINE, "completed {0} object(s)", n); // Just before commit(), reset the `hasPendingCommit' flag, // since after commit() is called, there is no need for // rollback() regardless of success. hasPendingCommit = false; writer.commit(); } catch (RuntimeException|IOException e) { if (hasPendingCommit) { writer.rollback(); } LOGGER.log(Level.WARNING, "An error occurred while finishing writer and completer", e); throw e; } }
shutdown(); } else { rollback();
private synchronized void close() throws IOException { if (reader != null) reader.close(); if (writer != null) writer.rollback(); }
indexWriter.rollback(); } catch (AlreadyClosedException ex) { failOnTragicEvent(ex);
/** * @deprecated Please use {@link #rollback} instead. */ public void abort() throws IOException { rollback(); }
private ExternalSearcherManager createSearcherManager(SearchFactory externalSearcherFactory) throws EngineException { boolean success = false; SearcherManager internalSearcherManager = null; try { try { final DirectoryReader directoryReader = ElasticsearchDirectoryReader.wrap(DirectoryReader.open(indexWriter), shardId); internalSearcherManager = new SearcherManager(directoryReader, new RamAccountingSearcherFactory(engineConfig.getCircuitBreakerService())); lastCommittedSegmentInfos = store.readLastCommittedSegmentsInfo(); ExternalSearcherManager externalSearcherManager = new ExternalSearcherManager(internalSearcherManager, externalSearcherFactory); success = true; return externalSearcherManager; } catch (IOException e) { maybeFailEngine("start", e); try { indexWriter.rollback(); } catch (IOException inner) { // iw is closed below e.addSuppressed(inner); } throw new EngineCreationFailureException(shardId, "failed to open reader on writer", e); } } finally { if (success == false) { // release everything we created on a failure IOUtils.closeWhileHandlingException(internalSearcherManager, indexWriter); } } }
protected void rollbackWriter() throws IOException { try { numDocsPending.set(0); if (writer!=null) writer.rollback(); } finally { writer = null; } }
public void close() { if (trackOpenIndexWriters) { for (Map.Entry<String, IndexWriter> entry : trackedOpenIndexWriters.entrySet()) { logger.error("[INDEX WRITER] Sub Index [" + entry.getKey() + "] is still open, rolling back"); try { entry.getValue().rollback(); } catch (Exception e) { // do nothing, ignore } } } }
@Override public void abortIndexing() { try { indexWriter.rollback(); } catch (IOException ex) { exception(ex); } }
public void rollback() throws IOException { getIndexWriter().rollback(); }
@Override public void abortIndexing() { try { indexWriter.rollback(); } catch (IOException ex) { exception(ex); } }
@Override @Deprecated public void rollback() throws IOException { getIndexWriter().rollback(); }
public void rollback() throws IOException { getIndexWriter().rollback(); }
public void rollback() throws IOException { if (indexSearcher != null) { indexSearcher.close(); } if (indexReader != null) { indexReader.close(); } indexWriter.rollback(); indexWriter = null; }
@Override public void rollback() { try { indexWriter.rollback(); indexWriter = null; } catch (IOException e) { throw ExUtil.wrapRuntimeException(e); } }
@Override public synchronized void rollback() throws IOException { getIndexWriter().rollback(); }
/** * Rollback changes to the taxonomy writer and closes the instance. Following * this method the instance becomes unusable (calling any of its API methods * will yield an {@link AlreadyClosedException}). */ @Override public synchronized void rollback() throws IOException { ensureOpen(); indexWriter.rollback(); doClose(); }
@Override public void rollback() { IndexWriter idx = indexWriter; indexWriter = null; try { idx.rollback(); } catch (IOException e) { throw new TextIndexException("rollback", e); } // The rollback will close the indexWriter, so we need to reopen it openIndexWriter(); }
public void rollback() { try { mgrWriter.getIndexWriter().rollback(); reOpen(metadata); } catch (IOException e) { OLogManager.instance().error(this, "Error on rolling back Lucene index", e); } }