]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/stack: simplify tracking of table locks
authorPatrick Steinhardt <ps@pks.im>
Thu, 8 Aug 2024 14:06:39 +0000 (16:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Aug 2024 17:14:42 +0000 (10:14 -0700)
commit558f6fbeb1f194116231218b3e7496ceef4b9618
tree378c0cdbc17bddb6555ce881553cb2ace567354b
parent5f0ed603a1653f2394c468814bde4b0dca2cff45
reftable/stack: simplify tracking of table locks

When compacting tables, we store the locks of all tables we are about to
compact in the `table_locks` array. As we currently only ever compact
all tables in the user-provided range or none, we simply track those
locks via the indices of the respective tables in the merged stack.

This is about to change though, as we will introduce a mode where auto
compaction gracefully handles the case of already-locked files. In this
case, it may happen that we only compact a subset of the user-supplied
range of tables. In this case, the indices will not necessarily match
the lock indices anymore.

Refactor the code such that we track the number of locks via a separate
variable. The resulting code is expected to perform the same, but will
make it easier to perform the described change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/stack.c