mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
A Scalable, User-Friendly Source Control System.
46bc847b23
Summary: Quick experimentation shows that existing lock file logic is not enoug for frequently run and killed Mercurial processes (Mercurial run by tools, such as Nuclide is an example of such scenario) I wrote the following two files: ``` c:\Code\tries\pythontries λ cat lockcreator.py import os, random def makelock(info, pathname): ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) os.write(ld, info) # os.fsync(ld) os.close(ld) name = os.path.join('locks', 'lock.pid' + str(os.getpid()) + ".rand" + str(random.randint(0, 10000))) makelock('contents', name) ``` and ``` c:\Code\tries\pythontries λ cat lockracer.py import os, subprocess, time, random for i in xrange(10000): proc = subprocess.Popen('python lockcreator.py') time.sleep(0.001*random.randint(0, 500)) proc.terminate() ``` After runnning `python lockracer.py`, I did `ls -l locks | grep "0 Apr"`, this way it showed all the 0-byte files created in April. This shows a non-empty output. Uncommenting the `os.fsync` line does not help much. Rewriting `lockcreator.py` to use temp lock file approach helps greatly. Reviewed By: quark-zju Differential Revision: D7653186 fbshipit-source-id: 48e9eeeca34075ea2ec78f3319491bcebc0e88c7 |
||
---|---|---|
.cargo | ||
contrib | ||
distutils_rust | ||
doc | ||
hgdemandimport | ||
hgext | ||
hgext3rd | ||
hgsubversion | ||
i18n | ||
lib | ||
lz4revlog | ||
mercurial | ||
tests | ||
.clang-format | ||
.editorconfig | ||
.flake8 | ||
.gitignore | ||
.hg-vendored-crates | ||
.hgsigs | ||
.jshintrc | ||
.watchmanconfig | ||
CONTRIBUTING | ||
CONTRIBUTORS | ||
COPYING | ||
hg | ||
hgeditor | ||
hgweb.cgi | ||
Makefile | ||
README.rst | ||
setup.py |
Mercurial ========= Mercurial is a fast, easy to use, distributed revision control tool for software developers. Basic install:: $ make # see install targets $ make install # do a system-wide install $ hg debuginstall # sanity-check setup $ hg # see help Running without installing:: $ make local # build for inplace usage $ ./hg --version # should show the latest version See https://mercurial-scm.org/ for detailed installation instructions, platform-specific notes, and Mercurial user information.