lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrien Grand (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-6957) NRTCachingDirectory is missing createTempOutput
Date Wed, 06 Jan 2016 10:11:39 GMT

    [ 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message