Package org.apache.blur.index

Examples of org.apache.blur.index.IndexDeletionPolicyReader


    TieredMergePolicy mergePolicy = (TieredMergePolicy) _conf.getMergePolicy();
    mergePolicy.setUseCompoundFile(false);
    _conf.setMergeScheduler(mergeScheduler.getMergeScheduler());
    _snapshotIndexDeletionPolicy = new SnapshotIndexDeletionPolicy(_tableContext.getConfiguration(), new Path(
        shardContext.getHdfsDirPath(), "generations"));
    _policy = new IndexDeletionPolicyReader(_snapshotIndexDeletionPolicy);
    _conf.setIndexDeletionPolicy(_policy);
    BlurConfiguration blurConfiguration = _tableContext.getBlurConfiguration();
    _queue = new ArrayBlockingQueue<RowMutation>(blurConfiguration.getInt(BLUR_SHARD_QUEUE_MAX_INMEMORY_LENGTH, 100));
    _mutationQueueProcessor = new MutationQueueProcessor(_queue, this, _shardContext, _writesWaiting);
View Full Code Here


  @Test
  public void testCreateIndex() throws IOException {
    long s = System.nanoTime();
    IndexWriterConfig conf = new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION, new KeywordAnalyzer());
    IndexDeletionPolicyReader indexDeletionPolicy = new IndexDeletionPolicyReader(
        new KeepOnlyLastCommitDeletionPolicy());
    conf.setIndexDeletionPolicy(indexDeletionPolicy);
    FSDirectory control = FSDirectory.open(fileControl);
    Directory dir = getControlDir(control, directory);
    // The serial merge scheduler can be useful for debugging.
    // conf.setMergeScheduler(new SerialMergeScheduler());
    IndexWriter writer = new IndexWriter(dir, conf);
    int numDocs = 10000;
    DirectoryReader reader = null;
    long gen = 0;
    for (int i = 0; i < 100; i++) {
      if (reader == null) {
        reader = DirectoryReader.open(writer, true);
        gen = reader.getIndexCommit().getGeneration();
        indexDeletionPolicy.register(gen);
      } else {
        DirectoryReader old = reader;
        reader = DirectoryReader.openIfChanged(old, writer, true);
        if (reader == null) {
          reader = old;
        } else {
          long newGen = reader.getIndexCommit().getGeneration();
          indexDeletionPolicy.register(newGen);
          indexDeletionPolicy.unregister(gen);
          old.close();
          gen = newGen;
        }
      }
      assertEquals(i * numDocs, reader.numDocs());
View Full Code Here

TOP

Related Classes of org.apache.blur.index.IndexDeletionPolicyReader

Copyright © 2018 www.massapicom. 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.