Commit Graph

35 Commits

Author SHA1 Message Date
Durham Goode
38da31b387 cstore: move python c struct headers out to a file
Summary:
A future patch will want to import just the cstore py headers into
py-ctreemanifest, so let's move those out to their own header file.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4571320:1487774077:64b4c5053b223f075a1c9f73ddcd92bd73b53e23
2017-02-23 14:03:04 -08:00
Durham Goode
b5b006fedd cstore: create base Store interface
Summary:
To begin the process of weaning treemanifest off of Python and on to the new
cstore, let's introduce a base Store class that implements a simple get()
function. UnionDatapackStore already implements this. Future patches will make a
Python version that implements this interface as well, so we can swap between
them easily.

Test Plan: Built and ran the tests.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4569870:1487846232:aa816311ec37a520a2405b68e3c02ad744613049
2017-02-23 14:03:03 -08:00
Durham Goode
767c10a592 cstore: implement UnionDatapackStore
Summary:
This adds a new C++ UnionDatapackStore implementation that only has the
getmissing() function at the moment.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556052:1487161607:664752df19c63c06819ee2af5b4c436f1b76609d
2017-02-23 14:03:03 -08:00
Durham Goode
4fd00d751a cstore: C++ implementation of datapackstore
Summary:
The remaining python parts of the store are a perf bottleneck when accessing
hundreds of thousands of pack file entries (like in treemanifest). Let's
implement them in C++.

This first patch just add the basic boiler plate, and implements a single
function getdeltachain(), with a test. Future patches will add more
functionality and other parts of the store.

Since cstore depends on cdatapack and ctreemanifest (the pythonutils.h part for
now), we need to tweak our setup.py to enforce a certain build order too.

Test Plan: Added a test, yo

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, stash, mjpieters

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

Signature: t1:4547929:1487181318:21c146cf370d26cb97efe6a883868b85b4e32f49
2017-02-23 14:03:03 -08:00
Durham Goode
2cd1eeb08e ctreemanifest: move treemanifest into cstore
Summary:
As part of unifying our native store data structures into a single library,
let's move the treemanifest (including the python extension) into py-cstore.

Test Plan:
Built and ran the tests. Verified there was no ctreemanifest.so
dependency in the built cstore.so by using 'ldd cstore.so' on Linux and 'otools
-L cstore.so' on OSX.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4602484:1487842683:964cbb43b7cb20d0db699ef691fe7fcf6bccf2e8
2017-02-23 14:03:03 -08:00
Durham Goode
e1b1c470e6 cstore: move py-cdatapack to be part of py-cstore
Summary:
As part of unifying our storage layer into a single library, let's move
py-cdatapack into the new cstore directory. Future patches will move
ctreemanifest and the upcoming datapackstore into here as well.

py-cdatapack.h required some reordering since it seems forward declarations work
a little differently between C and C++. There were no code changes though,
except one int->size_t fix.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4581320:1487788968:e8a34c7a03a16db282214c7dd476b749b92a1bfa
2017-02-23 14:03:02 -08:00
Durham Goode
a808c980f0 Backed out changeset c84de4b54530
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
f797211a24 Backed out changeset 7f46fb9d639b
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
9c206a743f cstore: implement UnionDatapackStore
Summary:
This adds a new C++ UnionDatapackStore implementation that only has the
getmissing() function at the moment.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556052:1487161607:664752df19c63c06819ee2af5b4c436f1b76609d
2017-02-15 15:19:36 -08:00
Durham Goode
41486c3f47 cstore: C++ implementation of datapackstore
Summary:
The remaining python parts of the store are a perf bottleneck when accessing
hundreds of thousands of pack file entries (like in treemanifest). Let's
implement them in C++.

This first patch just add the basic boiler plate, and implements a single
function getdeltachain(), with a test. Future patches will add more
functionality and other parts of the store.

Since cstore depends on cdatapack and ctreemanifest (the pythonutils.h part for
now), we need to tweak our setup.py to enforce a certain build order too.

Test Plan: Added a test, yo

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, stash, mjpieters

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

Signature: t1:4547929:1487181318:21c146cf370d26cb97efe6a883868b85b4e32f49
2017-02-15 15:19:36 -08:00
Adam Simpkins
0dab1ab662 unittests: fix tests that run hg in the main repository
Summary:
All of the test-check*.t tests cd out of the test repository and into the main
normal fb-hgext repository, and attempt to run hg commands there to examine the
repository contents.  Unfortunately they were doing so still using the HGRCPATH
settings configured for the test repository.  In practice this causes the tests
in many situations, because extensions enabled in the system configuration and
required for the main repository may not have been enabled.

