congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SnapshotDeletionPolicy.snapshot
Code IndexAdd Tabnine to your IDE (free)

How to use
snapshot
method
in
org.apache.lucene.index.SnapshotDeletionPolicy

Best Java code snippets using org.apache.lucene.index.SnapshotDeletionPolicy.snapshot (Showing top 14 results out of 315)

origin: neo4j/neo4j

WritableIndexSnapshotFileIterator( File indexDirectory, SnapshotDeletionPolicy snapshotDeletionPolicy )
    throws IOException
{
  super( indexDirectory, snapshotDeletionPolicy.snapshot() );
  this.snapshotDeletionPolicy = snapshotDeletionPolicy;
}
origin: org.apache.lucene/lucene-core

/**
 * Snapshots the last commit. Once this method returns, the
 * snapshot information is persisted in the directory.
 * 
 * @see SnapshotDeletionPolicy#snapshot
 */
@Override
public synchronized IndexCommit snapshot() throws IOException {
 IndexCommit ic = super.snapshot();
 boolean success = false;
 try {
  persist();
  success = true;
 } finally {
  if (!success) {
   try {
    super.release(ic);
   } catch (Exception e) {
    // Suppress so we keep throwing original exception
   }
  }
 }
 return ic;
}
origin: neo4j/neo4j

commit = deletionPolicy.snapshot();
commit = deletionPolicy.snapshot();
origin: com.qwazr/qwazr-search

FromCommit(final Path directoryPath, final SnapshotDeletionPolicy indexSnapshots) throws IOException {
  this(directoryPath, indexSnapshots, indexSnapshots.snapshot());
}
origin: org.terracotta.modules/tim-searchable

