From: "Abhradeep Chakraborty via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Taylor Blau <me@ttaylorr.com>,
Kaartic Sivaram <kaartic.sivaraam@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Derrick Stolee <derrickstolee@github.com>,
Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>,
Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
Subject: [PATCH 4/5] roaring: introduce a new config option for roaring bitmaps
Date: Mon, 19 Sep 2022 17:47:38 +0000 [thread overview]
Message-ID: <683b0c625418278e4775978cb663edd03a113faa.1663609660.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1357.git.1663609659.gitgitgadget@gmail.com>
From: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
Though Git can write roaring bitmaps, there is still no way (e.g.
configurations) to control the writing of roaring bitmaps.
Introduce `pack.useroaringbitmap` option to control the writing of
roaring bitmaps.
Mentored-by: Taylor Blau <me@ttaylorr.com>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>
---
builtin/multi-pack-index.c | 5 +++++
builtin/pack-objects.c | 7 ++++++-
midx.c | 7 +++++++
midx.h | 1 +
pack-bitmap.h | 7 +++----
5 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 9b126d6ce0e..9e221dd7cc9 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -80,6 +80,11 @@ static struct option *add_common_options(struct option *prev)
static int git_multi_pack_index_write_config(const char *var, const char *value,
void *cb UNUSED)
{
+ if (!strcmp(var, "pack.useroaringbitmap")) {
+ if (git_config_bool(var, value))
+ opts.flags |= MIDX_WRITE_ROARING_BITMAP;
+ }
+
if (!strcmp(var, "pack.writebitmaphashcache")) {
if (git_config_bool(var, value))
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 3658c05cafc..439c5572c18 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -228,7 +228,7 @@ static enum {
WRITE_BITMAP_QUIET,
WRITE_BITMAP_TRUE,
} write_bitmap_index;
-static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
+static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE | BITMAP_SET_EWAH_BITMAP;
static int exclude_promisor_objects;
@@ -1258,6 +1258,7 @@ static void write_pack_file(void)
hash_to_hex(hash));
if (write_bitmap_index) {
+ bitmap_writer_init_bm_type(write_bitmap_options);
bitmap_writer_set_checksum(hash);
bitmap_writer_build_type_index(
&to_pack, written_list, nr_written);
@@ -3143,6 +3144,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
cache_max_small_delta_size = git_config_int(k, v);
return 0;
}
+ if (!strcmp(k, "pack.useroaringbitmap")) {
+ if (git_config_bool(k, v))
+ write_bitmap_options |= BITMAP_SET_ROARING_BITMAP;
+ }
if (!strcmp(k, "pack.writebitmaphashcache")) {
if (git_config_bool(k, v))
write_bitmap_options |= BITMAP_OPT_HASH_CACHE;
diff --git a/midx.c b/midx.c
index c27d0e5f151..b80db2239a8 100644
--- a/midx.c
+++ b/midx.c
@@ -1112,10 +1112,16 @@ static int write_midx_bitmap(const char *midx_name,
{
int ret, i;
uint16_t options = 0;
+ unsigned version = 0;
struct pack_idx_entry **index;
char *bitmap_name = xstrfmt("%s-%s.bitmap", midx_name,
hash_to_hex(midx_hash));
+ if (flags & MIDX_WRITE_ROARING_BITMAP)
+ version |= BITMAP_SET_ROARING_BITMAP;
+ else
+ version |= BITMAP_SET_EWAH_BITMAP;
+
if (flags & MIDX_WRITE_BITMAP_HASH_CACHE)
options |= BITMAP_OPT_HASH_CACHE;
@@ -1131,6 +1137,7 @@ static int write_midx_bitmap(const char *midx_name,
for (i = 0; i < pdata->nr_objects; i++)
index[i] = &pdata->objects[i].idx;
+ bitmap_writer_init_bm_type(version);
bitmap_writer_show_progress(flags & MIDX_PROGRESS);
bitmap_writer_build_type_index(pdata, index, pdata->nr_objects);
diff --git a/midx.h b/midx.h
index 5578cd7b835..c0b19b93c9c 100644
--- a/midx.h
+++ b/midx.h
@@ -48,6 +48,7 @@ struct multi_pack_index {
#define MIDX_WRITE_BITMAP (1 << 2)
#define MIDX_WRITE_BITMAP_HASH_CACHE (1 << 3)
#define MIDX_WRITE_BITMAP_LOOKUP_TABLE (1 << 4)
+#define MIDX_WRITE_ROARING_BITMAP (1 << 5)
const unsigned char *get_midx_checksum(struct multi_pack_index *m);
void get_midx_filename(struct strbuf *out, const char *object_dir);
diff --git a/pack-bitmap.h b/pack-bitmap.h
index 7d71deca023..6103e0d57e7 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -30,9 +30,6 @@ struct bitmap_disk_header {
#define NEEDS_BITMAP (1u<<22)
-#define BITMAP_SET_EWAH_BITMAP 0x1
-#define BITMAP_SET_ROARING_BITMAP (1 << 1)
-
/*
* The width in bytes of a single triplet in the lookup table
* extension:
@@ -44,7 +41,9 @@ struct bitmap_disk_header {
enum pack_bitmap_opts {
BITMAP_OPT_FULL_DAG = 0x1,
- BITMAP_OPT_HASH_CACHE = 0x4,
+ BITMAP_SET_EWAH_BITMAP = 0x2,
+ BITMAP_SET_ROARING_BITMAP = 0x4,
+ BITMAP_OPT_HASH_CACHE = 0x8,
BITMAP_OPT_LOOKUP_TABLE = 0x10,
};
--
gitgitgadget
next prev parent reply other threads:[~2022-09-19 17:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 17:47 [PATCH 0/5] [RFC] introduce Roaring bitmaps to Git Abhradeep Chakraborty via GitGitGadget
2022-09-19 17:47 ` [PATCH 1/5] reachability-bitmaps: add CRoaring library " Abhradeep Chakraborty via GitGitGadget
2022-09-19 17:47 ` [PATCH 2/5] roaring.[ch]: apply Git specific changes to the roaring API Abhradeep Chakraborty via GitGitGadget
2022-09-19 18:33 ` Derrick Stolee
2022-09-19 22:02 ` Junio C Hamano
2022-09-20 12:19 ` Derrick Stolee
2022-09-20 15:09 ` Abhradeep Chakraborty
2022-09-21 16:58 ` Junio C Hamano
2022-09-20 14:46 ` Abhradeep Chakraborty
2022-09-19 17:47 ` [PATCH 3/5] roaring: teach Git to write roaring bitmaps Abhradeep Chakraborty via GitGitGadget
2022-09-30 6:20 ` Junio C Hamano
2022-09-30 16:23 ` Abhradeep Chakraborty
2022-10-30 6:35 ` Abhradeep Chakraborty
2022-10-30 19:46 ` Derrick Stolee
2022-10-31 14:30 ` Abhradeep Chakraborty
2022-10-31 16:06 ` Junio C Hamano
2022-10-31 17:51 ` C99 -> C11 or C17? (was: [PATCH 3/5] roaring: teach Git to write roaring bitmaps) Ævar Arnfjörð Bjarmason
2022-10-31 20:55 ` rsbecker
2022-11-01 6:58 ` [PATCH 3/5] roaring: teach Git to write roaring bitmaps Abhradeep Chakraborty
2022-09-19 17:47 ` Abhradeep Chakraborty via GitGitGadget [this message]
2022-09-19 17:47 ` [PATCH 5/5] roaring: teach Git to read " Abhradeep Chakraborty via GitGitGadget
2022-09-19 18:18 ` [PATCH 0/5] [RFC] introduce Roaring bitmaps to Git Derrick Stolee
2022-09-20 14:05 ` Abhradeep Chakraborty
2022-09-20 21:59 ` Taylor Blau
2022-09-21 15:27 ` Abhradeep Chakraborty
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=683b0c625418278e4775978cb663edd03a113faa.1663609660.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=chakrabortyabhradeep79@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=me@ttaylorr.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).