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

Re: [PATCH 32/36] pathspec: allow querying for attributes

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2016, 18:29 UTC
Message-ID
<xmqqzilp63yh.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161022233225.8883-33-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> The pathspec mechanism is extended via the new
> ":(attr:eol=input)pattern/to/match" syntax to filter paths so that it
> requires paths to not just match the given pattern but also have the
> specified attrs attached for them to be chosen.

I was looking at preload-index.c and its history again, because I wanted to ensure that Lars's process filter stuff introduces no unexpected interactions with getting multi-threaded, similar to the problem we had in the earlier incarnations of this step, which we worked around with <xmqqshwvvaxq.fsf@gitster.mtv.corp.google.com> "pathspec: disable preload-index when attribute pathspec magic is in use".

I think that Lars's series is safe, because the only thing among what preload-index.c::preload_thread() does that can go outside the simple stat data and pattern matching with the pathname is the racy-git check in ie_match_stat(), and the object store access in that call was explicitly disabled by 7c4ea599b0 ("Fix index preloading for racy dirty case", 2008-11-17) long time ago.

By passing CE_MATCH_RACY_IS_DIRTY option to the call, this caller effectively says "A cache entry whose stat data matches may be actually dirty when the timestamp is racy, in which case we usually compare data to determine if it really is clean, but it is OK to err on the safe and lazy side by declaring it dirty and not marking it up-to-date while we are preloading. Do not bother to go to the object store".

The reason why I am bringing this up in this discussion thread on this patch is because I wonder if we would benefit by a similar "let's not do too involved things and be cheap by erring on the safe and lazy side" strategy in the call to ce_path_match() call made in this function to avoid making calls to the attr subsystem.

In other words, would it help the system by either simplifying the processing done or reducing the cycle spent in preload_thread() if we could tell ce_path_match() "A pathspec we are checking may require not just the pattern to match but also attributes given to the path to satisfy the criteria, but for the purpose of preloading, pretend that the attribute satisfies the match criteria" (or "pretend that it does not match"), thereby not having to make any call into the attribute subsystem at all from this codepath?

The strategy this round takes to make it unnecessary to punt preloading (i.e. dropping "pathspec: disable preload-index when attribute pathspec magic is in use" patch the old series had) is to make the attribute subsystem thread-safe. But that thread-safety in the initial round is based on a single Big Attribute Lock, so it may turn out that the end result performs better for this codepath if we did not to make any call into the attribute subsystem.

I am probably being two step ahead of ourselves by saying the above, which is just something to keep in mind as a possible solution if performance in this preload codepath becomes an issue when the pathspec has attributes match specified.

