mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
disable the lock validity check on Windows
Summary: On Windows, skip the check that tests if our lock file is still valid. This check did not work properly, as the `st_dev` and `st_ino` fields reported by stat() are not reliable. The `st_dev` value reported could sometimes change, causing EdenFS to incorrectly think the lock file was no longer valid and then quit. This check isn't really necessary on Windows, since Windows prevents the lock file from being removed while we have it open. Reviewed By: pkaush Differential Revision: D20875410 fbshipit-source-id: d607a9b89bd018bb6aacfd4b58cb9ba7e9bf94b8
This commit is contained in:
parent
1591c85852
commit
81130f736f
@ -486,9 +486,13 @@ void EdenServer::updatePeriodicTaskIntervals(const EdenConfig& config) {
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
config.configReloadInterval.getValue()));
|
||||
|
||||
// The checkValidityTask_ isn't really needed on Windows, since the lock file
|
||||
// cannot be removed while we are holding it.
|
||||
#ifndef _WIN32
|
||||
checkValidityTask_.updateInterval(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
config.checkValidityInterval.getValue()));
|
||||
#endif
|
||||
|
||||
localStoreTask_.updateInterval(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
|
@ -66,6 +66,14 @@ bool EdenStateDir::isLockValid() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The st_dev and st_ino fields aren't valid on Windows, so skip the check
|
||||
// to see if the lock file is still valid. Assume that if we acquired it
|
||||
// initially it is still valid.
|
||||
//
|
||||
// Windows generally makes it harder for users to delete or rename the
|
||||
// directory out from under an existing process while we have file handles
|
||||
// open, so this check isn't really as necessary.
|
||||
#ifndef _WIN32
|
||||
struct stat st;
|
||||
int rc = stat(lockPath_.c_str(), &st);
|
||||
if (rc != 0) {
|
||||
@ -83,6 +91,7 @@ bool EdenStateDir::isLockValid() const {
|
||||
"file has been replaced";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user