git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Karthik Nayak <karthik.188@gmail.com>,
	Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 00/11] reftable: expose write options as config
Date: Fri, 10 May 2024 12:29:16 +0200	[thread overview]
Message-ID: <cover.1715336797.git.ps@pks.im> (raw)
In-Reply-To: <cover.1714630191.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 7119 bytes --]

Hi,

this is the second version of my patch series that exposes various
options of the reftable writer via Git configuration.

Changes compared to v1:

  - Drop unneeded return statements.

  - Move default geometric factor into "constants.h".

  - Fix a typo in a commit message.

Thanks!

Patrick

Patrick Steinhardt (11):
  reftable: consistently refer to `reftable_write_options` as `opts`
  reftable: consistently pass write opts as value
  reftable/writer: drop static variable used to initialize strbuf
  reftable/writer: improve error when passed an invalid block size
  reftable/dump: support dumping a table's block structure
  refs/reftable: allow configuring block size
  reftable: use `uint16_t` to track restart interval
  refs/reftable: allow configuring restart interval
  refs/reftable: allow disabling writing the object index
  reftable: make the compaction factor configurable
  refs/reftable: allow configuring geometric factor

 Documentation/config.txt          |   2 +
 Documentation/config/reftable.txt |  49 +++++
 refs/reftable-backend.c           |  43 ++++-
 reftable/block.h                  |   2 +-
 reftable/constants.h              |   1 +
 reftable/dump.c                   |  12 +-
 reftable/merged_test.c            |   6 +-
 reftable/reader.c                 |  63 +++++++
 reftable/readwrite_test.c         |  26 +--
 reftable/refname_test.c           |   2 +-
 reftable/reftable-reader.h        |   2 +
 reftable/reftable-stack.h         |   2 +-
 reftable/reftable-writer.h        |  10 +-
 reftable/stack.c                  |  57 +++---
 reftable/stack.h                  |   5 +-
 reftable/stack_test.c             | 118 ++++++------
 reftable/writer.c                 |  20 +--
 t/t0613-reftable-write-options.sh | 286 ++++++++++++++++++++++++++++++
 18 files changed, 576 insertions(+), 130 deletions(-)
 create mode 100644 Documentation/config/reftable.txt
 create mode 100755 t/t0613-reftable-write-options.sh

Range-diff against v1:
 1:  47cee6e25e =  1:  7efa566306 reftable: consistently refer to `reftable_write_options` as `opts`
 2:  d8a0764e87 =  2:  e6f8fc09c2 reftable: consistently pass write opts as value
 3:  c040f81fba =  3:  aa2903e3e5 reftable/writer: drop static variable used to initialize strbuf
 4:  ef79bb1b7b =  4:  5e7cbb7b19 reftable/writer: improve error when passed an invalid block size
 5:  4d4407d4a4 =  5:  ed1c150d90 reftable/dump: support dumping a table's block structure
 6:  b4e4db5735 !  6:  be5bdc6dc1 refs/reftable: allow configuring block size
    @@ refs/reftable-backend.c: static int read_ref_without_reload(struct reftable_stac
     +		if (block_size > 16777215)
     +			die("reftable block size cannot exceed 16MB");
     +		opts->block_size = block_size;
    -+		return 0;
     +	}
     +
     +	return 0;
 7:  79d9e07ca9 =  7:  05e8d1df2d reftable: use `uint16_t` to track restart interval
 8:  653ec4dfa5 !  8:  bc0bf65553 refs/reftable: allow configuring restart interval
    @@ Documentation/config/reftable.txt: readers during access.
     
      ## refs/reftable-backend.c ##
     @@ refs/reftable-backend.c: static int reftable_be_config(const char *var, const char *value,
    + 		if (block_size > 16777215)
      			die("reftable block size cannot exceed 16MB");
      		opts->block_size = block_size;
    - 		return 0;
     +	} else if (!strcmp(var, "reftable.restartinterval")) {
     +		unsigned long restart_interval = git_config_ulong(var, value, ctx->kvi);
     +		if (restart_interval > UINT16_MAX)
     +			die("reftable block size cannot exceed %u", (unsigned)UINT16_MAX);
     +		opts->restart_interval = restart_interval;
    -+		return 0;
      	}
      
      	return 0;
 9:  6f2c481acc !  9:  6bc240fd0c refs/reftable: allow disabling writing the object index
    @@ Documentation/config/reftable.txt: A maximum of `65535` restart points per block
     
      ## refs/reftable-backend.c ##
     @@ refs/reftable-backend.c: static int reftable_be_config(const char *var, const char *value,
    + 		if (restart_interval > UINT16_MAX)
      			die("reftable block size cannot exceed %u", (unsigned)UINT16_MAX);
      		opts->restart_interval = restart_interval;
    - 		return 0;
     +	} else if (!strcmp(var, "reftable.indexobjects")) {
     +		opts->skip_index_objects = !git_config_bool(var, value);
    -+		return 0;
      	}
      
      	return 0;
