mirror of https://github.com/apache/lucene.git
LUCENE-5621: remove IndexOutput.flush
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1588739 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6902200e65
commit
ec0a9f1f13
|
@ -83,6 +83,9 @@ API Changes
|
|||
IndexOutput.getFilePointer instead) and IndexOutput.setLength.
|
||||
(Mike McCandless)
|
||||
|
||||
* LUCENE-5621: Deprecate IndexOutput.flush: this is not used by Lucene.
|
||||
(Robert Muir)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-5603: hunspell stemmer more efficiently strips prefixes
|
||||
|
|
|
@ -383,7 +383,6 @@ public final class DirectPostingsFormat extends PostingsFormat {
|
|||
|
||||
final byte[] payloads;
|
||||
if (hasPayloads) {
|
||||
ros.flush();
|
||||
payloads = new byte[(int) ros.getFilePointer()];
|
||||
ros.writeTo(payloads, 0);
|
||||
} else {
|
||||
|
|
|
@ -100,8 +100,8 @@ public abstract class BufferedIndexOutput extends IndexOutput {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
/** Forces any buffered output to be written. */
|
||||
protected void flush() throws IOException {
|
||||
crc.update(buffer, 0, bufferPosition);
|
||||
flushBuffer(buffer, bufferPosition);
|
||||
bufferStart += bufferPosition;
|
||||
|
|
|
@ -298,11 +298,6 @@ final class CompoundFileWriter implements Closeable{
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
delegate.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (!closed) {
|
||||
|
|
|
@ -31,9 +31,6 @@ import java.io.IOException;
|
|||
*/
|
||||
public abstract class IndexOutput extends DataOutput implements Closeable {
|
||||
|
||||
/** Forces any buffered output to be written. */
|
||||
public abstract void flush() throws IOException;
|
||||
|
||||
/** Closes this stream to further operations. */
|
||||
@Override
|
||||
public abstract void close() throws IOException;
|
||||
|
|
|
@ -154,8 +154,8 @@ public class RAMOutputStream extends IndexOutput {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
/** Forces any buffered output to be written. */
|
||||
protected void flush() throws IOException {
|
||||
setFileLength();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,15 +50,6 @@ final class RateLimitedIndexOutput extends BufferedIndexOutput {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
try {
|
||||
super.flush();
|
||||
} finally {
|
||||
delegate.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
|
|
@ -59,9 +59,10 @@ public class TestMockDirectoryWrapper extends LuceneTestCase {
|
|||
final byte[] bytes = new byte[] { 1, 2};
|
||||
IndexOutput out = dir.createOutput("foo", IOContext.DEFAULT);
|
||||
out.writeBytes(bytes, bytes.length); // first write should succeed
|
||||
// flush() to ensure the written bytes are not buffered and counted
|
||||
// close() to ensure the written bytes are not buffered and counted
|
||||
// against the directory size
|
||||
out.flush();
|
||||
out.close();
|
||||
out = dir.createOutput("bar", IOContext.DEFAULT);
|
||||
try {
|
||||
out.writeBytes(bytes, bytes.length);
|
||||
fail("should have failed on disk full");
|
||||
|
@ -76,9 +77,10 @@ public class TestMockDirectoryWrapper extends LuceneTestCase {
|
|||
dir.setMaxSizeInBytes(3);
|
||||
out = dir.createOutput("foo", IOContext.DEFAULT);
|
||||
out.copyBytes(new ByteArrayDataInput(bytes), bytes.length); // first copy should succeed
|
||||
// flush() to ensure the written bytes are not buffered and counted
|
||||
// close() to ensure the written bytes are not buffered and counted
|
||||
// against the directory size
|
||||
out.flush();
|
||||
out.close();
|
||||
out = dir.createOutput("bar", IOContext.DEFAULT);
|
||||
try {
|
||||
out.copyBytes(new ByteArrayDataInput(bytes), bytes.length);
|
||||
fail("should have failed on disk full");
|
||||
|
|
|
@ -164,7 +164,6 @@ public class SlowRAMDirectory extends RAMDirectory {
|
|||
}
|
||||
|
||||
@Override public void close() throws IOException { io.close(); }
|
||||
@Override public void flush() throws IOException { io.flush(); }
|
||||
@Override public long getFilePointer() { return io.getFilePointer(); }
|
||||
@Override public long getChecksum() throws IOException { return io.getChecksum(); }
|
||||
}
|
||||
|
|
|
@ -198,11 +198,6 @@ public class NativeUnixDirectory extends FSDirectory {
|
|||
// FileChannel provides an API?
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
// TODO -- I don't think this method is necessary?
|
||||
}
|
||||
|
||||
private void dump() throws IOException {
|
||||
buffer.flip();
|
||||
final long limit = filePos + buffer.limit();
|
||||
|
|
|
@ -983,15 +983,6 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
|||
io.writeBytes(b, offset, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
try {
|
||||
super.flush();
|
||||
} finally {
|
||||
io.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
|
|
|
@ -105,12 +105,6 @@ public class MockIndexOutputWrapper extends IndexOutput {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
dir.maybeThrowDeterministicException();
|
||||
delegate.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeByte(byte b) throws IOException {
|
||||
singleByte[0] = b;
|
||||
|
|
|
@ -68,12 +68,6 @@ public class ThrottledIndexOutput extends IndexOutput {
|
|||
this.minBytesWritten = minBytesWritten;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
sleep(flushDelayMillis);
|
||||
delegate.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
|
|
|
@ -45,12 +45,7 @@ public class CachedIndexOutput extends ReusedBufferedIndexOutput {
|
|||
this.location = directory.getFileCacheLocation(name);
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushInternal() throws IOException {
|
||||
dest.flush();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeInternal() throws IOException {
|
||||
dest.close();
|
||||
|
@ -91,7 +86,7 @@ public class CachedIndexOutput extends ReusedBufferedIndexOutput {
|
|||
|
||||
@Override
|
||||
public long getChecksum() throws IOException {
|
||||
flush();
|
||||
flushBufferToCache();
|
||||
return dest.getChecksum();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class ReusedBufferedIndexOutput extends IndexOutput {
|
|||
}
|
||||
|
||||
/** Write the buffered bytes to cache */
|
||||
private void flushBufferToCache() throws IOException {
|
||||
protected void flushBufferToCache() throws IOException {
|
||||
writeInternal(buffer, 0, bufferLength);
|
||||
|
||||
bufferStart += bufferLength;
|
||||
|
@ -72,14 +72,6 @@ public abstract class ReusedBufferedIndexOutput extends IndexOutput {
|
|||
bufferPosition = 0;
|
||||
}
|
||||
|
||||
protected abstract void flushInternal() throws IOException;
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
flushBufferToCache();
|
||||
flushInternal();
|
||||
}
|
||||
|
||||
protected abstract void closeInternal() throws IOException;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,11 +34,6 @@ public class NullIndexOutput extends IndexOutput {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFilePointer() {
|
||||
return pos;
|
||||
|
|
|
@ -92,7 +92,6 @@ public class HdfsDirectoryTest extends SolrTestCaseJ4 {
|
|||
|
||||
IndexOutput output = directory.createOutput("testing.test", new IOContext());
|
||||
output.writeInt(12345);
|
||||
output.flush();
|
||||
output.close();
|
||||
|
||||
IndexInput input = directory.openInput("testing.test", new IOContext());
|
||||
|
|
Loading…
Reference in New Issue