Exemplo n.º 1
0
 private void commitIndexWriter(IndexWriter writer, Translog translog, String syncId)
     throws IOException {
   ensureCanFlush();
   try {
     Translog.TranslogGeneration translogGeneration = translog.getGeneration();
     logger.trace(
         "committing writer with translog id [{}]  and sync id [{}] ",
         translogGeneration.translogFileGeneration,
         syncId);
     Map<String, String> commitData = new HashMap<>(2);
     commitData.put(
         Translog.TRANSLOG_GENERATION_KEY,
         Long.toString(translogGeneration.translogFileGeneration));
     commitData.put(Translog.TRANSLOG_UUID_KEY, translogGeneration.translogUUID);
     if (syncId != null) {
       commitData.put(Engine.SYNC_COMMIT_ID, syncId);
     }
     indexWriter.setCommitData(commitData);
     writer.commit();
   } catch (Throwable ex) {
     failEngine("lucene commit failed", ex);
     throw ex;
   }
 }