Commit Graph
35 Commits
Author SHA1 Message Date
JayT106andGitHub d9c9675e2a p2p+flowrate: rate control refactor (#7828)
Adding `CurrentTransferRate ` in the flowrate package because only the status of the transfer rate has been used.
2022-03-10 13:48:23 +00:00
M. J. FrombergerandGitHub 2df5c85a8d Fix govet errors for %w use in test errors. (#8083)
The %w syntax is a fmt.Errorf thing, not supported by the testing package.
2022-03-07 18:17:37 +00:00
Sam KleinmanandGitHub a3881f0fb1 consensus: improve wal test cleanup (#8059)
I believe that this gets rid of our temp-file related test errors.
2022-03-02 18:35:39 +00:00
Sam KleinmanandGitHub 6280f45460 clist: remove unused waitgroup from clist implementation (#7843) 2022-02-18 13:53:33 +00:00
Sam KleinmanandGitHub be83ec6664 p2p: pass start time to flowrate and cleanup constructors (#7838)
After poking around #7828, I saw the oppertunity for this cleanup,
which I think is both reasonable on its own, and quite low impact, and
removes the math around process start time.
2022-02-18 13:30:19 +00:00
M. J. FrombergerandGitHub 7e09c2ef43 Clean up temp files more thoroughly after testing. (#7815)
Our test cases spew a lot of files and directories around $TMPDIR.  Make more
thorough use of the testing package's TempDir methods to ensure these are
cleaned up.

In a few cases, this required plumbing test contexts through existing helper
code. In a couple places an explicit path was required, to work around cases
where we do global setup during a TestMain function. Those cases probably
deserve more thorough cleansing (preferably with fire), but for now I have just
worked around it to keep focused on the cleanup.
2022-02-14 06:32:07 -08:00
Sam KleinmanandGitHub dbb7d6ecdd sync+p2p: remove closer (#7805) 2022-02-11 15:12:25 -05:00
Sam KleinmanandGitHub f163acf499 clist: reduce size of test workload for clist implementation (#7682) 2022-01-25 13:48:24 -05:00
Sam KleinmanandGitHub 78e4c7d379 autofile: avoid shutdown race (#7650) 2022-01-20 17:06:44 -05:00
M. J. FrombergerandGitHub a7eb95065d autofile: ensure files are not reopened after closing (#7628)
During file rotation and WAL shutdown, there was a race condition between users
of an autofile and its termination. To fix this, ensure operations on an
autofile are properly synchronized, and report errors when attempting to use an
autofile after it was closed.

Notably:

- Simplify the cancellation protocol between signal and Close.
- Exclude writers to an autofile during rotation.
- Add documentation about what is going on.

There is a lot more that could be improved here, but this addresses the more
obvious races that have been panicking unit tests.
2022-01-18 14:57:20 -08:00
M. J. FrombergerandGitHub c24f003b55 protoio: fix incorrect test assertion (#7606)
After writing and then reading a bunch of random messages, the test was
checking that it did not read the same number of messages that it wrote.
The sense of this check was inverted; they should match.

Introduced by accident in #7522. I'm not sure why this did not show up in CI.

Edit: I now know why it didn't show up in ci: #7608.
2022-01-16 20:39:37 +00:00
Sam KleinmanandGitHub 82b65868ce node+autofile: avoid leaks detected during WAL shutdown (#7599) 2022-01-14 13:04:01 -05:00
Sam KleinmanandGitHub 25e665df17 internal/libs: delete unused functionality (#7569) 2022-01-12 15:55:42 -05:00
Sam KleinmanandGitHub 569629486b tests: remove panics from test fixtures (#7522) 2022-01-06 17:34:32 -05:00
Sam KleinmanandGitHub 332163ede6 testing: remove background contexts (#7509) 2022-01-05 12:42:57 -05:00
Sam KleinmanandGitHub f2cc496f09 testing: pass testing.T to assert and require always, assertion cleanup (#7508) 2022-01-05 09:25:08 -05:00
Sam KleinmanandGitHub 3c8955e4b8 errors: formating cleanup (#7507) 2022-01-04 16:11:28 -05:00
M. J. FrombergerandGitHub da697089d0 Move libs/async to internal/libs/async. (#7449) 2021-12-14 14:05:42 -08:00
Sam KleinmanandGitHub d0e03f01fc sync: remove special mutexes (#7438) 2021-12-13 13:35:32 -05:00
Emmanuel T OdekeandGitHub 3e92899bd9 internal/libs/protoio: optimize MarshalDelimited by plain byteslice allocations+sync.Pool (#7325)
Noticed in profiles that invoking *VoteSignBytes always created a
bytes.Buffer, then discarded it inside protoio.MarshalDelimited.
I dug further and examined the call paths and noticed that we
unconditionally create the bytes.Buffer, even though we might
have proto messages (in the common case) that implement
MarshalTo([]byte), and invoked varintWriter. Instead by inlining
this case, we skip a bunch of allocations and CPU cycles,
which then reflects properly on all calling functions. Here
are the benchmark results:

```shell
$ benchstat before.txt after.txt
name                                        old time/op    new time/op      delta
types.VoteSignBytes-8                       705ns ± 3%     573ns ± 6%       -18.74% (p=0.000 n=18+20)
types.CommitVoteSignBytes-8                 8.15µs ± 9%    6.81µs ± 4%      -16.51% (p=0.000 n=20+19)
protoio.MarshalDelimitedWithMarshalTo-8     788ns ± 8%     772ns ± 3%       -2.01%  (p=0.050 n=20+20)
protoio.MarshalDelimitedNoMarshalTo-8       989ns ± 4%     845ns ± 2%       -14.51% (p=0.000 n=20+18)

name                                        old alloc/op   new alloc/op    delta
types.VoteSignBytes-8                       792B ± 0%      600B ± 0%       -24.24%  (p=0.000 n=20+20)
types.CommitVoteSignBytes-8                 9.52kB ± 0%    7.60kB ± 0%     -20.17%  (p=0.000 n=20+20)
protoio.MarshalDelimitedNoMarshalTo-8       808B ± 0%      440B ± 0%       -45.54%  (p=0.000 n=20+20)

name                                        old allocs/op  new allocs/op   delta
types.VoteSignBytes-8                       13.0 ± 0%      10.0 ± 0%       -23.08%  (p=0.000 n=20+20)
types.CommitVoteSignBytes-8                 140 ± 0%       110 ± 0%        -21.43%  (p=0.000 n=20+20)
protoio.MarshalDelimitedNoMarshalTo-8       10.0 ± 0%      7.0 ± 0%        -30.00%  (p=0.000 n=20+20)
```

Thanks to Tharsis who tasked me to help them increase TPS and who
are keen on improving Tendermint and efficiency.
2021-12-10 09:36:43 -08:00
Sam KleinmanandGitHub a62ac27047 service: remove exported logger from base implemenation (#7381) 2021-12-06 10:16:42 -05:00
Sam KleinmanandGitHub a823d167bc service: cleanup base implementation and some caller implementations (#7301) 2021-12-01 09:28:06 -05:00
Sam KleinmanandGitHub 6ab62fe7b6 service: remove stop method and use contexts (#7292) 2021-11-18 17:56:21 -05:00
M. J. FrombergerandGitHub d32913c889 pubsub: Use a dynamic queue for buffered subscriptions (#7177)
Updates #7156, and a follow-up to #7070.

Event subscriptions in Tendermint currently use a fixed-length Go
channel as a queue. When the channel fills up, the publisher
immediately terminates the subscription. This prevents slow
subscribers from creating memory pressure on the node by not
servicing their queue fast enough.

Replace the buffered channel used to deliver events to buffered
subscribers with an explicit queue. The queue provides a soft
quota and burst credit mechanism: Clients that usually keep up
can survive occasional bursts, without allowing truly slow
clients to hog resources indefinitely.
2021-11-01 10:38:27 -07:00
8441b3715a migrate away from deprecated ioutil APIs (#7175)
Co-authored-by: Callum Waters <cmwaters19@gmail.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
2021-10-28 10:34:07 -07:00
Sam KleinmanandGitHub b15b2c1b78 flowrate: cleanup unused files (#7158)
I saw one of these tests fail and it looks like it was using code that
wasn't being called anywhere, so I deleted it, and avoided the package
name aliasing.
2021-10-26 16:11:34 +00:00
Sam KleinmanandGitHub ded310093e lint: fix collection of stale errors (#7090)
Few things that had been annoying.
2021-10-09 15:33:54 +00:00
Callum WatersandGitHub 59404003ee p2p: rename pexV2 to pex (#7088) 2021-10-08 16:53:54 +02:00
William BanfieldandGitHub e801328128 clist: add simple property tests (#6791)
Adds a simple property test to the `clist` package. This test uses the [rapid](https://github.com/flyingmutant/rapid) library and works by modeling the internal clist as a simple array.

Follow up from this mornings workshop with the Regen team.
2021-08-03 19:30:05 +00:00
JayT106andGitHub e87b0391cb cli/indexer: Reindex events (#6676) 2021-07-28 00:04:54 +02:00
William BanfieldandGitHub 21309ccb7b clist: add a few basic clist tests (#6727) 2021-07-19 14:02:21 +00:00
William BanfieldandGitHub fdc246e4a8 libs/clist: revert clear and detach changes while debugging (#6731) 2021-07-17 12:10:53 -04:00
736364178a fix typo in log message (#6653)
Co-authored-by: Callum Waters <cmwaters19@gmail.com>
2021-07-05 14:00:09 +00:00
JayT106andGitHub d66d1ada5b libs/CList: automatically detach the prev/next elements in Remove function (#6626)
closes #2207

Also added `Clear()` function if we want to clear whole elements in CList.
2021-06-30 08:47:25 +00:00
MarkoandGitHub 719e028e00 libs: internalize some packages (#6366)
## Description

Internalize some libs. This reduces the amount ot public API tendermint is supporting. The moved libraries are mainly ones that are used within Tendermint-core.
2021-05-25 16:25:31 +00:00