10:  30e2e33479 ! 10:  9d4c1f0340 reftable: make the compaction factor configurable
    @@ Commit message
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    + ## reftable/constants.h ##
    +@@ reftable/constants.h: license that can be found in the LICENSE file or at
    + 
    + #define MAX_RESTARTS ((1 << 16) - 1)
    + #define DEFAULT_BLOCK_SIZE 4096
    ++#define DEFAULT_GEOMETRIC_FACTOR 2
    + 
    + #endif
    +
      ## reftable/reftable-writer.h ##
     @@ reftable/reftable-writer.h: struct reftable_write_options {
      
    @@ reftable/reftable-writer.h: struct reftable_write_options {
      /* reftable_block_stats holds statistics for a single block type */
     
      ## reftable/stack.c ##
    +@@ reftable/stack.c: license that can be found in the LICENSE file or at
    + 
    + #include "../write-or-die.h"
    + #include "system.h"
    ++#include "constants.h"
    + #include "merged.h"
    + #include "reader.h"
    + #include "refname.h"
     @@ reftable/stack.c: static int segment_size(struct segment *s)
      	return s->end - s->start;
      }
    @@ reftable/stack.c: static int segment_size(struct segment *s)
      	size_t i;
      
     +	if (!factor)
    -+		factor = 2;
    ++		factor = DEFAULT_GEOMETRIC_FACTOR;
     +
      	/*
      	 * If there are no tables or only a single one then we don't have to
11:  861f2e72d9 ! 11:  e1282e53fb refs/reftable: allow configuring geometric factor
    @@ Documentation/config/reftable.txt: reftable.indexObjects::
      The default value is `true`.
     +
     +reftable.geometricFactor::
    -+	Whenever the reftable backend appends a new table to the table it
    ++	Whenever the reftable backend appends a new table to the stack, it
     +	performs auto compaction to ensure that there is only a handful of
     +	tables. The backend does this by ensuring that tables form a geometric
     +	sequence regarding the respective sizes of each table.
    @@ Documentation/config/reftable.txt: reftable.indexObjects::
     
      ## refs/reftable-backend.c ##
     @@ refs/reftable-backend.c: static int reftable_be_config(const char *var, const char *value,
    + 		opts->restart_interval = restart_interval;
      	} else if (!strcmp(var, "reftable.indexobjects")) {
      		opts->skip_index_objects = !git_config_bool(var, value);
    - 		return 0;
     +	} else if (!strcmp(var, "reftable.geometricfactor")) {
     +		unsigned long factor = git_config_ulong(var, value, ctx->kvi);
     +		if (factor > UINT8_MAX)

base-commit: d4cc1ec35f3bcce816b69986ca41943f6ce21377
-- 
2.45.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2024-05-10 10:29 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  6:51 [PATCH 00/11] reftable: expose write options as config Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 01/11] reftable: consistently refer to `reftable_write_options` as `opts` Patrick Steinhardt
2024-05-10  9:00   ` Karthik Nayak
2024-05-10 10:13     ` Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 02/11] reftable: consistently pass write opts as value Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 03/11] reftable/writer: drop static variable used to initialize strbuf Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 04/11] reftable/writer: improve error when passed an invalid block size Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 05/11] reftable/dump: support dumping a table's block structure Patrick Steinhardt
2024-05-02  6:51 ` [PATCH 06/11] refs/reftable: allow configuring block size Patrick Steinhardt
2024-05-10  9:29   ` Karthik Nayak
2024-05-10 10:13     ` Patrick Steinhardt
2024-05-02  6:52 ` [PATCH 07/11] reftable: use `uint16_t` to track restart interval Patrick Steinhardt
2024-05-02  6:52 ` [PATCH 08/11] refs/reftable: allow configuring " Patrick Steinhardt
2024-05-02  6:52 ` [PATCH 09/11] refs/reftable: allow disabling writing the object index Patrick Steinhardt
2024-05-02  6:52 ` [PATCH 10/11] reftable: make the compaction factor configurable Patrick Steinhardt
2024-05-10  9:55   ` Karthik Nayak
2024-05-10 10:13     ` Patrick Steinhardt
2024-05-02  6:52 ` [PATCH 11/11] refs/reftable: allow configuring geometric factor Patrick Steinhardt
2024-05-10  9:58   ` Karthik Nayak
2024-05-10 10:13     ` Patrick Steinhardt
2024-05-02  7:29 ` [PATCH 00/11] reftable: expose write options as config Patrick Steinhardt
2024-05-03 20:38   ` Junio C Hamano
2024-05-06  6:51     ` Patrick Steinhardt
2024-05-06 21:29 ` Justin Tobler
2024-05-10 10:00 ` Karthik Nayak
2024-05-10 10:14   ` Patrick Steinhardt
2024-05-10 10:29 ` Patrick Steinhardt [this message]
2024-05-10 10:29   ` [PATCH v2 01/11] reftable: consistently refer to `reftable_write_options` as `opts` Patrick Steinhardt
2024-05-10 21:03     ` Junio C Hamano
2024-05-10 10:29   ` [PATCH v2 02/11] reftable: consistently pass write opts as value Patrick Steinhardt
2024-05-10 21:11     ` Junio C Hamano
2024-05-13  7:53       ` Patrick Steinhardt
2024-05-10 10:29   ` [PATCH v2 03/11] reftable/writer: drop static variable used to initialize strbuf Patrick Steinhardt
2024-05-10 21:19     ` Junio C Hamano
2024-05-10 10:29   ` [PATCH v2 04/11] reftable/writer: improve error when passed an invalid block size Patrick Steinhardt
2024-05-10 21:25     ` Junio C Hamano
2024-05-13  7:53       ` Patrick Steinhardt
2024-05-10 10:29   ` [PATCH v2 05/11] reftable/dump: support dumping a table's block structure Patrick Steinhardt
2024-05-13 22:42     ` Junio C Hamano
2024-05-10 10:29   ` [PATCH v2 06/11] refs/reftable: allow configuring block size Patrick Steinhardt
2024-05-10 10:29   ` [PATCH v2 07/11] reftable: use `uint16_t` to track restart interval Patrick Steinhardt
2024-05-13 22:42     ` Junio C Hamano
2024-05-14  4:54       ` Patrick Steinhardt
2024-05-10 10:29   ` [PATCH v2 08/11] refs/reftable: allow configuring " Patrick Steinhardt
2024-05-10 21:57     ` Junio C Hamano
2024-05-13  7:54       ` Patrick Steinhardt
2024-05-10 10:30   ` [PATCH v2 09/11] refs/reftable: allow disabling writing the object index Patrick Steinhardt
2024-05-10 10:30   ` [PATCH v2 10/11] reftable: make the compaction factor configurable Patrick Steinhardt
2024-05-10 22:12     ` Junio C Hamano
2024-05-13  7:54       ` Patrick Steinhardt
2024-05-13 16:22         ` Junio C Hamano
2024-05-14  4:54           ` Patrick Steinhardt
2024-05-10 10:30   ` [PATCH v2 11/11] refs/reftable: allow configuring geometric factor Patrick Steinhardt
2024-05-10 11:43   ` [PATCH v2 00/11] reftable: expose write options as config Karthik Nayak
2024-05-13  8:17 ` [PATCH v3 " Patrick Steinhardt
2024-05-13  8:17   ` [PATCH v3 01/11] reftable: consistently refer to `reftable_write_options` as `opts` Patrick Steinhardt
2024-05-13  8:17   ` [PATCH v3 02/11] reftable: pass opts as constant pointer Patrick Steinhardt
2024-05-17  8:02     ` Karthik Nayak
2024-05-13  8:18   ` [PATCH v3 03/11] reftable/writer: drop static variable used to initialize strbuf Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 04/11] reftable/writer: improve error when passed an invalid block size Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 05/11] reftable/dump: support dumping a table's block structure Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 06/11] refs/reftable: allow configuring block size Patrick Steinhardt
2024-05-17  8:09     ` Karthik Nayak
2024-05-13  8:18   ` [PATCH v3 07/11] reftable: use `uint16_t` to track restart interval Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 08/11] refs/reftable: allow configuring " Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 09/11] refs/reftable: allow disabling writing the object index Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 10/11] reftable: make the compaction factor configurable Patrick Steinhardt
2024-05-13  8:18   ` [PATCH v3 11/11] refs/reftable: allow configuring geometric factor Patrick Steinhardt
2024-05-17  8:14   ` [PATCH v3 00/11] reftable: expose write options as config Karthik Nayak
2024-05-17  8:26     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1715336797.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).