abci/client: simplify client interface#7607
Conversation
a2abfcb to
2fdca21
Compare
There was a problem hiding this comment.
love to see this being cleanup. Before merging might want to do a sanity check with @ebuchman, I believe he may know why this exists.
Im for this change and in the sdk we only use the local client, so not sure where all this came in
f918b4f to
0f65c93
Compare
cmwaters
left a comment
There was a problem hiding this comment.
LGTM pending a check from @ebuchman or @milosevic
| @@ -33,35 +33,24 @@ type Client interface { | |||
|
|
|||
| // Asynchronous requests | |||
| FlushAsync(context.Context) (*ReqRes, error) | |||
There was a problem hiding this comment.
Why do we still need this?
There was a problem hiding this comment.
Yeah makes sense to tackle this as a different issue/PR
| EchoAsync(ctx context.Context, msg string) (*ReqRes, error) | ||
| InfoAsync(context.Context, types.RequestInfo) (*ReqRes, error) | ||
| DeliverTxAsync(context.Context, types.RequestDeliverTx) (*ReqRes, error) | ||
| CheckTxAsync(context.Context, types.RequestCheckTx) (*ReqRes, error) |
There was a problem hiding this comment.
I believe this gets used in the mempool right? Is it possible (in a follow up PR of course) to modify the usage so we can call CheckTx instead?
There was a problem hiding this comment.
Yeah, I tried this, sort of naively, and I think it's possible, but the impact on the mempool is pretty good (mostly because there are a bunch of tests that do assertions/etc. via the callback. I think the best path forward would be to merge this, and then write a shim in the mempool package that does the switch and try and go from there.
64a95a6 to
3089ceb
Compare
|
FYI, I followed up with Ethan on slack and he had this response:
|
williambanfield
left a comment
There was a problem hiding this comment.
This makes me very happy. Not sure I understand the distinction between Flush vs FlushAsync. Didn't look at the mocks.
abci/client/socket_client.go
Outdated
|
|
||
| func (cli *socketClient) EchoSync(ctx context.Context, msg string) (*types.ResponseEcho, error) { | ||
| func (cli *socketClient) Echo(ctx context.Context, msg string) (*types.ResponseEcho, error) { | ||
| reqres, err := cli.queueRequestAndFlushSync(ctx, types.ToRequestEcho(msg)) |
There was a problem hiding this comment.
Should we rename these as well -> queueRequestAndFlush?
There was a problem hiding this comment.
In re: Flush vs. FlushAsync. As far as I can tell, there is no difference, but when I tried to get rid of FlushAsync it metastasized. I suspect there is a kernel of simplicity inside that we could use. (Flush appears to be primarily an artifact of the socket client anyway, cf. #6994).
In re: Plumbing methods. Sure, done. But it's harder to be systematic about those.
gofmt -r 'queueRequestAndFlushSync->queueRequestAndFlush' -w abci/client/socket_client.go
defedc2 to
825aca7
Compare
I agree this is something worth measuring. At the moment I think neither in-process nor out-of-process applications can practically benefit from concurrency here: Even for CheckTx, the socket protocol requires head-of-line blocking because requests cannot be interleaved. And for in-process all client requests share a global mutex. Both of those are issues I think we should address—for performance, certainly, but also to make the control flow easier to understand. For now, though, I don't think these client-side changes can have any material effect on the performance (in either direction). |
8958e48 to
9163d8c
Compare
9163d8c to
a4018c1
Compare
This change has two main effects: 1. Remove most of the Async methods from the abci.Client interface. Remaining are FlushAsync, CommitTxAsync, and DeliverTxAsync. 2. Rename the synchronous methods to remove the "Sync" suffix. The rest of the change is updating the implementations, subsets, and mocks of the interface, along with the call sites that point to them.
a4018c1 to
4b336e6
Compare
As we discussed at the ABCI++ meeting, the rollout in v0.36 is an ideal time to clean up some infelicities in the original implementation. This is a first step toward that cleanup. We will still have to address Flush, CommitTx, and DeliverTx separately, but getting the easy cases out of the way will help keep those diffs smaller.
N.B.: The diff in
grpc_client.gois large, but less complicated than it looks. It folds the sync/async versions back together, strips out the unnecessary support code, and updates the names. The rename makes the diff look hairier than it should be.This change has two main effects:
Remove most of the Async methods from the abci.Client interface.
Remaining are FlushAsync, CommitTxAsync, and DeliverTxAsync.
Rename the synchronous methods to remove the "Sync" suffix.
The rest of the change is updating the implementations, subsets, and mocks of
the interface, along with the call sites that point to them.
TODO
beforeafter merge: