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

Re: [PATCH v3 1/3] refs/reftable: introduce "reftable.lockTimeout"

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2024, 21:34 UTC
Message-ID
<xmqqmsk35nvu.fsf@gitster.g>
In-Reply-To
<77cffd3b1eb638e05c031e2949fdc9374d599e05.1726653185.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 7 quoted lines
> +reftable.lockTimeout::
> +	Whenever the reftable backend appends a new table to the stack, it has
> +	to lock the central "tables.list" file before updating it. This config
> +	controls how long the process will wait to acquire the lock in case
> +	another process has already acquired it. Value 0 means not to retry at
> +	all; -1 means to try indefinitely. Default is 100 (i.e., retry for
> +	100ms).

Existing timeout knobs are in a hierarchy that is too wide (i.e. core.*timeout) and this fixes the mistake by placing the name in a lot more appropriate name (i.e. reftable.*timeout). If I were designing the system from scratch, I would probably place all of them in "refs.*timeout", but I do not think it is worth extra engineering effort to rename them and pay the transition cost.

Show 15 quoted lines
> diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> index 1c4b19e737f..ca281e39a29 100644
> --- a/refs/reftable-backend.c
> +++ b/refs/reftable-backend.c
> @@ -256,6 +256,13 @@ static int reftable_be_config(const char *var, const char *value,
>  		if (factor > UINT8_MAX)
>  			die("reftable geometric factor cannot exceed %u", (unsigned)UINT8_MAX);
>  		opts->auto_compaction_factor = factor;
> +	} else if (!strcmp(var, "reftable.locktimeout")) {
> +		int64_t lock_timeout = git_config_int64(var, value, ctx->kvi);
> +		if (lock_timeout > LONG_MAX)
> +			die("reftable lock timeout cannot exceed %"PRIdMAX, (intmax_t)LONG_MAX);
> +		if (lock_timeout < 0 && lock_timeout != -1)
> +			die("reftable lock timeout does not support negative values other than -1");
> +		opts->lock_timeout_ms = lock_timeout;

Existing lock timeouts this models after seems to consider a platform native "int" is good enough size to represent the timeout value in milliseconds, but the eventual user of this value in the lockfile API expects a long, so lock_timeout_ms being long is fine.

Perhaps #leftoverbits to straighten out the types used for the other two timeout configuration variables.

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 22 of 42 in “reftable: graceful concurrent writes”
  1. 0/3 reftable: graceful concurrent writesPatrick Steinhardt, Sep 17, 2024
  2. 1/3 refs/reftable: introduce "reftable.lockTimeout"Patrick Steinhardt, Sep 17, 2024
  3. karthik nayakSep 17, 2024
  4. Eric SunshineSep 17, 2024
  5. Patrick SteinhardtSep 18, 2024
  6. Patrick SteinhardtSep 18, 2024
  7. 2/3 reftable/stack: allow locking of outdated stacksPatrick Steinhardt, Sep 17, 2024
  8. 3/3 refs/reftable: reload locked stack when preparing transactionPatrick Steinhardt, Sep 17, 2024
  9. karthik nayakSep 17, 2024
  10. Patrick SteinhardtSep 18, 2024
  11. 0/3 reftable: graceful concurrent writesPatrick Steinhardt, Sep 18, 2024
  12. 1/3 refs/reftable: introduce "reftable.lockTimeout"Patrick Steinhardt, Sep 18, 2024
  13. James LiuSep 18, 2024
  14. Patrick SteinhardtSep 18, 2024
  15. 2/3 reftable/stack: allow locking of outdated stacksPatrick Steinhardt, Sep 18, 2024
  16. James LiuSep 18, 2024
  17. Patrick SteinhardtSep 18, 2024
  18. 3/3 refs/reftable: reload locked stack when preparing transactionPatrick Steinhardt, Sep 18, 2024
  19. James LiuSep 18, 2024
  20. 0/3 reftable: graceful concurrent writesPatrick Steinhardt, Sep 18, 2024
  21. 1/3 refs/reftable: introduce "reftable.lockTimeout"Patrick Steinhardt, Sep 18, 2024
  22. Junio C HamanoSep 19, 2024
  23. 2/3 reftable/stack: allow locking of outdated stacksPatrick Steinhardt, Sep 18, 2024
  24. Junio C HamanoSep 20, 2024
  25. Patrick SteinhardtSep 24, 2024
  26. 3/3 refs/reftable: reload locked stack when preparing transactionPatrick Steinhardt, Sep 18, 2024
  27. James LiuSep 18, 2024
  28. Patrick SteinhardtSep 24, 2024
  29. 0/3 reftable: graceful concurrent writesPatrick Steinhardt, Sep 24, 2024
  30. 1/3 refs/reftable: introduce "reftable.lockTimeout"Patrick Steinhardt, Sep 24, 2024
  31. 2/3 reftable/stack: allow locking of outdated stacksPatrick Steinhardt, Sep 24, 2024
  32. 3/3 refs/reftable: reload locked stack when preparing transactionPatrick Steinhardt, Sep 24, 2024
  33. Jeff KingSep 27, 2024
  34. Patrick SteinhardtSep 30, 2024
  35. Josh SteadmonSep 30, 2024
  36. Patrick SteinhardtOct 1, 2024
  37. Jeff KingOct 1, 2024
  38. Junio C HamanoOct 1, 2024
  39. Patrick SteinhardtOct 2, 2024
  40. Junio C HamanoOct 1, 2024
  41. Josh SteadmonOct 1, 2024
  42. Jeff KingOct 1, 2024

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.