Re: [PATCH v3 13/13] midx: implement writing incremental MIDX bitmaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 19, 2024 at 05:07:56PM -0500, Taylor Blau wrote:
> diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
> index 49758e2525f..1fbebe84479 100644
> --- a/pack-bitmap-write.c
> +++ b/pack-bitmap-write.c
> @@ -25,6 +25,8 @@
>  #include "alloc.h"
>  #include "refs.h"
>  #include "strmap.h"
> +#include "midx.h"
> +#include "pack-revindex.h"

Nit: let's keep the headers sorted alphabetically.

> @@ -206,19 +215,37 @@ void bitmap_writer_push_commit(struct bitmap_writer *writer,
>  static uint32_t find_object_pos(struct bitmap_writer *writer,
>  				const struct object_id *oid, int *found)
>  {
> -	struct object_entry *entry = packlist_find(writer->to_pack, oid);
> +	struct object_entry *entry;
> +
> +	entry = packlist_find(writer->to_pack, oid);
> +	if (entry) {
> +		uint32_t base_objects = 0;
> +		if (writer->midx)
> +			base_objects = writer->midx->num_objects +
> +				writer->midx->num_objects_in_base;
> +
> +		if (found)
> +			*found = 1;
> +		return oe_in_pack_pos(writer->to_pack, entry) + base_objects;
> +	} else if (writer->midx) {
> +		uint32_t at, pos;
> +
> +		if (!bsearch_midx(oid, writer->midx, &at))
> +			goto missing;
> +		if (midx_to_pack_pos(writer->midx, at, &pos) < 0)
> +			goto missing;
>  
> -	if (!entry) {
>  		if (found)
> -			*found = 0;
> -		warning("Failed to write bitmap index. Packfile doesn't have full closure "
> -			"(object %s is missing)", oid_to_hex(oid));
> -		return 0;
> +			*found = 1;
> +		return pos;
>  	}
>  
> +missing:
>  	if (found)
> -		*found = 1;
> -	return oe_in_pack_pos(writer->to_pack, entry);
> +		*found = 0;
> +	warning("Failed to write bitmap index. Packfile doesn't have full closure "
> +		"(object %s is missing)", oid_to_hex(oid));

Is this warning still accurate? I assume that in the MIDX case we don't
have to have full closure in a single packfile, as that would otherwise
make the whole thing rather moot.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux