midx: add progress indicators in multi-pack-index verify
Add progress indicators to more parts of midx verify. Use sparse progress indicator for object iteration. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d829223a42
commit
430efb8a74
28
midx.c
28
midx.c
@ -962,6 +962,18 @@ static void midx_report(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Limit calls to display_progress() for performance reasons.
|
||||
* The interval here was arbitrarily chosen.
|
||||
*/
|
||||
#define SPARSE_PROGRESS_INTERVAL (1 << 12)
|
||||
#define midx_display_sparse_progress(progress, n) \
|
||||
do { \
|
||||
uint64_t _n = (n); \
|
||||
if ((_n & (SPARSE_PROGRESS_INTERVAL - 1)) == 0) \
|
||||
display_progress(progress, _n); \
|
||||
} while (0)
|
||||
|
||||
int verify_midx_file(const char *object_dir)
|
||||
{
|
||||
uint32_t i;
|
||||
@ -972,10 +984,15 @@ int verify_midx_file(const char *object_dir)
|
||||
if (!m)
|
||||
return 0;
|
||||
|
||||
progress = start_progress(_("Looking for referenced packfiles"),
|
||||
m->num_packs);
|
||||
for (i = 0; i < m->num_packs; i++) {
|
||||
if (prepare_midx_pack(m, i))
|
||||
midx_report("failed to load pack in position %d", i);
|
||||
|
||||
display_progress(progress, i + 1);
|
||||
}
|
||||
stop_progress(&progress);
|
||||
|
||||
for (i = 0; i < 255; i++) {
|
||||
uint32_t oid_fanout1 = ntohl(m->chunk_oid_fanout[i]);
|
||||
@ -986,6 +1003,8 @@ int verify_midx_file(const char *object_dir)
|
||||
i, oid_fanout1, oid_fanout2, i + 1);
|
||||
}
|
||||
|
||||
progress = start_sparse_progress(_("Verifying OID order in MIDX"),
|
||||
m->num_objects - 1);
|
||||
for (i = 0; i < m->num_objects - 1; i++) {
|
||||
struct object_id oid1, oid2;
|
||||
|
||||
@ -995,9 +1014,12 @@ int verify_midx_file(const char *object_dir)
|
||||
if (oidcmp(&oid1, &oid2) >= 0)
|
||||
midx_report(_("oid lookup out of order: oid[%d] = %s >= %s = oid[%d]"),
|
||||
i, oid_to_hex(&oid1), oid_to_hex(&oid2), i + 1);
|
||||
}
|
||||
|
||||
progress = start_progress(_("Verifying object offsets"), m->num_objects);
|
||||
midx_display_sparse_progress(progress, i + 1);
|
||||
}
|
||||
stop_progress(&progress);
|
||||
|
||||
progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects);
|
||||
for (i = 0; i < m->num_objects; i++) {
|
||||
struct object_id oid;
|
||||
struct pack_entry e;
|
||||
@ -1023,7 +1045,7 @@ int verify_midx_file(const char *object_dir)
|
||||
midx_report(_("incorrect object offset for oid[%d] = %s: %"PRIx64" != %"PRIx64),
|
||||
i, oid_to_hex(&oid), m_offset, p_offset);
|
||||
|
||||
display_progress(progress, i + 1);
|
||||
midx_display_sparse_progress(progress, i + 1);
|
||||
}
|
||||
stop_progress(&progress);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user