[ 
https://issues.apache.org/jira/browse/LUCENE-6957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15085360#comment-15085360
 ] 

Adrien Grand commented on LUCENE-6957:
--------------------------------------

I'm confused about the latest patch:

{code}
+    IndexOutput out = null;
+    try {
+      while (true) {
+        out = first.createTempOutput(prefix, suffix, context);
+        String name = out.getName();
+        toDelete.add(name);
+        if (slowFileExists(second, name)) {
+          out.close();
+        } else {
+          success = true;
+          break;
+        }
+      }
+    } finally {
+      if (success) {
+        IOUtils.deleteFiles(first, toDelete);
+      } else {
+        IOUtils.closeWhileHandlingException(out);
+        IOUtils.deleteFilesIgnoringExceptions(first, toDelete);
+      }
+    }
+
+    return out;
{code}

Won't this always return an output on a deleted file since we always call 
{{toDelete.add(name)}} regardless of whether the file exists in the other 
directory? Should we make toDelete a HashSet and call {{toDelete.remove(name)}} 
in the else block?


> NRTCachingDirectory is missing createTempOutput
> -----------------------------------------------
>
>                 Key: LUCENE-6957
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6957
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: Trunk
>
>         Attachments: LUCENE-6957.patch, LUCENE-6957.patch
>
>
> It's broken now because it simply delegates to the wrapped dir now,
> which can create an output that already exists in the ram dir cache.
> This bug only affects trunk (it's never been released).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to