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

Re: [PATCH v4 0/6] Fix the racy split index problem

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Oct 11, 2018, 11:38 UTC
Message-ID
<20181011113841.GB19800@szeder.dev>
In-Reply-To
<87d0sgepmo.fsf@evledraar.gmail.com>
On Thu, Oct 11, 2018 at 12:36:47PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> 
> On Thu, Oct 11 2018, SZEDER Gábor wrote:
> 
> > Fourth and hopefully final round of fixing occasional test failures when
> > run with 'GIT_TEST_SPLIT_INDEX=yes'.  The only code change is the
> > extraction of a helper function to compare two cache entries' content,
> > and then a couple of minor log message clarifications.  The range-diff
> > below is rather clear on that.
> 
> Looks good. I'm not going to run the stress test I did on v5 on this
> since the changes are just moving existing code into a fuction, unless
> you'd like me to or think there's a reason to that is.

FWIW, I intend to carry this patch below and use it in tests both locally and on Travis CI. I could never trigger any of those three conditions by repeated test runs with 'GIT_TEST_SPLIT_INDEX=yes', or by deliberately constructing tricky scenarios where they might be triggered.

Perhaps with enough time I'll get lucky eventually :)

If it's not too much trouble, then perhaps you could pick it up as well? While testing previous versions of this series it turned out that your setup has much more "luck" in finding problematic timings than mine.

diff --git a/split-index.c b/split-index.c
index 5820412dc5..4af535e236 100644
--- a/split-index.c
+++ b/split-index.c
@@ -254,8 +254,8 @@ void prepare_to_write_split_index(struct index_state *istate)
 				continue;
 			}
 			if (ce->index > si->base->cache_nr) {
-				BUG("ce refers to a shared ce at %d, which is beyond the shared index size %d",
-				    ce->index, si->base->cache_nr);
+				BUG("ce of '%s' refers to a shared ce at %d, which is beyond the shared index size %d",
+				    ce->name, ce->index, si->base->cache_nr);
 			}
 			ce->ce_flags |= CE_MATCHED; /* or "shared" */
 			base = si->base->cache[ce->index - 1];
@@ -293,10 +293,9 @@ void prepare_to_write_split_index(struct index_state *istate)
 				continue;
 			}
 			if (ce->ce_namelen != base->ce_namelen ||
-			    strcmp(ce->name, base->name)) {
-				ce->index = 0;
-				continue;
-			}
+			    strcmp(ce->name, base->name))
+				BUG("ce of '%s' refers to the shared ce of a different file '%s'",
+				    ce->name, base->name);
 			/*
 			 * This is the copy of a cache entry that is present
 			 * in the shared index, created by unpack_trees()
@@ -332,7 +331,8 @@ void prepare_to_write_split_index(struct index_state *istate)
 				 * set CE_UPDATE_IN_BASE as well.
 				 */
 				if (compare_ce_content(ce, base))
-					ce->ce_flags |= CE_UPDATE_IN_BASE;
+					BUG("ce of '%s' differs from its shared ce, but the CE_UPDATE_IN_BASE flag was not set",
+					    ce->name);
 			}
 			discard_cache_entry(base);
 			si->base->cache[ce->index - 1] = ce;
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 41 of 42 in “Fix the racy split index problem”
  1. 0/5 Fix the racy split index problemSZEDER Gábor, Sep 27, 2018
  2. 1/5 split-index: add tests to demonstrate the racy split index problemSZEDER Gábor, Sep 27, 2018
  3. SZEDER GáborSep 28, 2018
  4. SZEDER GáborSep 28, 2018
  5. Junio C HamanoSep 28, 2018
  6. 2/5 t1700-split-index: date back files to avoid racy situationsSZEDER Gábor, Sep 27, 2018
  7. 3/5 split-index: count the number of deleted entriesSZEDER Gábor, Sep 27, 2018
  8. 4/5 split-index: don't compare stat data of entries already marked for split indexSZEDER Gábor, Sep 27, 2018
  9. SZEDER GáborSep 27, 2018
  10. 5/5 split-index: smudge and add racily clean cache entries to split indexSZEDER Gábor, Sep 27, 2018
  11. Ævar Arnfjörð BjarmasonSep 27, 2018
  12. SZEDER GáborSep 27, 2018
  13. Ævar Arnfjörð BjarmasonSep 27, 2018
  14. Ævar Arnfjörð BjarmasonSep 28, 2018
  15. SZEDER GáborSep 28, 2018
  16. Ævar Arnfjörð BjarmasonOct 8, 2018
  17. SZEDER GáborOct 8, 2018
  18. 0/6 Fix the racy split index problemSZEDER Gábor, Sep 28, 2018
  19. 1/6 t1700-split-index: document why FSMONITOR is disabled in this test scriptSZEDER Gábor, Sep 28, 2018
  20. 2/6 split-index: add tests to demonstrate the racy split index problemSZEDER Gábor, Sep 28, 2018
  21. 3/6 t1700-split-index: date back files to avoid racy situationsSZEDER Gábor, Sep 28, 2018
  22. 4/6 split-index: count the number of deleted entriesSZEDER Gábor, Sep 28, 2018
  23. 5/6 split-index: don't compare stat data of entries already marked for split indexSZEDER Gábor, Sep 28, 2018
  24. Duy NguyenSep 29, 2018
  25. SZEDER GáborSep 29, 2018
  26. SZEDER GáborSep 29, 2018
  27. 6/6 split-index: smudge and add racily clean cache entries to split indexSZEDER Gábor, Sep 28, 2018
  28. Duy NguyenSep 29, 2018
  29. SZEDER GáborSep 29, 2018
  30. SZEDER GáborSep 30, 2018
  31. Junio C HamanoOct 5, 2018
  32. 0/6 Fix the racy split index problemSZEDER Gábor, Oct 11, 2018
  33. 1/6 t1700-split-index: document why FSMONITOR is disabled in this test scriptSZEDER Gábor, Oct 11, 2018
  34. 3/6 t1700-split-index: date back files to avoid racy situationsSZEDER Gábor, Oct 11, 2018
  35. 2/6 split-index: add tests to demonstrate the racy split index problemSZEDER Gábor, Oct 11, 2018
  36. 4/6 split-index: count the number of deleted entriesSZEDER Gábor, Oct 11, 2018
  37. 5/6 split-index: don't compare cached data of entries already marked for split indexSZEDER Gábor, Oct 11, 2018
  38. 6/6 split-index: smudge and add racily clean cache entries to split indexSZEDER Gábor, Oct 11, 2018
  39. 7/6 split-index: BUG() when cache entry refers to non-existing shared entrySZEDER Gábor, Oct 11, 2018
  40. Ævar Arnfjörð BjarmasonOct 11, 2018
  41. SZEDER GáborOct 11, 2018
  42. Junio C HamanoOct 12, 2018

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.