Skip to content

Commit

Permalink
fixup! reftable: write correct max_update_index to header
Browse files Browse the repository at this point in the history
The original commit was missing some initializations. This lead to the
somewhat intuitive (and not reliably reproducible, until the trick was
found to use `sanitize=address,undefined`) symptom that t1400.249 and/or
t2400.171 failed with:

  Assertion failed: (ret != REFTABLE_API_ERROR), function
  reftable_be_transaction_finish, file reftable-backend.c, line 1648.

or

  Assertion failed: (ret != REFTABLE_API_ERROR), function
  write_transaction_table, file reftable-backend.c, line 1619.

Signed-off-by: Karthik Nayak <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
KarthikNayak authored and dscho committed Jan 23, 2025
1 parent 14ed4ad commit 290ad15
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions refs/reftable-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
arg->updates_nr = 0;
arg->updates_alloc = 0;
arg->updates_expected = 0;
arg->max_index = 0;
}

arg->updates_expected++;
Expand Down Expand Up @@ -1634,6 +1635,8 @@ static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED,
tx_data->args->max_index = transaction->max_index;

for (size_t i = 0; i < tx_data->args_nr; i++) {
tx_data->args[i].max_index = transaction->max_index;

ret = reftable_addition_add(tx_data->args[i].addition,
write_transaction_table, &tx_data->args[i]);
if (ret < 0)
Expand Down

0 comments on commit 290ad15

Please sign in to comment.