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

Skip to content

Enable nanosecond resolution by default #3655

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 4 commits into from
Mar 8, 2016

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented Mar 4, 2016

Nanosecond resolution is now the default in git itself. Enable this
as our default as well.

Nanosecond resolution is now the default in git itself.  Enable this
as our default as well.
@carlosmn
Copy link
Member

carlosmn commented Mar 7, 2016

The ones building "Release" fail... should we be worried this is a timing bug in the test suite or the library?

Edward Thomson added 2 commits March 7, 2016 09:37
Update unit test to use newfangled `st_ctime_nsec`, which provides
indirection to the platform-correct name.
If the underlying filesystem doesn't support better than one
second resolution, then don't expect that turning on `GIT_USE_NSEC`
does anything magical to change that.
@ethomson ethomson force-pushed the nanosecond_defaults branch 2 times, most recently from e09cba3 to a6cea96 Compare March 8, 2016 05:11
Instead of hoping that we can get a racy entry by going real fast
and praying real hard, just create a racy entry.
@ethomson ethomson force-pushed the nanosecond_defaults branch from a6cea96 to 53fb823 Compare March 8, 2016 05:49
@ethomson
Copy link
Member Author

ethomson commented Mar 8, 2016

Indeed it was a timing bug in the test suite. We were trusting that we could do a bunch of operations really quickly to get ourselves a racy entry in the index - which is complete horseshit buuuuut it also happens to be true on most filesystems because they have shit resolution.

Instead of doing stuff real fast and hoping that it works out, I twiddled the index's timestamp, so we now invent some raciness instead.

carlosmn added a commit that referenced this pull request Mar 8, 2016
Enable nanosecond resolution by default
@carlosmn carlosmn merged commit eeff96c into libgit2:master Mar 8, 2016
@hackhaslam
Copy link
Contributor

Changing the default regressed performance of things like status on Windows. I haven't delved too deeply, but it looks like maybe it breaks the attribute cache. Do you want me to add a new issue for this?

@ethomson
Copy link
Member Author

@hackhaslam Hmm. We haven't seen anything like this, and everything certainly seems normal to me. (Faster, in fact, since there's better resolution on some platforms.)

Please do open a new issue if you think that there's a problem, but please provide plenty of details. A broken index would be helpful, as would information about the client that created it and the client that is deciding that everything's dirty.

Is the slow client in question actually an old version of libgit2? Are you running into #3480 ?

@hackhaslam
Copy link
Contributor

No, it's not an old version. I'm using the tip of master. I will look more closely to see if I can provide some more details.

@hackhaslam
Copy link
Contributor

Okay, maybe I misunderstood your question. It turns out that the index (or at least the index of some rather large submodules) was written with an old version of git (1.8.4). After rebuilding the indexes of all of the submodules with a new version of git the problem goes away. So presumably, older versions of git wrote an index without nanosecond resolution and now I'm trying to compare it with stats of nanosecond resolution? Is there any way that I can detect this at runtime and only compare nanoseconds if the index has nanosecond resolution?

@ethomson
Copy link
Member Author

Aha. You didn't misunderstand, my first guess was incorrect. But that makes sense. We're quite obviously behaving incorrectly here, but at least it makes sense. :)

This is the opposite problem that we were stuck with when git itself turned on nanoseconds and we were unprepared. Now we're expecting nanoseconds always, it appears. What we should be doing here is detecting that the index doesn't have nanoseconds and falling back to non-nanosecond behavior. Looks like we're screwing that one up.

I'm afraid that I can't fix this today - but feel free to open an issue and I should be able to get to it later this week.

Thanks for the report!

@hackhaslam
Copy link
Contributor

Thanks! I added #3754.

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