Package org.apache.lucene.index

Examples of org.apache.lucene.index.BlurIndexWriter$LockOwnerException


    if (!DirectoryReader.indexExists(directory)) {
      LOG.info("Creating an empty index");
      // if the directory is empty then create an empty index.
      IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, new KeywordAnalyzer());
      conf.setWriteLockTimeout(TimeUnit.MINUTES.toMillis(5));
      new BlurIndexWriter(directory, conf).close();
    }
    _indexReaderRef.set(DirectoryReader.open(directory));
    _refresher.register(this);
  }
View Full Code Here


    Thread.sleep(TimeUnit.SECONDS.toMillis(2));

    RAMDirectory directory = new RAMDirectory();
    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
    BlurIndexWriter writer = new BlurIndexWriter(directory, conf);

    TransactionRecorder replayTransactionRecorder = new TransactionRecorder(shardContext);
    closeThis.add(replayTransactionRecorder);
    System.out.println("REPLAY");
    replayTransactionRecorder.replay(writer);
View Full Code Here

    indexReader2.close();
  }

  private void doWrite() throws CorruptIndexException, LockObtainFailedException, IOException {
    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, new KeywordAnalyzer());
    BlurIndexWriter writer = new BlurIndexWriter(directory, conf);
    writer.addDocument(getDoc());
    writer.close();
  }
View Full Code Here

    // This directory allows for warm up by adding tracing ability.
    TraceableDirectory dir = new TraceableDirectory(referenceCounter);
   
    SimpleTimer simpleTimer = new SimpleTimer();
    simpleTimer.start("writerOpen");
    _writer = new BlurIndexWriter(dir, conf, true);
    simpleTimer.stop("writerOpen");
    simpleTimer.start("nrtSetup");
    _recorder = new TransactionRecorder(shardContext);
    _recorder.replay(_writer);
View Full Code Here

    BlurConfiguration blurConfiguration = _tableContext.getBlurConfiguration();
    _queue = new ArrayBlockingQueue<RowMutation>(blurConfiguration.getInt(BLUR_SHARD_QUEUE_MAX_INMEMORY_LENGTH, 100));
    _mutationQueueProcessor = new MutationQueueProcessor(_queue, this, _shardContext, _writesWaiting);

    if (!DirectoryReader.indexExists(directory)) {
      new BlurIndexWriter(directory, _conf).close();
    }

    // This directory allows for warm up by adding tracing ability.
    TraceableDirectory dir = new TraceableDirectory(directory);
    _directory = dir;
View Full Code Here

    openWriter();
  }

  private synchronized void openWriter() {
    IOUtils.cleanup(LOG, _indexImporter);
    BlurIndexWriter writer = _writer.get();
    if (writer != null) {
      try {
        writer.close(false);
      } catch (IOException e) {
        LOG.error("Unknown error while trying to close the writer, [" + _shardContext.getTableContext().getTable()
            + "] Shard [" + _shardContext.getShard() + "]", e);
      }
      _writer.set(null);
View Full Code Here

    Thread thread = new Thread(new Runnable() {

      @Override
      public void run() {
        try {
          _writer.set(new BlurIndexWriter(_directory, _conf.clone()));
          synchronized (_writer) {
            _writer.notify();
          }
          _indexImporter = new IndexImporter(BlurIndexSimpleWriter.this, _shardContext, TimeUnit.SECONDS, 10);
        } catch (IOException e) {
View Full Code Here

    _optimizeThread = new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          waitUntilNotNull(_writer);
          BlurIndexWriter writer = _writer.get();
          writer.forceMerge(numberOfSegmentsPerShard, true);
          _writeLock.lock();
          try {
            commit();
          } finally {
            _writeLock.unlock();
View Full Code Here

  }

  private void commit() throws IOException {
    Tracer trace1 = Trace.trace("prepareCommit");
    waitUntilNotNull(_writer);
    BlurIndexWriter writer = _writer.get();
    writer.prepareCommit();
    trace1.done();

    Tracer trace2 = Trace.trace("commit");
    writer.commit();
    trace2.done();

    Tracer trace3 = Trace.trace("index refresh");
    DirectoryReader currentReader = _indexReader.get();
    DirectoryReader newReader = DirectoryReader.openIfChanged(currentReader);
View Full Code Here

    _writesWaiting.incrementAndGet();
    _writeLock.lock();
    _writesWaiting.decrementAndGet();
    indexAction.setWritesWaiting(_writesWaiting);
    waitUntilNotNull(_writer);
    BlurIndexWriter writer = _writer.get();
    IndexSearcherClosable indexSearcher = null;
    try {
      indexSearcher = getIndexSearcher();
      indexAction.performMutate(indexSearcher, writer);
      indexAction.doPreCommit(indexSearcher, writer);
      commit();
      indexAction.doPostCommit(writer);
    } catch (Exception e) {
      indexAction.doPreRollback(writer);
      writer.rollback();
      openWriter();
      indexAction.doPostRollback(writer);
      throw new IOException("Unknown error during mutation", e);
    } finally {
      if (indexSearcher != null) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.BlurIndexWriter$LockOwnerException

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.