Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Concurrent ref iterator access #2395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2014
Merged

Concurrent ref iterator access #2395

merged 2 commits into from
Jun 3, 2014

Conversation

carlosmn
Copy link
Member

@carlosmn carlosmn commented Jun 2, 2014

We may loose some packed refs by re-using the sortedcache, which may be reloaded at any time. With this, we isolate the iterator from outside changes (though only up to the point that the packed-refs can be snapshotted).

I think we should at least try to provide this kind of snapshotting in the iterator, and this also fixes what the test actually does, which is remove a ref from packing, where out offset gets out of sync with the actual contents.

Thoughts?

/cc @arrbee

carlosmn added 2 commits June 2, 2014 16:46
If we remove a reference while we're iterating through the packed refs,
the position in the iterator will be off.
This lets us work without worrying about what's happening but work on a
snapshot.
@joshaber
Copy link
Member

joshaber commented Jun 2, 2014

I'd love to see this.

@carlosmn
Copy link
Member Author

carlosmn commented Jun 3, 2014

The remote rename operation seems to suffer from the same bug, which is surfaced by libgit2/libgit2sharp#741

@arrbee
Copy link
Member

arrbee commented Jun 3, 2014

This seems like an acceptable short-term solution to this, but making a full copy of the sorted cache is pretty wasteful for the iterator's snapshot. The cache builds a hash table to index the entries, where the iterator just needs a simple array for sequential access.

@carlosmn
Copy link
Member Author

carlosmn commented Jun 3, 2014

Yeah, I agree it's wasteful, but at least it's correct. @Therzok has confirmed that this fixes the issue I mentioned, so I'd be inclined to merge this and then figuring out a less memory-intensive way of snapshotting.

@arrbee
Copy link
Member

arrbee commented Jun 3, 2014

Yes, I don't disagree. Sorry, I realize that "acceptable short-term solution" while positive in my mind, could mean "too many compromises to merge right now" which wasn't my intent.

arrbee added a commit that referenced this pull request Jun 3, 2014
@arrbee arrbee merged commit dfcba09 into development Jun 3, 2014
@nulltoken nulltoken deleted the cmn/ref-iter-concurrent branch June 4, 2014 07:13
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants