midx: Add a way to write multi-pack-index files by lhchavez · Pull Request #5404 · libgit2/libgit2 · GitHub
Skip to content

midx: Add a way to write multi-pack-index files#5404

Merged
ethomson merged 3 commits into
libgit2:mainfrom
lhchavez:multi-pack-index-write
Aug 30, 2021
Merged

midx: Add a way to write multi-pack-index files#5404
ethomson merged 3 commits into
libgit2:mainfrom
lhchavez:multi-pack-index-write

Conversation

@lhchavez

@lhchavez lhchavez commented Feb 18, 2020

Copy link
Copy Markdown
Contributor

This change adds the git_midx_writer_* functions to allow to
write and create multi-pack-index files from .idx/.pack files.

Part of: #5399

@lhchavez lhchavez force-pushed the multi-pack-index-write branch 4 times, most recently from cf16115 to 9c99c4d Compare March 1, 2020 04:32
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 9c99c4d to 4cec6b3 Compare October 5, 2020 13:29
@lhchavez lhchavez changed the title multipack: Add a way to write multi-pack-index files midx: Add a way to write multi-pack-index files Oct 5, 2020
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 4cec6b3 to 263a714 Compare November 27, 2020 13:17
@ethomson

Copy link
Copy Markdown
Member

@lhchavez

lhchavez commented Dec 13, 2020

Copy link
Copy Markdown
Contributor Author

I'm surprised that we write the midx to a git_buf and then write the git_buf to disk. I expected us to not use an intermediate git_buf. How big is a midx file going to be?

as large as all the .pack files in a repo combined (my copy of linux' is 1G).

IIRC I did that for simplicity, but i can refactor things so that git_midx_writer_dump and git_midx_writer_commit both call the same function that creates the midx and call a write_cb(const char *buf, size_t size, void *payload) to avoid that extra in-memory copy.

@ethomson

Copy link
Copy Markdown
Member

IIRC I did that for simplicity, but i can refactor things so that git_midx_writer_dump and git_midx_writer_commit both call the same function that creates the midx and call a write_cb(const char *buf, size_t size, void *payload) to avoid that extra in-memory copy.

I think that would be nice if you could - I think that midx is going to be used in large repositories, so avoiding that malloc of a contiguous hunk of memory to store the data would be a win.

@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 263a714 to 2ea0ae4 Compare December 13, 2020 15:02
@lhchavez

Copy link
Copy Markdown
Contributor Author

Base automatically changed from master to main January 7, 2021 10:09
This change adds the git_midx_writer_* functions to allow to
write and create `multi-pack-index` files from `.idx`/`.pack` files.

Part of: libgit2#5399
@lhchavez lhchavez force-pushed the multi-pack-index-write branch from 2ea0ae4 to fff209c Compare July 27, 2021 01:49

@ethomson ethomson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a couple of questions and a couple of minor requests.

Comment thread src/midx.c
Comment thread src/pack.h Outdated
Comment thread src/pack.h Outdated
Comment thread src/pack.c Outdated
Comment thread src/midx.c Outdated
Comment thread src/midx.c Outdated
Comment thread src/midx.c Outdated
Comment thread src/pack.c
@ethomson ethomson merged commit 78cd762 into libgit2:main Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants