Commit Graph

11 Commits

Author SHA1 Message Date
Durham Goode
148717dbde fastmanifest: fix some check code errors
Summary:
This fixes some (but not all) of the fastmanifest errors. The remaining ones are
from an import * and one that will require slightly more refactoring to fix.

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4055633

Signature: t1:4055633:1477050763:09e758b1bd72b18799cdabf510eb0b2332077833
2016-10-21 11:02:11 -07:00
Tony Tung
1060bda026 [fastmanifest] update comment to reflect the ugly truth
Test Plan: it's a comment

Reviewers: durham, mitrandir, rmcelroy, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3478159

Signature: t1:3478159:1466787557:90af1e7c952e3b1ecb4b9b07fbc5613ca7940f3a
2016-06-24 16:13:21 -07:00
Tony Tung
8ff74cf5be [fastmanifest] remove fork_worker
Summary:
Don't need it any more!!

Depends on D3468828

Test Plan: meh

Reviewers: durham, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3468848

Tasks: 11683504

Signature: t1:3468848:1466694940:c3a7190d064914a6b8ad24809aae7016bb3b8433
2016-06-23 13:41:46 -07:00
Tony Tung
da6102043b [fastmanifest] support for non-silent workers
Summary:
We want to be able to dump debugging output for the workers.

Depends on D3468818

Test Plan: used in later diffs.

Reviewers: durham, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D3468827

Tasks: 11683504

Signature: t1:3468827:1466695135:bb930ac6e34f3654a7006634c22dc99b3d2e75bf
2016-06-23 13:41:18 -07:00
Tony Tung
2eb056bf8e [fastmanifest] don't use shell=True
Test Plan: none

Reviewers: durham, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3468818

Tasks: 11683504

Signature: t1:3468818:1466695146:9bd98efec59fced0d99f712b7a1e4b855e6ae93e
2016-06-23 13:40:12 -07:00
Tony Tung
ac63bda69a [fastmanifest] copy runshellcommand from remotefilelog
Test Plan: NONE WHATSOEVER.

Reviewers: durham, lcharignon

Reviewed By: lcharignon

Subscribers: rmcelroy, quark, mitrandir, mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D3468816

Tasks: 11683504

Signature: t1:3468816:1466694675:7d5d08e0be9eae0e4b45662c637482d1f6de6ce1
2016-06-23 13:34:15 -07:00
Laurent Charignon
61ac581d66 fastmanifest: lint warning cleanup
Summary:
I ran flake8 and saw a bunch of things that we could fix to make the
code more succint and legible.

Test Plan: all tests pass

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3398906
2016-06-07 10:25:49 -07:00
Tony Tung
afea3e0312 [fastmanifest] non-silent worker processes should flush their output streams before dying
Summary: Noticed this while trying to debug something that since we call `_exit()`, we don't have the luxury of the standard flushing of output streams.  If we have a silent worker that doesn't output enough to trigger an automatic flush, we might leave things in the buffer.

Test Plan:
pass unit tests.

output something small after the fork via ui.log, and it is now flushed to console.

```
diff --git a/fastmanifest/cachemanager.py b/fastmanifest/cachemanager.py
--- a/fastmanifest/cachemanager.py
+++ b/fastmanifest/cachemanager.py
@@ -175,6 +175,9 @@
                 return
         cache = fastmanifestcache.getinstance(repo.store.opener, ui)

+        if background:
+            ui.debug("hi")
+
         computedrevs = scmutil.revrange(repo, revset)
         sortedrevs = sorted(computedrevs, key=lambda x:-x)
         if ui.configbool("fastmanifest", "randomorder", True):
diff --git a/tests/test-fastmanifest.t b/tests/test-fastmanifest.t
--- a/tests/test-fastmanifest.t
+++ b/tests/test-fastmanifest.t
@@ -24,6 +24,7 @@
   > [fastmanifest]
   > cachecutoffdays=-1
   > randomorder=False
+  > silentworker=False
   > EOF

   $ mkcommit a
@@ -52,7 +53,7 @@
   $ sleep 1
   $ hg debugcachemanifest -a --background
   $ hg debugcachemanifest -a --background
-  $ hg debugcachemanifest -a --background
+  $ hg debugcachemanifest -a --background --debug
   $ sleep 1
   $ hg debugcachemanifest --list
   fast7ab5760d084a24168f7595c38c00f4bbc2e308d9 (size 328 bytes)
```

With this change, we see the "hi".  Without this change, we do not see the "hi"

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3387112

Signature: t1:3387112:1464987504:dc44129afb36e27c84dd6d6e52db8d82533b4341
2016-06-03 17:04:23 -07:00
Tony Tung
a29ff60cec [fastmanifest] properly squelch output from worker processes
Summary: We don't want users to see scary exceptions or errors from worker processes.  They are unexpected and hard to deal with.

Test Plan: introduce syntax errors into the code.  run hg boo -d abc in repo with fastmanifest enabled.  saw no errors.  then ran the same command with --config=fastmanifest.silentworker=False and saw the error.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3357657

Signature: t1:3357657:1464365560:0cb101ab8a886f8e586a275bd91090331ad20982
2016-05-27 13:03:33 -07:00
Tony Tung
dd1a02c4cd [fastmanifest] move fork_worker to concurrency.py
Summary: I think it makes sense.

Test Plan: run unit tests

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3355211

Signature: t1:3355211:1464304354:fb04fcd1ed496da3a7f0a176c4bc04f4fc3711b3
2016-05-26 17:04:46 -07:00
Tony Tung
7503deb3a3 [fastmanifest] easily stealable locks
Summary: We want to wrap the fastmanifest cache priming code in a lock, but we want it to be easily stealable.  If the lock is more than X seconds in age, we just assume it's stale and steal it.  We remember that we stole it so we don't blow away the lock, but we do update the time of the lock so another process doesn't try to steal the lock.

Test Plan: write test to cover basic functionality (mutual exclusivity).  write test to cover stealing, and that only one thief is permitted at a time (subject to race conditions).

Reviewers: durham, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D3343478

Tasks: 11385124

Signature: t1:3343478:1464304447:18658ebea60f98bfda0f034414991ffd6c334ca7
2016-05-26 17:04:23 -07:00