public IndexCommit backupIndex() {
    LoggingUtil.debug("Snapshotting at " + System.currentTimeMillis()/1000);
    return (IndexCommit)masterDeletionPolicy.snapshot();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Snapshots the last commit. Once this method returns, the
 * snapshot information is persisted in the directory.
 * 
 * @see SnapshotDeletionPolicy#snapshot
 */
@Override
public synchronized IndexCommit snapshot() throws IOException {
 IndexCommit ic = super.snapshot();
 boolean success = false;
 try {
  persist();
  success = true;
 } finally {
  if (!success) {
   try {
    super.release(ic);
   } catch (Exception e) {
    // Suppress so we keep throwing original exception
   }
  }
 }
 return ic;
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public IndexCommit acquireIndexCommit(final boolean flushFirst) throws EngineException {
  // we have to flush outside of the readlock otherwise we might have a problem upgrading
  // the to a write lock when we fail the engine in this operation
  if (flushFirst) {
    logger.trace("start flush for snapshot");
    flush(false, true);
    logger.trace("finish flush for snapshot");
  }
  try (ReleasableLock lock = readLock.acquire()) {
    ensureOpen();
    logger.trace("pulling snapshot");
    return deletionPolicy.snapshot();
  } catch (IOException e) {
    throw new SnapshotFailedEngineException(shardId, e);
  }
}
origin: harbby/presto-connectors

/**
 * Snapshots the last commit. Once this method returns, the
 * snapshot information is persisted in the directory.
 * 
 * @see SnapshotDeletionPolicy#snapshot
 */
@Override
public synchronized IndexCommit snapshot() throws IOException {
 IndexCommit ic = super.snapshot();
 boolean success = false;
 try {
  persist();
  success = true;
 } finally {
  if (!success) {
   try {
    super.release(ic);
   } catch (Exception e) {
    // Suppress so we keep throwing original exception
   }
  }
 }
 return ic;
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public IndexCommit acquireIndexCommit(final boolean flushFirst) throws EngineException {
  // we have to flush outside of the readlock otherwise we might have a problem upgrading
  // the to a write lock when we fail the engine in this operation
  if (flushFirst) {
    logger.trace("start flush for snapshot");
    flush(false, true);
    logger.trace("finish flush for snapshot");
  }
  try (ReleasableLock lock = readLock.acquire()) {
    ensureOpen();
    logger.trace("pulling snapshot");
    return deletionPolicy.snapshot();
  } catch (IOException e) {
    throw new SnapshotFailedEngineException(shardId, e);
  }
}
origin: org.infinispan/infinispan-embedded-query

/**
 * Snapshots the last commit. Once this method returns, the
 * snapshot information is persisted in the directory.
 * 
 * @see SnapshotDeletionPolicy#snapshot
 */
@Override
public synchronized IndexCommit snapshot() throws IOException {
 IndexCommit ic = super.snapshot();
 boolean success = false;
 try {
  persist();
  success = true;
 } finally {
  if (!success) {
   try {
    super.release(ic);
   } catch (Exception e) {
    // Suppress so we keep throwing original exception
   }
  }
 }
 return ic;
}
origin: vmware/xenon

commit = snapshotter.snapshot();
origin: com.atlassian.bonnie/atlassian-bonnie

@Override
public void snapshot(Directory destDir) throws IOException {
  assertWriterNotClosed();
  try (Ticker ignored = snapShotIndexMetric.start()) {
    final IndexCommit snapshot = snapshotter.snapshot();
    try {
      for (String fileName : snapshot.getFileNames()) {
        snapshot.getDirectory().copy(destDir, fileName, fileName, IOContext.DEFAULT);
      }
    } finally {
      snapshotter.release(snapshot);
    }
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

  indexCommit = deletionPolicy.snapshot();
  return store.getMetadata(indexCommit);
} finally {
origin: com.vmware.dcp/dcp-common

private void handleBackup(Operation op, BackupRequest req) throws Throwable {
  SnapshotDeletionPolicy snapshotter = null;
  IndexCommit commit = null;
  handleMaintenanceImpl(true);
  IndexWriter w = this.writer;
  if (w == null) {
    op.fail(new CancellationException());
    return;
  }
  try {
    // Create a snapshot so the index files won't be deleted.
    snapshotter = (SnapshotDeletionPolicy) w.getConfig().getIndexDeletionPolicy();
    commit = snapshotter.snapshot();
    String indexDirectory = UriUtils.buildUriPath(getHost().getStorageSandbox().getPath(),
        FILE_PATH_LUCENE);
    // Add the files in the commit to a zip file.
    List<URI> fileList = FileUtils.filesToUris(indexDirectory, commit.getFileNames());
    req.backupFile = FileUtils.zipFiles(fileList,
        this.indexDirectory + "-" + Utils.getNowMicrosUtc());
    op.setBody(req).complete();
  } catch (Exception e) {
    this.logSevere(e);
    throw e;
  } finally {
    if (snapshotter != null) {
      snapshotter.release(commit);
    }
    w.deleteUnusedFiles();
  }
}
org.apache.lucene.indexSnapshotDeletionPolicysnapshot

Javadoc

Snapshots the last commit and returns it. Once a commit is 'snapshotted,' it is protected from deletion (as long as this IndexDeletionPolicy is used). The snapshot can be removed by calling #release(IndexCommit) followed by a call to IndexWriter#deleteUnusedFiles().

NOTE: while the snapshot is held, the files it references will not be deleted, which will consume additional disk space in your index. If you take a snapshot at a particularly bad time (say just before you call forceMerge) then in the worst case this could consume an extra 1X of your total index size, until you release the snapshot.

Popular methods of SnapshotDeletionPolicy

  • release
    Release a snapshotted commit.
  • <init>
    Sole constructor, taking the incoming IndexDeletionPolicy to wrap.
  • wrapCommits
    Wraps each IndexCommit as a SnapshotCommitPoint.
  • incRef
    Increments the refCount for this IndexCommit.
  • releaseGen
    Release a snapshot by generation.

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JLabel (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now