Examples of SnapshotDeletionPolicy


Examples of org.apache.lucene.index.SnapshotDeletionPolicy

    Analyzer analyzer = fieldManager.getAnalyzerForIndex();
    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
    conf.setWriteLockTimeout(TimeUnit.MINUTES.toMillis(5));
    conf.setSimilarity(_tableContext.getSimilarity());
   
    SnapshotDeletionPolicy sdp;
    if (snapshotsDirectoryExists()) {
      // load existing snapshots
      sdp = new SnapshotDeletionPolicy(_tableContext.getIndexDeletionPolicy(), loadExistingSnapshots());
    } else {
      sdp = new SnapshotDeletionPolicy(_tableContext.getIndexDeletionPolicy());
    }
    conf.setIndexDeletionPolicy(sdp);
    conf.setMergedSegmentWarmer(new FieldBasedWarmer(shardContext, _isClosed));

    TieredMergePolicy mergePolicy = (TieredMergePolicy) conf.getMergePolicy();
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

    }
  }

  @Override
  public void createSnapshot(String name) throws IOException {
    SnapshotDeletionPolicy snapshotter = getSnapshotter();
    Map<String, String> existingSnapshots = snapshotter.getSnapshots();
    if (existingSnapshots.containsKey(name)) {
      LOG.error("A Snapshot already exists with the same name [{0}] on [{1}/{2}].",
          name, _tableContext.getTable(), _shardContext.getShard());
      throw new IOException("A Snapshot already exists with the same name [" + name + "] on " +
        "["+_tableContext.getTable()+"/"+_shardContext.getShard()+"].");
    }
    _writer.commit();
    IndexCommit indexCommit = snapshotter.snapshot(name);
   
    /*
     * Persist the snapshots info into a tmp file under the snapshots sub-folder
     * and once writing is finished, close the writer.
     * Now rename the tmp file to an actual snapshots file.
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

        name, _tableContext.getTable(), _shardContext.getShard());
  }

  @Override
  public void removeSnapshot(String name) throws IOException {
    SnapshotDeletionPolicy snapshotter = getSnapshotter();
    Map<String, String> existingSnapshots = snapshotter.getSnapshots();
    if (existingSnapshots.containsKey(name)) {
      snapshotter.release(name);
     
      // now delete the snapshot file stored in the snapshots directory under the shard
      Path snapshotFilePath = new Path(getSnapshotsDirectoryPath(), name);
      getFileSystem().delete(snapshotFilePath, true);
      
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

    }
  }

  @Override
  public List<String> getSnapshots() throws IOException {
    SnapshotDeletionPolicy snapshotter = getSnapshotter();
    Map<String, String> existingSnapshots = snapshotter.getSnapshots();
    return new ArrayList<String>(existingSnapshots.keySet());
  }
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

   * @throws IOException
   */
  private SnapshotDeletionPolicy getSnapshotter() throws IOException{
    IndexDeletionPolicy idp = _writer.getConfig().getIndexDeletionPolicy();
    if (idp instanceof SnapshotDeletionPolicy) {
      SnapshotDeletionPolicy snapshotter = (SnapshotDeletionPolicy)idp;
      return snapshotter;
    } else {
      LOG.error("The index deletion policy for [{0}/{1}] does not support snapshots.",
          _tableContext.getTable(), _shardContext.getShard());
      throw new IOException("The index deletion policy for ["+_tableContext.getTable()+"/"+_shardContext.getShard()+"]" +
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

    serverIndexDir = newDirectory();
    serverReplicator = new LocalReplicator();
    startServer();
   
    IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
    conf.setIndexDeletionPolicy(new SnapshotDeletionPolicy(conf.getIndexDeletionPolicy()));
    writer = new IndexWriter(serverIndexDir, conf);
    reader = DirectoryReader.open(writer, false);
  }
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

 
  @Test
  public void testNoCommit() throws Exception {
    Directory indexDir = newDirectory();
    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
    conf.setIndexDeletionPolicy(new SnapshotDeletionPolicy(conf.getIndexDeletionPolicy()));
    IndexWriter indexWriter = new IndexWriter(indexDir, conf);
   
    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

 
  @Test
  public void testRevisionRelease() throws Exception {
    Directory indexDir = newDirectory();
    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
    conf.setIndexDeletionPolicy(new SnapshotDeletionPolicy(conf.getIndexDeletionPolicy()));
    IndexWriter indexWriter = new IndexWriter(indexDir, conf);
   
    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

 
  @Test
  public void testSegmentsFileLast() throws Exception {
    Directory indexDir = newDirectory();
    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
    conf.setIndexDeletionPolicy(new SnapshotDeletionPolicy(conf.getIndexDeletionPolicy()));
    IndexWriter indexWriter = new IndexWriter(indexDir, conf);
   
    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
View Full Code Here

Examples of org.apache.lucene.index.SnapshotDeletionPolicy

 
  @Test
  public void testOpen() throws Exception {
    Directory indexDir = newDirectory();
    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
    conf.setIndexDeletionPolicy(new SnapshotDeletionPolicy(conf.getIndexDeletionPolicy()));
    IndexWriter indexWriter = new IndexWriter(indexDir, conf);
   
    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.