Previous: Stefan BellerNext: Duy Nguyen
Message 77 of 81 in “[PATCHv2 00/36] Revamping the attr subsystem!”
  1. Stefan BellerOct 22, 2016
  2. 01/36 commit.c: use strchrnul() to scan for one lineStefan Beller, Oct 22, 2016
  3. 02/36 attr.c: use strchrnul() to scan for one lineStefan Beller, Oct 22, 2016
  4. 04/36 attr.c: explain the lack of attr-name syntax check in parse_attr()Stefan Beller, Oct 22, 2016
  5. 06/36 attr.c: mark where #if DEBUG ends more clearlyStefan Beller, Oct 22, 2016
  6. 05/36 attr.c: complete a sentence in a commentStefan Beller, Oct 22, 2016
  7. 03/36 attr.c: update a stale comment on "struct match_attr"Stefan Beller, Oct 22, 2016
  8. 09/36 attr.c: plug small leak in parse_attr_line()Stefan Beller, Oct 22, 2016
  9. 07/36 attr.c: simplify macroexpand_one()Stefan Beller, Oct 22, 2016
  10. 10/36 attr: rename function and struct related to checking attributesStefan Beller, Oct 22, 2016
  11. 08/36 attr.c: tighten constness around "git_attr" structureStefan Beller, Oct 22, 2016
  12. 12/36 attr: convert git_all_attrs() to use "struct git_attr_check"Stefan Beller, Oct 22, 2016
  13. 14/36 attr: retire git_check_attrs() APIStefan Beller, Oct 22, 2016
  14. 11/36 attr: (re)introduce git_check_attr() and struct git_attr_checkStefan Beller, Oct 22, 2016
  15. 16/36 attr: add counted string version of git_attr()Stefan Beller, Oct 22, 2016
  16. 17/36 attr: expose validity check for attribute namesStefan Beller, Oct 22, 2016
  17. Ramsay JonesOct 23, 2016
  18. Stefan BellerOct 24, 2016
  19. Stefan BellerOct 27, 2016
  20. attr: expose error reporting function for invalid attribute namesStefan Beller, Oct 26, 2016
  21. 18/36 attr: support quoting pathname patterns in C styleStefan Beller, Oct 22, 2016
  22. 19/36 attr.c: add push_stack() helperStefan Beller, Oct 22, 2016
  23. 21/36 attr.c: rename a local variable checkStefan Beller, Oct 22, 2016
  24. 15/36 attr: add counted string version of git_check_attr()Stefan Beller, Oct 22, 2016
  25. 22/36 attr.c: correct ugly hack for git_all_attrs()Stefan Beller, Oct 22, 2016
  26. 23/36 attr.c: introduce empty_attr_check_elems()Stefan Beller, Oct 22, 2016
  27. 20/36 attr.c: pass struct git_attr_check down the callchainStefan Beller, Oct 22, 2016
  28. 27/36 attr: convert to new threadsafe APIStefan Beller, Oct 22, 2016
  29. Junio C HamanoOct 24, 2016
  30. Stefan BellerOct 24, 2016
  31. Duy NguyenOct 26, 2016
  32. Johannes SchindelinOct 26, 2016
  33. Simon RuderichOct 26, 2016
  34. Jeff KingOct 26, 2016
  35. Stefan BellerOct 26, 2016
  36. Jeff KingOct 26, 2016
  37. Johannes SixtOct 26, 2016
  38. Jeff KingOct 26, 2016
  39. Johannes SixtOct 26, 2016
  40. Stefan BellerOct 26, 2016
  41. 1/2 attr: convert to new threadsafe APIStefan Beller, Oct 26, 2016
  42. Junio C HamanoOct 26, 2016
  43. Stefan BellerOct 27, 2016
  44. Junio C HamanoOct 27, 2016
  45. Stefan BellerOct 27, 2016
  46. Junio C HamanoOct 27, 2016
  47. Junio C HamanoOct 27, 2016
  48. Stefan BellerOct 27, 2016
  49. Junio C HamanoOct 27, 2016
  50. Junio C HamanoOct 27, 2016
  51. attr: convert to new threadsafe APIStefan Beller, Oct 27, 2016
  52. Johannes SchindelinOct 28, 2016
  53. Junio C HamanoOct 28, 2016
  54. Junio C HamanoOct 28, 2016
  55. Johannes SixtOct 28, 2016
  56. Stefan BellerOct 26, 2016
  57. Duy NguyenOct 26, 2016
  58. 26/36 attr: make git_check_attr_counted staticStefan Beller, Oct 22, 2016
  59. 30/36 pathspec: move long magic parsing out of prefix_pathspecStefan Beller, Oct 22, 2016
  60. 31/36 pathspec: move prefix check out of the inner loopStefan Beller, Oct 22, 2016
  61. 29/36 Documentation: fix a typoStefan Beller, Oct 22, 2016
  62. 28/36 attr: keep attr stack for each checkStefan Beller, Oct 22, 2016
  63. Ramsay JonesOct 23, 2016
  64. Stefan BellerOct 26, 2016
  65. Junio C HamanoOct 24, 2016
  66. Stefan BellerOct 24, 2016
  67. Junio C HamanoOct 24, 2016
  68. 25/36 attr.c: outline the future plans by heavily commentingStefan Beller, Oct 22, 2016
  69. 24/36 attr.c: always pass check[] to collect_some_attrs()Stefan Beller, Oct 22, 2016
  70. 36/36 completion: clone can initialize specific submodulesStefan Beller, Oct 22, 2016
  71. 35/36 clone: add --init-submodule=<pathspec> switchStefan Beller, Oct 22, 2016
  72. 34/36 submodule update: add `--init-default-path` switchStefan Beller, Oct 22, 2016
  73. 33/36 pathspec: allow escaped query valuesStefan Beller, Oct 22, 2016
  74. 32/36 pathspec: allow querying for attributesStefan Beller, Oct 22, 2016
  75. Duy NguyenOct 26, 2016
  76. Stefan BellerOct 27, 2016
  77. Junio C HamanoOct 27, 2016
  78. Duy NguyenNov 9, 2016
  79. Stefan BellerNov 9, 2016
  80. Junio C HamanoNov 9, 2016
  81. 13/36 attr: convert git_check_attrs() callers to use the new APIStefan Beller, Oct 22, 2016

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.