Test Plan:
Ran "arc unit" in a repository with sqldirstate enabled and confirmed the tests
pass now instead of bombing out with screenfuls of error messages.

Reviewers: #sourcecontrol, stash, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, net-systems-diffs@, yogeshwer, mjpieters

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

Signature: t1:4427670:1484733701:f6c859c29d34eb33b1280e798ab3398a03a3a461
2017-01-18 12:00:54 -08:00
Durham Goode
dcc5006448 check: update check code override
For some reason the .cpp files now show up. They should probably be ignored,
same as the .hg files already are.
2016-11-16 13:51:48 -08:00
Jun Wu
781aea8725 arc: do not run lint on unrelated files
Summary:
"arc lint" runs the lint script for each file in parallel:

  >>> [5, pid=27257] <exec> $ scripts/lint.py 'scripts/lint.py'
  >>> [6, pid=27257] <exec> $ scripts/lint.py 'scripts/unit.py'
  >>> [7, pid=27257] <exec> $ scripts/lint.py 'tests/test-check-code-hg.t'
  >>> [8, pid=27257] <exec> $ scripts/lint.py 'tests/test-check-pyflakes-hg.t'

That looks fine but `lint.py` runs `test-check*.t` which will check all
files. This is a typical `N^2` behavior and needs to be fixed.

This diff changes the linter and test code so the test only checks the
single selected file.

Test Plan:
Run `arc lint --trace` and check `lint.py` time usage. It went down from
10 seconds to 2 seconds for this diff.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4051080:1476985355:45845c6eb0e66cbfa000e61b7b496f2d00aeb042
2016-10-20 15:44:29 +01:00
Durham Goode
50d6b599f4 Move ctreemanifest and cdatapack out of remotefilelog
These don't really have any dependencies on remotefilelog, so let's move them
out.
2016-09-21 13:55:12 -07:00
Tony Tung
e73e3e82b2 [check-code] remove reference to file that has since been removed
Test Plan: pass check code

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Signature: t1:3789049:1472521405:db4d224b1bbaab74ee5440403f59e7ed23cf65d6
2016-08-29 21:53:51 -07:00
Tony Tung
2b3e7ac198 port upgrades of buffer.h into clib
Summary:
buffer.h gained the ability to deal with non-char-sized buffers when I built cdatapack.  We need to update the callers in ctreemanifest to be aware of this.  Most of this is done with macro magic.

Some functionality was dropped from cdatapack's buffer.h (macro definitions to deal with paths).  Those are moved to path_buffer.h

Test Plan:
make local && clion build.
pass cfastmanifest unit tests.

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Signature: t1:3780767:1472255278:40a19edfd171df5804e9cdfa4444d5c6386f00e8
2016-08-26 17:14:52 -07:00
Tony Tung
2f5e85ccb8 move common code to clib
Test Plan: make local && build in clion

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Signature: t1:3780622:1472250774:fa702d78dab39eb74c8de58c0d589ae36a2c42b3
2016-08-26 15:45:43 -07:00
Ryan McElroy
9e5fa17451 Fix check code test
Test Plan: run the test

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Tasks: 12855049

Signature: t1:3777411:1472217139:9fe3be9ded664f3bbcd373b93be2bcfac2be593b
2016-08-26 06:27:59 -07:00
Durham Goode
ff15a890ad tests: undo lint fix for conduithttp and replace with a suppression 2016-08-01 11:56:48 -07:00
Tony Tung
b0604f946a [fastmanifest] utility to dump some specs about a tree to disk
Test Plan: run tree_dump on a fastmanifest file.  did some spot checks against the text manifest with the same sha (`hg debugdata -m`)

Reviewers: lcharignon, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Tasks: 12119301

Signature: t1:3585843:1469050470:70729d5601f935f2de80f89a7ad83590bcb8dd00
2016-07-26 23:35:53 -07:00
Ryan McElroy
8a7269b592 tests: fix check-code test after statprof move 2016-07-22 16:31:25 -07:00
Jun Wu
3884602d28 check-code: enfore checking before using common foreign extensions
Summary:
It's a common mistake that our tests require foreign extensions (namely evolve
and remotenames) without checking them first.

This diff adds checks to catch these mistakes, adds missing checks, and unifies
our checking logic using `require-ext.sh`, which is aware of `hgext3rd` and
prints skip message.

This affects `arc lint` so hopefully our new testing code would be free of this
kind of mistakes.

Test Plan: `arc lint` would catch errors

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3550977:1468455857:e849dfd9e3cbc446cc6e6c662050ee88a3366e6c
2016-07-12 20:39:34 +01:00
Jun Wu
8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

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

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00
Tony Tung
e62d8fd12b [fastmanifes] rename fastmanifest_wrapper as cfastmanifest
Summary: Depends on D3351021

