@Override public void sync(Collection<String> names) throws IOException { in.sync(names); }
@Override public void sync(Collection<String> names) throws IOException { List<String> primaryNames = new ArrayList<>(); List<String> secondaryNames = new ArrayList<>(); for (String name : names) if (primaryExtensions.contains(getExtension(name))) primaryNames.add(name); else secondaryNames.add(name); primaryDir.sync(primaryNames); secondaryDir.sync(secondaryNames); }
@Override public void sync(Collection<String> names) throws IOException { writeLock.ensureValid(); in.sync(names); } }
@Override public void sync(Collection<String> fileNames) throws IOException { if (VERBOSE) { System.out.println("nrtdir.sync files=" + fileNames); } for(String fileName : fileNames) { unCache(fileName); } in.sync(fileNames); }
@Override public void sync( Collection<String> names ) throws IOException { // where are waiting for a specific sync during index commit process inside lucene // as soon as we will reach it - we will fail into sleep to give chance for concurrent close calls if ( names.stream().noneMatch( name -> name.startsWith( IndexFileNames.PENDING_SEGMENTS ) ) ) { try { signal.countDown(); Thread.sleep( 500 ); } catch ( Exception e ) { throw new RuntimeException( e ); } } delegate.sync( names ); }
synchronized private void persist() throws IOException { String fileName = SNAPSHOTS_PREFIX + nextWriteGen; IndexOutput out = dir.createOutput(fileName, IOContext.DEFAULT); boolean success = false; try { CodecUtil.writeHeader(out, CODEC_NAME, VERSION_CURRENT); out.writeVInt(refCounts.size()); for(Entry<Long,Integer> ent : refCounts.entrySet()) { out.writeVLong(ent.getKey()); out.writeVInt(ent.getValue()); } success = true; } finally { if (!success) { IOUtils.closeWhileHandlingException(out); IOUtils.deleteFilesIgnoringExceptions(dir, fileName); } else { IOUtils.close(out); } } dir.sync(Collections.singletonList(fileName)); if (nextWriteGen > 0) { String lastSaveFile = SNAPSHOTS_PREFIX + (nextWriteGen-1); // exception OK: likely it didn't exist IOUtils.deleteFilesIgnoringExceptions(dir, lastSaveFile); } nextWriteGen++; }
private void write(Directory directory) throws IOException { long nextGeneration = getNextPendingGeneration(); String segmentFileName = IndexFileNames.fileNameFromGeneration(IndexFileNames.PENDING_SEGMENTS, "", nextGeneration); // Always advance the generation on write: generation = nextGeneration; IndexOutput segnOutput = null; boolean success = false; try { segnOutput = directory.createOutput(segmentFileName, IOContext.DEFAULT); write(directory, segnOutput); segnOutput.close(); directory.sync(Collections.singleton(segmentFileName)); success = true; } finally { if (success) { pendingCommit = true; } else { // We hit an exception above; try to close the file // but suppress any exception: IOUtils.closeWhileHandlingException(segnOutput); // Try not to leave a truncated segments_N file in // the index: IOUtils.deleteFilesIgnoringExceptions(directory, segmentFileName); } } }
try { filesToSync = toSync.files(false); directory.sync(filesToSync); success = true; } finally {
@Override public void sync(Collection<String> names) throws IOException { in.sync(names); }
/** * 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)); } }
store.directory().sync(Collections.singleton(fileInfo.physicalName())); success = true; } catch (CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException ex) {
@Override public void sync() throws IOException { local.sync(Collections.singleton(name)); }
assert Arrays.asList(store.directory().listAll()).contains(temporaryFileName) : "expected: [" + temporaryFileName + "] in " + Arrays.toString(store.directory().listAll()); store.directory().sync(Collections.singleton(temporaryFileName)); IndexOutput remove = removeOpenIndexOutputs(name); assert remove == null || remove == indexOutput; // remove maybe null if we got finished
@Override public void sync(Collection<String> names) throws IOException { List<String> primaryNames = new ArrayList<>(); List<String> secondaryNames = new ArrayList<>(); for (String name : names) if (primaryExtensions.contains(getExtension(name))) primaryNames.add(name); else secondaryNames.add(name); primaryDir.sync(primaryNames); secondaryDir.sync(secondaryNames); }
@Override public void sync(Collection<String> names) throws IOException { List<String> primaryNames = new ArrayList<>(); List<String> secondaryNames = new ArrayList<>(); for (String name : names) if (primaryExtensions.contains(getExtension(name))) primaryNames.add(name); else secondaryNames.add(name); primaryDir.sync(primaryNames); secondaryDir.sync(secondaryNames); }
@Override public void sync(Collection<String> names) throws IOException { List<String> primaryNames = new ArrayList<String>(); List<String> secondaryNames = new ArrayList<String>(); for (String name : names) if (primaryExtensions.contains(getExtension(name))) primaryNames.add(name); else secondaryNames.add(name); primaryDir.sync(primaryNames); secondaryDir.sync(secondaryNames); }
@Override public void sync(Collection<String> fileNames) throws IOException { if (VERBOSE) { System.out.println("nrtdir.sync files=" + fileNames); } for(String fileName : fileNames) { unCache(fileName); } in.sync(fileNames); }
@Override public void sync(Collection<String> names) throws IOException { writeLock.ensureValid(); in.sync(names); } }
@Override public void sync(Collection<String> names) throws IOException { writeLock.ensureValid(); in.sync(names); } }
@Override public void sync(Collection<String> names) throws IOException { writeLock.ensureValid(); in.sync(names); } }