public Directory directory() { ensureOpen(); return directory; }
public void deleteQuiet(String... files) { ensureOpen(); StoreDirectory directory = this.directory; for (String file : files) { try { directory.deleteFile("Store.deleteQuiet", file); } catch (Exception ex) { // ignore :( } } }
public void failIfCorrupted() throws IOException { ensureOpen(); failIfCorrupted(directory, shardId); }
public boolean isMarkedCorrupted() throws IOException { ensureOpen(); /* marking a store as corrupted is basically adding a _corrupted to all * the files. This prevent */ final String[] files = directory().listAll(); for (String file : files) { if (file.startsWith(CORRUPTED)) { return true; } } return false; }
public StoreStats stats() throws IOException { ensureOpen(); return new StoreStats(directory.estimateSize()); }
ensureOpen(); failIfCorrupted(); assert lockDirectory ? commit == null : true : "IW lock should not be obtained if there is a commit point available";
/** * Deletes all corruption markers from this store. */ public void removeCorruptionMarker() throws IOException { ensureOpen(); final Directory directory = directory(); IOException firstException = null; final String[] files = directory.listAll(); for (String file : files) { if (file.startsWith(CORRUPTED)) { try { directory.deleteFile(file); } catch (IOException ex) { if (firstException == null) { firstException = ex; } else { firstException.addSuppressed(ex); } } } } if (firstException != null) { throw firstException; } }
public void deleteQuiet(String... files) { ensureOpen(); StoreDirectory directory = this.directory; for (String file : files) { try { directory.deleteFile("Store.deleteQuiet", file); } catch (Exception ex) { // ignore :( } } }
public Directory directory() { ensureOpen(); return directory; }
public Directory directory() { ensureOpen(); return directory; }
public Directory directory() { ensureOpen(); return directory; }
/** * Marks this store as corrupted. This method writes a {@code corrupted_${uuid}} file containing the given exception * message. If a store contains a {@code corrupted_${uuid}} file {@link #isMarkedCorrupted()} will return <code>true</code>. */ public void markStoreCorrupted(IOException exception) throws IOException { ensureOpen(); if (!isMarkedCorrupted()) { String uuid = CORRUPTED + UUIDs.randomBase64UUID(); try (IndexOutput output = this.directory().createOutput(uuid, IOContext.DEFAULT)) { CodecUtil.writeHeader(output, CODEC, VERSION); BytesStreamOutput out = new BytesStreamOutput(); out.writeException(exception); BytesReference bytes = out.bytes(); output.writeVInt(bytes.length()); BytesRef ref = bytes.toBytesRef(); output.writeBytes(ref.bytes, ref.offset, ref.length); CodecUtil.writeFooter(output); } catch (IOException ex) { logger.warn("Can't mark store as corrupted", ex); } directory().sync(Collections.singleton(uuid)); } }
public void deleteQuiet(String... files) { ensureOpen(); StoreDirectory directory = this.directory; for (String file : files) { try { directory.deleteFile("Store.deleteQuiet", file); } catch (Exception ex) { // ignore :( } } }
public void deleteQuiet(String... files) { ensureOpen(); StoreDirectory directory = this.directory; for (String file : files) { try { directory.deleteFile("Store.deleteQuiet", file); } catch (Exception ex) { // ignore :( } } }
public void failIfCorrupted() throws IOException { ensureOpen(); failIfCorrupted(directory, shardId); }
public void failIfCorrupted() throws IOException { ensureOpen(); failIfCorrupted(directory, shardId); }
public boolean isMarkedCorrupted() throws IOException { ensureOpen(); /* marking a store as corrupted is basically adding a _corrupted to all * the files. This prevent */ final String[] files = directory().listAll(); for (String file : files) { if (file.startsWith(CORRUPTED)) { return true; } } return false; }
public boolean isMarkedCorrupted() throws IOException { ensureOpen(); /* marking a store as corrupted is basically adding a _corrupted to all * the files. This prevent */ final String[] files = directory().listAll(); for (String file : files) { if (file.startsWith(CORRUPTED)) { return true; } } return false; }
public boolean isMarkedCorrupted() throws IOException { ensureOpen(); /* marking a store as corrupted is basically adding a _corrupted to all * the files. This prevent */ final String[] files = directory().listAll(); for (String file : files) { if (file.startsWith(CORRUPTED)) { return true; } } return false; }
public StoreStats stats() throws IOException { ensureOpen(); return new StoreStats(directory.estimateSize()); }