/** Set infoStream where messages should go. See {@link #setInfoStream(PrintStream,boolean)}. */ public void setInfoStream(PrintStream out) { setInfoStream(out, false); }
setCrossCheckTermVectors(opts.doCrossCheckTermVectors); setChecksumsOnly(opts.doChecksumsOnly); setInfoStream(opts.out, opts.verbose);
/** * Checks and returns the status of the existing index in this store. * * @param out where infoStream messages should go. See {@link CheckIndex#setInfoStream(PrintStream)} */ public CheckIndex.Status checkIndex(PrintStream out) throws IOException { metadataLock.writeLock().lock(); try (CheckIndex checkIndex = new CheckIndex(directory)) { checkIndex.setInfoStream(out); return checkIndex.checkIndex(); } finally { metadataLock.writeLock().unlock(); } }
/** Set infoStream where messages should go. See {@link #setInfoStream(PrintStream,boolean)}. */ public void setInfoStream(PrintStream out) { setInfoStream(out, false); }
/** Set infoStream where messages should go. See {@link #setInfoStream(PrintStream,boolean)}. */ public void setInfoStream(PrintStream out) { setInfoStream(out, false); }
/** Set infoStream where messages should go. See {@link #setInfoStream(PrintStream,boolean)}. */ public void setInfoStream(PrintStream out) { setInfoStream(out, false); }
public Tuple<RemoveCorruptedShardDataCommand.CleanStatus, String> getCleanStatus(ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { if (RemoveCorruptedShardDataCommand.isCorruptMarkerFileIsPresent(indexDirectory) == false) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN, null); } final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.UNRECOVERABLE, "Index is unrecoverable - there are missing segments"); } return status.clean ? Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN_WITH_CORRUPTED_MARKER, null) : Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CORRUPTED, "Corrupted Lucene index segments found - " + status.totLoseDocCount + " documents will be lost."); } }
public void execute(Terminal terminal, ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { checkCorruptMarkerFileIsPresent(indexDirectory); final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments == false) { if (status.clean == false) { terminal.println("Writing..."); checker.exorciseIndex(status); terminal.println("OK"); terminal.println("Wrote new segments file \"" + status.segmentsFileName + "\""); } } else { throw new ElasticsearchException("Index is unrecoverable - there are missing segments"); } } }
/** * Checks and returns the status of the existing index in this store. * * @param out where infoStream messages should go. See {@link CheckIndex#setInfoStream(PrintStream)} */ public CheckIndex.Status checkIndex(PrintStream out) throws IOException { metadataLock.writeLock().lock(); try (CheckIndex checkIndex = new CheckIndex(directory)) { checkIndex.setInfoStream(out); return checkIndex.checkIndex(); } finally { metadataLock.writeLock().unlock(); } }
/** * Checks and returns the status of the existing index in this store. * * @param out where infoStream messages should go. See {@link CheckIndex#setInfoStream(PrintStream)} */ public CheckIndex.Status checkIndex(PrintStream out) throws IOException { metadataLock.writeLock().lock(); try (CheckIndex checkIndex = new CheckIndex(directory)) { checkIndex.setInfoStream(out); return checkIndex.checkIndex(); } finally { metadataLock.writeLock().unlock(); } }
setCrossCheckTermVectors(opts.doCrossCheckTermVectors); setChecksumsOnly(opts.doChecksumsOnly); setInfoStream(opts.out, opts.verbose);
setCrossCheckTermVectors(opts.doCrossCheckTermVectors); setChecksumsOnly(opts.doChecksumsOnly); setInfoStream(opts.out, opts.verbose);
setCrossCheckTermVectors(opts.doCrossCheckTermVectors); setChecksumsOnly(opts.doChecksumsOnly); setInfoStream(opts.out, opts.verbose);
/** * Runs check-index on the target shard and throws an exception if it failed */ public void checkIndex(ShardPath targetPath) throws IOException { BytesStreamOutput os = new BytesStreamOutput(); PrintStream out = new PrintStream(os, false, Charsets.UTF_8.name()); try (Directory directory = new SimpleFSDirectory(targetPath.resolveIndex()); final CheckIndex checkIndex = new CheckIndex(directory)) { checkIndex.setInfoStream(out); CheckIndex.Status status = checkIndex.checkIndex(); out.flush(); if (!status.clean) { logger.warn("check index [failure]\n{}", new String(os.bytes().toBytes(), Charsets.UTF_8)); throw new IllegalStateException("index check failure"); } } }
ci.setInfoStream(printStream, verbose); } else if (log.isDebugEnabled()) { ci.setInfoStream(new LoggingPrintStream(log), log.isTraceEnabled());
public Tuple<RemoveCorruptedShardDataCommand.CleanStatus, String> getCleanStatus(ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { if (RemoveCorruptedShardDataCommand.isCorruptMarkerFileIsPresent(indexDirectory) == false) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN, null); } final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.UNRECOVERABLE, "Index is unrecoverable - there are missing segments"); } return status.clean ? Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN_WITH_CORRUPTED_MARKER, null) : Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CORRUPTED, "Corrupted Lucene index segments found - " + status.totLoseDocCount + " documents will be lost."); } }
checkIndex.setInfoStream( out ); Status status; try {
public Tuple<RemoveCorruptedShardDataCommand.CleanStatus, String> getCleanStatus(ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { if (RemoveCorruptedShardDataCommand.isCorruptMarkerFileIsPresent(indexDirectory) == false) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN, null); } final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments) { return Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.UNRECOVERABLE, "Index is unrecoverable - there are missing segments"); } return status.clean ? Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CLEAN_WITH_CORRUPTED_MARKER, null) : Tuple.tuple(RemoveCorruptedShardDataCommand.CleanStatus.CORRUPTED, "Corrupted Lucene index segments found - " + status.totLoseDocCount + " documents will be lost."); } }
public void execute(Terminal terminal, ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { checkCorruptMarkerFileIsPresent(indexDirectory); final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments == false) { if (status.clean == false) { terminal.println("Writing..."); checker.exorciseIndex(status); terminal.println("OK"); terminal.println("Wrote new segments file \"" + status.segmentsFileName + "\""); } } else { throw new ElasticsearchException("Index is unrecoverable - there are missing segments"); } } }
public void execute(Terminal terminal, ShardPath shardPath, Directory indexDirectory, Lock writeLock, PrintStream printStream, boolean verbose) throws IOException { checkCorruptMarkerFileIsPresent(indexDirectory); final CheckIndex.Status status; try (CheckIndex checker = new CheckIndex(indexDirectory, writeLock)) { checker.setChecksumsOnly(true); checker.setInfoStream(printStream, verbose); status = checker.checkIndex(null); if (status.missingSegments == false) { if (status.clean == false) { terminal.println("Writing..."); checker.exorciseIndex(status); terminal.println("OK"); terminal.println("Wrote new segments file \"" + status.segmentsFileName + "\""); } } else { throw new ElasticsearchException("Index is unrecoverable - there are missing segments"); } } }