git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Han-Wen Nienhuys <hanwenn@gmail.com>,
	Han-Wen Nienhuys <hanwen@google.com>
Subject: Re: [PATCH] doc/reftable: document how to handle windows
Date: Mon, 25 Jan 2021 21:49:11 -0800	[thread overview]
Message-ID: <xmqq35yo459k.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <pull.951.git.git.1611589125365.gitgitgadget@gmail.com> (Han-Wen Nienhuys via GitGitGadget's message of "Mon, 25 Jan 2021 15:38:45 +0000")

"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  $ cat .git/reftable/tables.list
> -00000001-00000001.log
> -00000002-00000002.ref
> -00000003-00000003.ref
> +00000001-00000001-RANDOM1.log
> +00000002-00000002-RANDOM2.ref
> +00000003-00000003-RANDOM3.ref
>  ....
> @@ -940,7 +944,7 @@ new reftable and atomically appending it to the stack:
>  3.  Select `update_index` to be most recent file's
>  `max_update_index + 1`.
>  4.  Prepare temp reftable `tmp_XXXXXX`, including log entries.
> -5.  Rename `tmp_XXXXXX` to `${update_index}-${update_index}.ref`.
> +5.  Rename `tmp_XXXXXX` to `${update_index}-${update_index}-${random}.ref`.
>  6.  Copy `tables.list` to `tables.list.lock`, appending file from (5).
>  7.  Rename `tables.list.lock` to `tables.list`.

Is this because we have been assuming that in step 5. we can
"overwrite" (i.e. take over the name, implicitly unlinking the
existing one) the existing 0000001-00000001.ref with the newly
prepared one, which is not doable on Windows?

We must prepare for two "randoms" colliding and retrying the
renaming step anyway, so would it make more sense to instead
use a non-random suffix (i.e. try "-0.ref" first, and when it
fails, readdir for 0000001-00000001-*.ref to find the latest
suffix and increment it)?

> @@ -993,7 +997,7 @@ prevents other processes from trying to compact these files.
>  should always be the case, assuming that other processes are adhering to
>  the locking protocol.
>  7.  Rename `${min_update_index}-${max_update_index}_XXXXXX` to
> -`${min_update_index}-${max_update_index}.ref`.
> +`${min_update_index}-${max_update_index}-${random}.ref`.
>  8.  Write the new stack to `tables.list.lock`, replacing `B` and `C`
>  with the file from (4).

Likewise.

  reply	other threads:[~2021-01-26 22:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 15:38 [PATCH] doc/reftable: document how to handle windows Han-Wen Nienhuys via GitGitGadget
2021-01-26  5:49 ` Junio C Hamano [this message]
2021-01-26 11:38   ` Han-Wen Nienhuys
2021-01-26 17:40     ` Junio C Hamano
2021-01-26 18:11       ` Han-Wen Nienhuys
2021-01-26 20:12         ` Junio C Hamano
2021-02-23 16:57 ` [PATCH v2] " Han-Wen Nienhuys via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq35yo459k.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hanwen@google.com \
    --cc=hanwenn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).