zacharymorn commented on a change in pull request #2052:
URL: https://github.com/apache/lucene-solr/pull/2052#discussion_r537974339
##########
File path:
lucene/misc/src/java/org/apache/lucene/misc/store/DirectIODirectory.java
##########
@@ -154,14 +146,43 @@ public IndexOutput createOutput(String name, IOContext
context) throws IOExcepti
if (context.context != Context.MERGE ||
context.mergeInfo.estimatedMergeBytes < minBytesDirect) {
return delegate.createOutput(name, context);
} else {
- return new NativeUnixIndexOutput(getDirectory().resolve(name), name,
mergeBufferSize);
+ return new DirectIOIndexOutput(getDirectory().resolve(name), name,
mergeBufferSize);
}
}
- @SuppressForbidden(reason = "java.io.File: native API requires old-style
FileDescriptor")
- private final static class NativeUnixIndexOutput extends IndexOutput {
+ @Override
+ public void deleteFile(String name) throws IOException {
+ delegate.deleteFile(name);
+ }
+
+ @Override
+ public Set<String> getPendingDeletions() throws IOException {
Review comment:
Ha I had this same thought for a split second before, but then got
distracted and forgot to come back to it later. I just pushed a commit to make
this change.
##########
File path:
lucene/misc/src/java/org/apache/lucene/misc/store/DirectIODirectory.java
##########
@@ -154,14 +146,43 @@ public IndexOutput createOutput(String name, IOContext
context) throws IOExcepti
if (context.context != Context.MERGE ||
context.mergeInfo.estimatedMergeBytes < minBytesDirect) {
return delegate.createOutput(name, context);
} else {
- return new NativeUnixIndexOutput(getDirectory().resolve(name), name,
mergeBufferSize);
+ return new DirectIOIndexOutput(getDirectory().resolve(name), name,
mergeBufferSize);
}
}
- @SuppressForbidden(reason = "java.io.File: native API requires old-style
FileDescriptor")
- private final static class NativeUnixIndexOutput extends IndexOutput {
+ @Override
+ public void deleteFile(String name) throws IOException {
+ delegate.deleteFile(name);
+ }
+
+ @Override
+ public Set<String> getPendingDeletions() throws IOException {
+ return delegate.getPendingDeletions();
+ }
+
+ @Override
+ public String[] listAll() throws IOException {
+ return delegate.listAll();
+ }
+
+ @Override
+ public long fileLength(String name) throws IOException {
+ return delegate.fileLength(name);
+ }
+
+ @Override
+ public void rename(String source, String dest) throws IOException {
+ delegate.rename(source, dest);
+ }
+
+ @Override
+ public void close() throws IOException {
+ delegate.close();
Review comment:
I made the update to replace `delegate.close()` with
`IOUtils.close(delegate)`, but I don't think I could achieve `super.close()`
through `IOUtils.close(this)` as well, as that leads to stackoverflow? Or am I
misinterpreting the comment here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]