reftable/stack: gracefully handle failed auto-compaction due to locks
Whenever we commit a new table to the reftable stack we will end up invoking auto-compaction of the stack to keep the total number of tables at bay. This auto-compaction may fail though in case at least one of the tables which we are about to compact is locked. This is indicated by the compaction function returning `REFTABLE_LOCK_ERROR`. We do not handle this case though, and thus bubble that return value up the calling chain, which will ultimately cause a failure. Fix this bug by ignoring `REFTABLE_LOCK_ERROR`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
33358350eb
commit
a2f711ade0
@ -680,8 +680,19 @@ int reftable_addition_commit(struct reftable_addition *add)
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
if (!add->stack->disable_auto_compact)
|
||||
if (!add->stack->disable_auto_compact) {
|
||||
/*
|
||||
* Auto-compact the stack to keep the number of tables in
|
||||
* control. It is possible that a concurrent writer is already
|
||||
* trying to compact parts of the stack, which would lead to a
|
||||
* `REFTABLE_LOCK_ERROR` because parts of the stack are locked
|
||||
* already. This is a benign error though, so we ignore it.
|
||||
*/
|
||||
err = reftable_stack_auto_compact(add->stack);
|
||||
if (err < 0 && err != REFTABLE_LOCK_ERROR)
|
||||
goto done;
|
||||
err = 0;
|
||||
}
|
||||
|
||||
done:
|
||||
reftable_addition_close(add);
|
||||
|
||||
Reference in New Issue
Block a user