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

Re: [PATCH v3] commit-graph: ignore duplicates when merging layers

From
Jeff King <peff@peff.net>
Date
Oct 8, 2020, 16:43 UTC
Message-ID
<20201008164333.GA2838359@coredump.intra.peff.net>
In-Reply-To
<e1d4c427-b9a7-261a-6297-4a4768e8dbc0@gmail.com>
On Thu, Oct 08, 2020 at 12:26:29PM -0400, Derrick Stolee wrote:
Show 18 quoted lines
> >> +			/*
> >> +			 * Silently ignore duplicates. These were likely
> >> +			 * created due to a commit appearing in multiple
> >> +			 * layers of the chain, which is unexpected but
> >> +			 * not invalid. We should make sure there is a
> >> +			 * unique copy in the new layer.
> >> +			 */
> > 
> > You mentioned earlier checking tha the metadata for the duplicates was
> > identical. How hard would that be to do here?
> 
> I do think it is a bit tricky, since we would need to identify
> from these duplicates which commit-graph layers they live in,
> then compare the binary data in each row (for tree, date, generation)
> and also logical data (convert parent int-ids into oids). One way
> to do this would be to create distinct 'struct commit' objects (do
> not use lookup_commit()) but finding the two positions within the
> layers is the hard part.

OK, that sounds sufficiently hard that it isn't worth doing. I wondered if there was easy access since we had the commit_graph handles here. But I guess it really depends on which chunks are even available.

Show 8 quoted lines
> At this point, any disagreement between rows would be corrupt data
> in one or the other, and it should be caught by the 'verify'
> subcommand. It definitely would be caught by 'verify' in the merged
> layer after the 'write' completes.
> 
> At this point, we don't have any evidence that whatever causes the
> duplicate rows could possibly write the wrong data to the duplicate
> rows. I'll keep it in mind as we look for that root cause.

That makes sense. I wonder if it is worth tipping the user off that something funny is going on, and they may want to run "verify". I.e., should we be downgrading the die() to a warning(), rather than silently skipping the duplicate.

I guess it depends on how often we expect this to happen. If the root cause turns out to be some race that's unusual but may come up from time to time, then the warning would unnecessarily alarm people, and/or be annoying. But we don't know yet if that's the case.

-Peff
Previous: Taylor BlauNext: Derrick Stolee via GitGitGadget
Message 9 of 14 in “commit-graph: ignore duplicates when merging layers”
  1. commit-graph: ignore duplicates when merging layersDerrick Stolee via GitGitGadget, Oct 8, 2020
  2. Taylor BlauOct 8, 2020
  3. Derrick StoleeOct 8, 2020
  4. commit-graph: ignore duplicates when merging layersDerrick Stolee via GitGitGadget, Oct 8, 2020
  5. commit-graph: ignore duplicates when merging layersDerrick Stolee via GitGitGadget, Oct 8, 2020
  6. Jeff KingOct 8, 2020
  7. Derrick StoleeOct 8, 2020
  8. Taylor BlauOct 8, 2020
  9. Jeff KingOct 8, 2020
  10. 0/2 commit-graph: ignore duplicates when merging layersDerrick Stolee via GitGitGadget, Oct 9, 2020
  11. 2/2 commit-graph: don't write commit-graph when disabledDerrick Stolee via GitGitGadget, Oct 9, 2020
  12. Junio C HamanoOct 9, 2020
  13. Taylor BlauOct 9, 2020
  14. 1/2 commit-graph: ignore duplicates when merging layersDerrick Stolee via GitGitGadget, Oct 9, 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.