lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Itamar Syn-Hershko <ita...@code972.com>
Subject Re: [2/4] lucenenet git commit: ignore fsync for directory completely
Date Tue, 06 Jan 2015 13:26:16 GMT
This is still to be discussed and tested thoroughly, lets first stabilize
the rest of the test and then start running concurrent tests with proper
crashes etc (or at least make sure the Mock framework used does its job
properly)

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>

On Tue, Jan 6, 2015 at 3:24 PM, <synhershko@apache.org> wrote:

> ignore fsync for directory completely
>
>
> Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1c1fc88c
> Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1c1fc88c
> Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1c1fc88c
>
> Branch: refs/heads/master
> Commit: 1c1fc88ce879610f4efa5788c74281bf739563f9
> Parents: 7b8256c
> Author: Laimonas Simutis <laimis@gmail.com>
> Authored: Mon Jan 5 17:21:58 2015 -0500
> Committer: Laimonas Simutis <laimis@gmail.com>
> Committed: Mon Jan 5 17:21:58 2015 -0500
>
> ----------------------------------------------------------------------
>  src/Lucene.Net.Core/Util/IOUtils.cs | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1c1fc88c/src/Lucene.Net.Core/Util/IOUtils.cs
> ----------------------------------------------------------------------
> diff --git a/src/Lucene.Net.Core/Util/IOUtils.cs
> b/src/Lucene.Net.Core/Util/IOUtils.cs
> index 581eb61..6147c4a 100644
> --- a/src/Lucene.Net.Core/Util/IOUtils.cs
> +++ b/src/Lucene.Net.Core/Util/IOUtils.cs
> @@ -443,8 +443,11 @@ namespace Lucene.Net.Util
>          ///  because not all file systems and operating systems allow to
> fsync on a directory) </param>
>          public static void Fsync(string fileToSync, bool isDir)
>          {
> -            // Fsync for folders appears to be "undefined" for Windows
> platform based on the blog article in the comments below
> -            if (isDir && Constants.WINDOWS)
> +            // Fsync does not appear to function properly for Windows and
> Linux platforms. In Lucene version
> +            // they catch this in IOException branch and return if the
> call is for the directory.
> +            // In Lucene.Net the exception is UnauthorizedAccessException
> and is not handled by
> +            // IOException block. No need to even attempt to fsync, just
> return if the call is for directory
> +            if (isDir)
>              {
>                  return;
>              }
> @@ -468,16 +471,10 @@ namespace Lucene.Net.Util
>                      }
>                      catch (IOException e)
>                      {
> -                        if (isDir)
> -                        {
> -                            Debug.Assert((Constants.LINUX ||
> Constants.MAC_OS_X) == false,
> -                                "On Linux and MacOSX fsyncing a directory
> should not throw IOException, " +
> -                                "we just don't want to rely on that in
> production (undocumented). Got: " + e); // Ignore exception if it is a
> directory
> -                            return;
> -                        }
> -
>                          if (retryCount == 5)
> +                        {
>                              throw;
> +                        }
>
>                          // Pause 5 msec
>                          Thread.Sleep(5);
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message