public Store(ShardId shardId, IndexSettings indexSettings, Directory directory, ShardLock shardLock, OnClose onClose) { super(shardId, indexSettings); final TimeValue refreshInterval = indexSettings.getValue(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING); logger.debug("store stats are refreshed with refresh_interval [{}]", refreshInterval); ByteSizeCachingDirectory sizeCachingDir = new ByteSizeCachingDirectory(directory, refreshInterval); this.directory = new StoreDirectory(sizeCachingDir, Loggers.getLogger("index.store.deletes", shardId)); this.shardLock = shardLock; this.onClose = onClose; assert onClose != null; assert shardLock != null; assert shardLock.getShardId().equals(shardId); }
/** Estimate the cumulative size of all files in this directory in bytes. */ long estimateSize() throws IOException { return ((ByteSizeCachingDirectory) getDelegate()).estimateSizeInBytes(); }
@Override protected SizeAndModCount refresh() { // It is ok for the size of the directory to be more recent than // the mod count, we would just recompute the size of the // directory on the next call as well. However the opposite // would be bad as we would potentially have a stale cache // entry for a long time. So we fetch the values of modCount and // numOpenOutputs BEFORE computing the size of the directory. final long modCount; final boolean pendingWrite; synchronized(ByteSizeCachingDirectory.this) { modCount = ByteSizeCachingDirectory.this.modCount; pendingWrite = ByteSizeCachingDirectory.this.numOpenOutputs != 0; } final long size; try { // Compute this OUTSIDE of the lock size = estimateSizeInBytes(getDelegate()); } catch (IOException e) { throw new UncheckedIOException(e); } return new SizeAndModCount(size, modCount, pendingWrite); }
@Override public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException { return wrapIndexOutput(super.createTempOutput(prefix, suffix, context)); }
@Override public IndexOutput createOutput(String name, IOContext context) throws IOException { return wrapIndexOutput(super.createOutput(name, context)); }
@Override public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException { return wrapIndexOutput(super.createTempOutput(prefix, suffix, context)); }
/** Estimate the cumulative size of all files in this directory in bytes. */ long estimateSize() throws IOException { return ((ByteSizeCachingDirectory) getDelegate()).estimateSizeInBytes(); }
public Store(ShardId shardId, IndexSettings indexSettings, Directory directory, ShardLock shardLock, OnClose onClose) { super(shardId, indexSettings); final TimeValue refreshInterval = indexSettings.getValue(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING); logger.debug("store stats are refreshed with refresh_interval [{}]", refreshInterval); ByteSizeCachingDirectory sizeCachingDir = new ByteSizeCachingDirectory(directory, refreshInterval); this.directory = new StoreDirectory(sizeCachingDir, Loggers.getLogger("index.store.deletes", shardId)); this.shardLock = shardLock; this.onClose = onClose; assert onClose != null; assert shardLock != null; assert shardLock.getShardId().equals(shardId); }
@Override protected SizeAndModCount refresh() { // It is ok for the size of the directory to be more recent than // the mod count, we would just recompute the size of the // directory on the next call as well. However the opposite // would be bad as we would potentially have a stale cache // entry for a long time. So we fetch the values of modCount and // numOpenOutputs BEFORE computing the size of the directory. final long modCount; final boolean pendingWrite; synchronized(ByteSizeCachingDirectory.this) { modCount = ByteSizeCachingDirectory.this.modCount; pendingWrite = ByteSizeCachingDirectory.this.numOpenOutputs != 0; } final long size; try { // Compute this OUTSIDE of the lock size = estimateSizeInBytes(getDelegate()); } catch (IOException e) { throw new UncheckedIOException(e); } return new SizeAndModCount(size, modCount, pendingWrite); }
@Override public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException { return wrapIndexOutput(super.createTempOutput(prefix, suffix, context)); }
/** Estimate the cumulative size of all files in this directory in bytes. */ long estimateSize() throws IOException { return ((ByteSizeCachingDirectory) getDelegate()).estimateSizeInBytes(); }
public Store(ShardId shardId, IndexSettings indexSettings, DirectoryService directoryService, ShardLock shardLock, OnClose onClose) throws IOException { super(shardId, indexSettings); final Settings settings = indexSettings.getSettings(); Directory dir = directoryService.newDirectory(); final TimeValue refreshInterval = indexSettings.getValue(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING); logger.debug("store stats are refreshed with refresh_interval [{}]", refreshInterval); ByteSizeCachingDirectory sizeCachingDir = new ByteSizeCachingDirectory(dir, refreshInterval); this.directory = new StoreDirectory(sizeCachingDir, Loggers.getLogger("index.store.deletes", settings, shardId)); this.shardLock = shardLock; this.onClose = onClose; assert onClose != null; assert shardLock != null; assert shardLock.getShardId().equals(shardId); }
@Override protected SizeAndModCount refresh() { // It is ok for the size of the directory to be more recent than // the mod count, we would just recompute the size of the // directory on the next call as well. However the opposite // would be bad as we would potentially have a stale cache // entry for a long time. So we fetch the values of modCount and // numOpenOutputs BEFORE computing the size of the directory. final long modCount; final boolean pendingWrite; synchronized(ByteSizeCachingDirectory.this) { modCount = ByteSizeCachingDirectory.this.modCount; pendingWrite = ByteSizeCachingDirectory.this.numOpenOutputs != 0; } final long size; try { // Compute this OUTSIDE of the lock size = estimateSizeInBytes(getDelegate()); } catch (IOException e) { throw new UncheckedIOException(e); } return new SizeAndModCount(size, modCount, pendingWrite); }
@Override public IndexOutput createOutput(String name, IOContext context) throws IOException { return wrapIndexOutput(super.createOutput(name, context)); }
@Override public IndexOutput createOutput(String name, IOContext context) throws IOException { return wrapIndexOutput(super.createOutput(name, context)); }