ensureCanWrite is not necessary since we pass TRUNCATE_EXISTING

This commit is contained in:
Mike McCandless 2016-02-03 05:35:32 -05:00
parent 2c0a66bfbc
commit 72b79308cb
2 changed files with 0 additions and 6 deletions

View File

@ -228,7 +228,6 @@ public abstract class FSDirectory extends BaseDirectory {
@Override
public IndexOutput createOutput(String name, IOContext context) throws IOException {
ensureOpen();
ensureCanWrite(name);
return new FSIndexOutput(name);
}
@ -246,10 +245,6 @@ public abstract class FSDirectory extends BaseDirectory {
}
}
protected void ensureCanWrite(String name) throws IOException {
Files.deleteIfExists(directory.resolve(name)); // delete existing, if any
}
@Override
public void sync(Collection<String> names) throws IOException {
ensureOpen();

View File

@ -148,7 +148,6 @@ public class NativeUnixDirectory extends FSDirectory {
if (context.context != Context.MERGE || context.mergeInfo.estimatedMergeBytes < minBytesDirect) {
return delegate.createOutput(name, context);
} else {
ensureCanWrite(name);
return new NativeUnixIndexOutput(getDirectory().resolve(name), name, mergeBufferSize);
}
}