Test Plan: run unit tests.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

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

Signature: t1:3351039:1464284522:d63f5011c6ca1981408519f5f7378e9a33aaecfe
2016-05-26 11:34:56 -07:00
Tony Tung
fc8c0d61a1 [fastmanifest] rename fastmanifest c library directory to cfastmanifest
Summary: This allows us to use fastmanifest as a directory to drop in the python module.

Test Plan: compiles, passes existing tests.

Reviewers: lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

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

Signature: t1:3351021:1464284417:6cbcde514ab1fd7b5caa6c83cb5577f3502dbc58
2016-05-26 11:33:07 -07:00
Tony Tung
ca29ec0954 [fastmanifest] fix ordering of check-code entries
Summary: I don't know how to alphabitize.

Test Plan: pass check code.

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mitrandir, mjpieters

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

Signature: t1:3299175:1463174462:3706c792e6283c6de5a869e4da98be98a476fe03
2016-05-16 16:13:44 -07:00
Tony Tung
b6202d48e1 [fastmanifest] persistence layer for trees
Summary:
API to write trees to disk and read trees from disk.

Some interesting things to keep in mind:
* To keep valgrind happy, we have to clear all the memory we allocate but never initialize. That can be padding between fields in structs, fields that don't make sense to initialize, the extra byte in checksums that doesn't get used normally, or portions of bitfields that are never used.  All this logic is kept compartmentalized in `initialize_unused_bytes(..)`.  Normal runtime does not invoke this code, though I suspect the cost is probably not significant.
* A significant chunk of the write path is made up of the `CHECKED_WRITE_XXX` macros.  They're calls to ensure that writes succeed.  If not, they jump to a fixed exit point.
* The write path is not very optimized.  We can use a bottom-up traversal, similar to tree_convert, to make the write less costly.  However, our design doesn't require a fast write, so tentatively, I'm going to reuse `tree_copy(..)` to compact a tree.

Depends on D3255048

Test Plan: pass unit tests!

Reviewers: lcharignon, wez

Reviewed By: wez

Subscribers: mitrandir, mjpieters

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

Tasks: 10589048

Signature: t1:3255656:1462342423:c28d32c610b2351614d7648c03f35f931370a770
2016-05-04 14:11:55 -07:00
Tony Tung
31ccb0f6a4 [fastmanifest] add tree_diff.c and tree_iterator.c to the build
Test Plan: make local

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

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

Signature: t1:3226569:1461768167:c5f6ba1b699a4b685dbc57c89f1dc40088ab3d2a
2016-04-27 11:44:49 -07:00
Tony Tung
10899ff617 fix check-code violations
Summary:
1) trailing ws.
2) D3204578 removed files

Test Plan: pass check-code

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3208944

Signature: t1:3208944:1461366677:f1f312e17ab37d70fecfa43ce31261f3eb42814b
2016-04-25 12:01:35 -07:00
Tony Tung
4d4cb59574 [fastmanifest] rename copy to copy_tree
Summary: It's too common of a name.

Test Plan: compiles && unit tests pass.

Reviewed By: lcharignon

Differential Revision: https://phabricator.fb.com/D3192722
2016-04-18 13:23:42 -07:00
Tony Tung
b65983a069 [fastmanifest] exempt tree-path.[ch] from check-code
Test Plan: arc diff makes me run check code.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3160496

Signature: t1:3160496:1460220444:7510cd4929d2fb7f5a42dd09dc890e036ad455bd
2016-04-10 00:18:56 -07:00
Laurent Charignon
71bef9dc56 remove flaky test + fix check code 2016-04-08 12:43:10 -07:00
Laurent Charignon
59bcb8e5c0 fastmanifest: add python to C layer
Summary: This adds the CPythong interface layer for fastmanifest

Test Plan: Compiles

Reviewers: ttung, durham

Differential Revision: https://phabricator.fb.com/D3157095
2016-04-08 11:48:31 -07:00
Tony Tung
91a9f27549 [fastmanifest] suppress check-code on fastmanifest
Summary: It's not going to pass.

Test Plan: run check-code

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3126493

Tasks: 10662043

Signature: t1:3126493:1459523935:54449c39abfef97b596e9c34743583afa8b983d5
2016-04-01 11:19:53 -07:00
Laurent Charignon
7830092e84 cleanup: add test-check-code-hg.t
Summary: Final diff of the series

Test Plan:
All tests pass with --extra-config=extensions.lz4revlog= needed
to run check-code

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2812684
2016-01-11 10:19:22 -08:00