[ovs-dev] [PATCH 1/2] ovsdb windows: Allow online compacting

Ben Pfaff blp at ovn.org
Wed Nov 2 03:29:48 UTC 2016


On Tue, Nov 01, 2016 at 08:26:06PM -0700, Ben Pfaff wrote:
> +    /* Replace original file by the temporary file.
> +     *
> +     * We support two strategies:
> +     *
> +     *     - The preferred strategy is to rename the temporary file over the
> +     *       original one in-place, then close the original one.  This works on
> +     *       Unix-like systems.  It does not work on Windows, which does not
> +     *       allow open files to be renamed.  The approach has the advantage
> +     *       that, at any point, we can drop back to something that already
> +     *       works.
> +     *
> +     *     - Alternatively, we can close both files, rename, then open the new
> +     *       file (which now has the original name).  This works on all
> +     *       systems, but if reopening the file fails then we're stuck and have
> +     *       to abort (XXX although it would be better to retry).
> +     *
> +     * We make the strategy a variable instead of an #ifdef to make it easier
> +     * to test both strategies on Unix-like systems, and to make the code
> +     * easier to read. */
> +#ifdef _WIN32
> +    bool rename_open_files = false;
> +#else
> +    bool rename_open_files = false;

This should read "= true".  (I tested both cases here and forgot to
update the commit before posting.)



More information about the dev mailing list