git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t6022, t6046: fix flaky files-are-updated checks

From
Elijah Newren <newren@gmail.com>
Date
Mar 13, 2020, 19:27 UTC
Message-ID
<CABPp-BHGsED9noSgAt_OH5G8iXOAvS2cjEV-MDL=hjk365=NdQ@mail.gmail.com>
In-Reply-To
<xmqqtv2sawsf.fsf@gitster.c.googlers.com>
On Fri, Mar 13, 2020 at 12:18 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 27 quoted lines
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Elijah Newren <newren@gmail.com>
> >
> > Several tests wanted to verify that files were actually modified by a
> > merge, which it would do by checking that the mtime was updated.  In
> > order to avoid problems with the merge completing so fast that the mtime
> > at the beginning and end of the operation was the same, these tests
> > would first set the mtime of a file to something "old".  This "old"
> > value was usually determined as current system clock minus one second,
> > truncated to the nearest integer.  Unfortunately, it appears the system
> > clock and filesystem clock are different and comparing across the two
> > runs into race problems resulting in flaky tests.
>
> Good observation (and if we were doing networked filesystems, things
> would be worse).
>
> > So, instead of trying to compare across what are effectively two
> > different clocks, just avoid using the system clock.  Any new updates to
> > files have to give an mtime at least as big as what is already in the
> > file, so define "old" as one second before the mtime found in the file
> > before the merge starts.
>
> Is there a reason why we prefer as small an offset as possible?  I
> am not objecting to the choice of 1 second, but am curious if
> anything bad happens if we used a larger offset, say, 2 hours.

I was thinking about putting in some magic larger number, but was wondering if I needed to explain it or if people might spend cycles thinking about the significance of the random number selected.

However, a larger value might be useful in the face of leap seconds and ntp time updates, so I should probably move that direction.

Any preferences on whether I should I pick something like 3600 (large but easily recognizable), something more round like 10000, or something else?

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “t6022, t6046: fix flaky files-are-updated checks”
  1. t6022, t6046: fix flaky files-are-updated checksElijah Newren via GitGitGadget, Mar 13, 2020
  2. Junio C HamanoMar 13, 2020
  3. Elijah NewrenMar 13, 2020
  4. Junio C HamanoMar 13, 2020
  5. t6022, t6046: fix flaky files-are-updated checksElijah Newren via GitGitGadget, Mar 13, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.