[PATCHv3 0/6] Fix bug in large transactions
- From
Stefan Beller <sbeller@google.com>
- Date
- Jan 23, 2015, 20:03 UTC
- Message-ID
- <1422043442-30676-1-git-send-email-sbeller@google.com>
- In-Reply-To
- <54C0E76D.5070104@alum.mit.edu>
version3:
patches 1,2,3 stayed completely as is, while patches 4,5 are new, patch 6 is
rewritten to first write the contents of the lock files before closing them.
This combines the series "Enable large transactions v2" as sent out yesterday
with the follow up series "[RFC PATCH 0/5] So you dislike the sequence of
system calls?"
There is no write_in_full_to_lock_file wrapper any more, but write_ref_sha1
was reduced in functionality in patch 5.
This applies on top of origin/sb/atomic-push and results in a merge conflict
when merging it to origin/jk/lock-ref-sha1-basic-return-errors which looks like
$git checkout origin/jk/lock-ref-sha1-basic-return-errors
$git merge enable_large_transactions
CONFLICT (content): Merge conflict in refs.c
$git diff
++<<<<<<< HEAD
+ lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, lflags);
+ if (lock->lock_fd < 0) {
++=======
+ if (hold_lock_file_for_update(lock->lk, ref_file, lflags) < 0) {
++>>>>>>> enable_large_transactionswhich is best resolved as:
@@@ -2316,8 -2333,7 +2333,12 @@@ static struct ref_lock *lock_ref_sha1_b
goto error_return;
}
+ if (hold_lock_file_for_update(lock->lk, ref_file, lflags) < 0) {
last_errno = errno;
if (errno == ENOENT && --attempts_remaining > 0)
/*version2:
* This applies on top of origin/sb/atomic-push though it will result in a one line merge conflict with origin/jk/lock-ref-sha1-basic-return-errors when merging to origin/next.
* It now uses the FILE* pointer instead of file descriptors. This results in a combination of the 2 former patches "refs.c: have a write_in_full_to_lock_file wrapper" and "refs.c: write to a lock file only once" as the wrapper function is more adapted to its consumers
* no need to dance around with char *pointers which may leak.
* another new patch sneaked into the series: Renaming ULIMIT in t7004 to ULIMIT_STACK_SIZE
That said, only the first and third patch are updated from the first version of the patches. The others are new in the sense that rewriting them was cheaper than keeping notes in between.
version1:
(reported as: git update-ref --stdin : too many open files, 2014-12-20)
First a test case is introduced to demonstrate the failure, the patches 2-6 are little refactoring and the last patch fixes the bug and also marks the bugs as resolved in the test suite.
Unfortunately this applies on top of origin/next.
Any feedback would be welcome!
Thanks, Stefan
Stefan Beller (6): update-ref: test handling large transactions properly t7004: rename ULIMIT test prerequisite to ULIMIT_STACK_SIZE refs.c: remove lock_fd from struct ref_lock refs.c: move static functions to close and commit refs refs.c: remove unlock_ref and commit_ref from write_ref_sha1 refs.c: enable large transactions
refs.c | 93 +++++++++++++++++++++++++++------------------------ t/t1400-update-ref.sh | 28 ++++++++++++++++ t/t7004-tag.sh | 4 +-- 3 files changed, 79 insertions(+), 46 deletions(-)
-- 2.2.1.62.g3f15098