Summary:
In order to foster healthy open source communities, we're adopting the
[Contributor Covenant](https://www.contributor-covenant.org/). It has been
built by open source community members and represents a shared understanding of
what is expected from a healthy community.
Reviewed By: josephsavona, danobi, rdzhabarov
Differential Revision: D17104640
fbshipit-source-id: d210000de686c5f0d97d602b50472d5869bc6a49
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/102
I want to use the trace_ functionality in rest of Haxl code as well.
Instead of defining it in each module, let's move this to Haxl.Core.Util. It's
better also because this module is not exported from haxl.
Reviewed By: watashi
Differential Revision: D16523067
fbshipit-source-id: f7e75cdd6920247a778100c22730bd113009e9aa
Summary:
This test is flaky and failed in recent travis ci run:
https://travis-ci.org/facebook/Haxl/jobs/560169278
2ms is too small and a context switch or gc can affect the order of events.
Let's enlarge this to 100ms, which is similar to what we have in
FullyAsyncTest.
Reviewed By: anubhav94N
Differential Revision: D16522892
fbshipit-source-id: d27dd0b185115fd2ab0df9496b0811066e731305
Summary:
We have define this in tests and other libraries. Let's simply expose this
functionality from `Haxl.Prelude` as it can be useful in a few cases.
Reviewed By: anubhav94N
Differential Revision: D16522569
fbshipit-source-id: b35726e9ad172a36d76b755498fbb53d9a9db188
Summary:
Right now, Haxl throws a `DataSource` error if we try to cache a
request that already exists in the `Haxl` cache. For unit tests, it seems
useful to allow the cache to be overwritten. Adding a new function to do this.
Reviewed By: simonmar
Differential Revision: D16280746
fbshipit-source-id: febafb4f3a2c0087aff204ab442911b022712362
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/100
The type of this function should be `GenHaxl u w a`
Reviewed By: josefs
Differential Revision: D15392634
fbshipit-source-id: e98818d0558616f38edaaa86fea8a44ed062c878
Summary:
Adds the ability for one to record the function callstack within the `Haxl` monad.
The main function is `withCallGraph`, and supporting types are in `Haxl.Core.CallGraph`.
Reviewed By: watashi
Differential Revision: D14857851
fbshipit-source-id: daab97e8144ff63104ad9e79a3a792a4471e5588
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/99
This adds unit tests to haxl, to make sure we are tracking the outgone
fetches correctly..
Reviewed By: simonmar
Differential Revision: D14683672
fbshipit-source-id: 49a318f0b8aa38c2af154fcbe0946122e70b9565
Summary:
Travis build is failing on ghc-7.8, as `<$>` is not available for that version
https://travis-ci.org/facebook/Haxl/builds/518421734
(Note: this ignores all push blocking failures!)
Reviewed By: lolotp
Differential Revision: D14877878
fbshipit-source-id: bfd13f910142ede2f5a54906c508aba9105509d6
Summary:
The allocatin counter is keep decreasing, so the number returned by
`getAllocationCounter` is negative. We want to absolute value to be consistent
with other fetches.
Reviewed By: simonmar
Differential Revision: D14839122
fbshipit-source-id: d6e475b209c4a14823fcaff8c0ea17cbbd5bdbb1
Summary: Whoops forgot to do when I added the test file.
Reviewed By: zilberstein
Differential Revision: D14874686
fbshipit-source-id: 5bb4b83368f03e9867516b3876acb83ea8aa6852
Summary:
Add benchmarks for sequential and parallel writes.
Ran the benchmark for 10^6 writes
parallel - 0.19s
seq - 0.07s
Running in parallel probably has more contention for the IORef
Reviewed By: simonmar
Differential Revision: D14386951
fbshipit-source-id: 164972e714eac14406fc106df073474d141e9ca0
Summary:
Most important thing I want to test is that when a memoized
computation happens again - the writes are indeed duplicated in the
environment. This diff adds tests for different ways memoized computation can
happen in conjunction with non-memoized computation..
Reviewed By: simonmar
Differential Revision: D14386667
fbshipit-source-id: a03a9a41697def968bf6e11ad66b9dd9f3a9a7f1
Summary:
Expose a conveniece wrapper `runHaxlWithWrites` which returns the writes along with
the result of the `Haxl` computation.
Reviewed By: simonmar
Differential Revision: D14386668
fbshipit-source-id: 95757916691f7b9b1291c7dceae7eafe8738cfca
Summary:
Here I try to populate the writes done as part of a Haxl computation
in an IORef inside the Environment.
`IVar` which is the synchornisation point,
also acts as the point where we store intermediate writes for Haxl
computations, so they can be memoized and reused whenever a memoized
computation is done again. This is done inside `getIVarWithWrites` function.
This works, because we create new IVars when running a memo computation
or a data fetch, and it is only at these places where we need to create a new
environment with empty writes to run the computation in. So I run every memoized
computation in a new environment (with empty writes) and populate the writes in this new
environment. At the end of the memoized computation, I look up these writes from the `IVar`
and also add them to the original environment. This way ultimately all writes are correctly
propagated upwards to the top level environment user passes to `runHaxl`.
This logic lives inside `execMemoNow`.
Reviewed By: simonmar
Differential Revision: D14342181
fbshipit-source-id: a410dae1a477f27b480804b67b2212e7500997ab
Summary:
CI failed because of recent change in cabal-head that sdist is now new-sdist
instead of v1-sdist and the ouput path is different.
We also build against ghc-8.6.4 instead of ghc-8.6.2 now as this is the latest
stable version of ghc-8.6.
Reviewed By: alexanderGugel
Differential Revision: D14815535
fbshipit-source-id: 80514188fc4c2d00a10cf7dd1d710eb28ec02e50
Summary:
Right now, we get no alloication infroamtion for background fetch at all.
This is because the allocation usually happen in a thread and we only get
back the control in a callback. As a improvement, we can just use the total
allocation in the child thread as the allocation.
While individual allocation won't be correct if `putResult` is called more than
once. The total sum and amortized allocation will still be helpful stats.
Reviewed By: simonmar
Differential Revision: D14734588
fbshipit-source-id: 6beed3741a496d308bdcec75eb0f0e0bbfbbae38
Summary: And bump version to 2.0.1.1
Reviewed By: anubhav94N
Differential Revision: D10011092
fbshipit-source-id: 4d45f79fb4c89112d29d40f0d53a50441a443729
Summary:
Use the source location of the `memo` statement to calculate the memoization label as opposed to the memoization key. This is to make sure that multiple `memo` calls in the same declaration will get different labels.
This enables to remove `memoUniqueText` and the related pragma as `memoUnique` will now have a Text label by default.
Reviewed By: simonmar
Differential Revision: D9779196
fbshipit-source-id: 89d2ce6d5a6ebc4a6b8246a5ef561ecf8e18c522
Summary: Thanks cmarkle for noticing in https://github.com/facebookincubator/fizz/pull/5
Reviewed By: dark
Differential Revision: D9195501
fbshipit-source-id: bdbe1588cdcd353d60fcaab14a4fac8bd2256355
Summary:
This diff removes the scuba field as described in the task, as well as removing numRounds from Stats. This involved removing the numRounds assertion from expectRounds* functions, which I chose to rename to expectResult* (lmk if you prefer something different there).
Within Stats, I merely deleted the numRounds function. I didn't go looking for anything deeper to clean up because it looked like `rs` was used in other functions.
Reviewed By: zilberstein
Differential Revision: D8963298
fbshipit-source-id: d367b53007be03bd290222c676539680acd9f929
Summary: dumpCacheAsHaskellFn generates an empty `do` block if the cache is empty.
Reviewed By: codemiller
Differential Revision: D8712898
fbshipit-source-id: fcaf4a0cc6c5416155aebda8fe68f3f026d8d025
Summary: The MemoVar export causes a minor version bump
Reviewed By: anubhav94N
Differential Revision: D8588703
fbshipit-source-id: 8dfb5ed5f44a681810860080b8413fc61bf58c89
Summary: Rewrites calls of `memo` to `memoUnique` to ensure that the keys are globally unique
Reviewed By: xich
Differential Revision: D8085641
fbshipit-source-id: 6de214ed0e2195d59a46752edb28fc4ad591110f
Summary:
minor version bump required so that I can update the Hackage package
to fix the URLs.
Reviewed By: codemiller
Differential Revision: D8057062
fbshipit-source-id: 2204d28a965df3933b7acf5b81c62b4380835e63
Summary:
In general it's better to use Proxy than to use undefined arguments
when passing types.
This is one API change I had lying around that we should get in before
a Haxl 2 release, so that we only force one round of breakage for
clients.
Reviewed By: zilberstein
Differential Revision: D7254826
fbshipit-source-id: d5f7ec9ac8586da845760c0ffa1ddbcfef1d13c6
Summary: I noticed this test was broken in `cabal test` recently.
Reviewed By: mic47
Differential Revision: D6857296
fbshipit-source-id: ca7d15ba841f1dc79acccf1cd4999e8fcea994c8
Summary:
This isn't pretty, but it's the least intrusive and most efficient way
I could find to do it.
The tricky part is that when doing multiple putResults in the same
child thread, we have to ensure the *last* one (and only the last one)
is putResultFromChildThread.
Reviewed By: xich
Differential Revision: D6519631
fbshipit-source-id: 1c3c40f311031ac4cc8ed82daefcb7740b91541e
Summary:
It is useful to have a separate scuba table to record datasource stats where the datasource name is a row instead of a column. This allows us to do more complex aggregations over time/allocations/etc of ALL datasources not per each individual one.
The way it's set up now I rate limit on the datasource name. I'm not sure if this is the right move, maybe I should rate limit on both the datasource and the context? I also log each fetch as a separate row. This might end up being expensive, but it allows us to get more detailed information about batch sizes (ie p95, avg, sum). If we combined all fetches for each datasource then we'd get less detailed information, but it may be more practical.
Reviewed By: sameenjalal, simonmar
Differential Revision: D6492647
fbshipit-source-id: 28399ece277f93616786bdfb18264a0250aa238b
Summary:
Try different approaches, but ended up with this. At first I wanted to use SIEnv, but that is not available from Core (Fetches.hs) and we don't want that dependency.
Then I tried creating a haxlsh command for it, but I didn't like it as it will be not useful. So I pass it via the haxlConfig and set the env just before running the test.
The only thing that I am not sure about is if we need to deprecate uncachedResponse. The new signature is a more restricted type that implements the Show type class. As this
was already called with responses everywhere, it seems to work out of the box.
I am a bit confused though for the BlackBird issue. Memcache will fail Set, but shoudn't fail Get as that is using dataFetch which is cached already. It might have been another issue.
Reviewed By: simonmar
Differential Revision: D6195542
fbshipit-source-id: 483d7ec4f32a27b8c9cbfb5d9b129abe40a93c54