You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Sailesh Mukil (Code Review)" <ge...@cloudera.org> on 2016/12/13 19:14:24 UTC
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Sailesh Mukil has uploaded a new change for review.
http://gerrit.cloudera.org:8080/5491
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
IMPALA-3977: TransmitData() should not block
TransmitData() calls effectively block until an error occurs (e.g.
datastream_sender_timeout_ms expires) or the RPC is serviced by the
receiver. This is bad for a variety of reasons, not least that it
makes it impossible to cancel the sender without also cancelling the
recipient (who might not even be running!).
With our current RPC stack, this holds up the connection for as long
as the receiver takes to get ready (or until it times out), which
means that that connection is unusable by other threads.
When we move to KuduRPC, we will have a different problem if this RPC
remains blocking, in that it will hold up a service thread on the
receiver side potentially blocking progress for other tasks on that
host that require a service thread.
This patch introduces a EAGAIN like error code that the receiver sends
back to the sender if the DataStreamReceiver object is not yet ready
to receive data. The sender tries again up to 5 times with intervals
in between.
Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
---
M be/src/runtime/data-stream-mgr.cc
M be/src/runtime/data-stream-mgr.h
M be/src/runtime/data-stream-sender.cc
M be/src/runtime/data-stream-test.cc
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/QueryTest/exchange-delays.test
6 files changed, 53 insertions(+), 135 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/91/5491/1
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 2:
(13 comments)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
PS1, Line 53: STREAM_EXPIRATION_TIME_MS
> Do you think we still need the stream cache? In the case where a receiver h
I've thought about this for a while and it makes sense that the cache is not very necessary. However, there are a couple of cases I can think of where this may come in handy.
1. The obvious one where cancellation takes a while to reach the sender. We can avoid extra RPCs here.
2. When there is a Limit and the receiver fragment instance has hit it and deregistered its receiver, but the sender fragment keeps attempting to send row batches, as the DataStreamSender has no notion of a limit, it just sends everything it gets.
My suggestion is that we leave it as it is for now, and I can try to get some numbers on how useful it is after this patch, and make a decision accordingly.
PS1, Line 99: if (already_unregistered != nul
> Can we just require now that the caller takes the lock?
Done
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 209: params.protocol_version
> Let's move this inside the loop so it's freshly initialized on each iterati
TTransmitDataResult has only one field, i.e. Status.
Also, 'res' is required outside the loop in L224 which is why I initialized it outside.
PS1, Line 217: conds(FLAGS_datas
> Thinking about this a bit more - that might still be worthwhile for the ini
Just to clarify, do you mean that we need to add a timed wait in AddBatch() somewhere around here, and return an EAGAIN if we've waited too long?
PS1, Line 217: conds(FLAGS_datas
> Since a row batch can potentially be many megabytes large, I wonder if it m
I like the idea, but isn't that optimizing for a worse-case scenario? Keeping in mind that latency is usually the bottleneck and not the throughput itself. Also, the payload is already thrift-serialized by this point so we're not wasting any time doing that too.
My worry is that, after we move to KuduRPC, if we have a probe RPC for every TransmitData() call, considering that each RPC is queued on the sender and the receiver side, it might add a permanent latency to the overall query time for a lot of queries.
Line 224: address_, &rpc_status_);
> Is cancellation detected during this loop? That's part of the point of movi
No, I added a check now to return if cancelled.
PS1, Line 225: if (!rpc_status_.ok()) return;
> Not very informative without the fragment ID / destination address etc.
Done
PS1, Line 226:
> rather than have the sleep period be a function of the total timeout, it ma
Done
PS1, Line 226:
> Does it make sense to add some exponential back-off here, let's say up to a
That sounds like a good idea, but I would wait to see some numbers on how having a fixed interval between RPCs has a negative effect (if it does at all). Otherwise, it seems a bit like over-optimizing for a case that we don't know hurts yet.
Line 228: rpc_status_ = DoTransmitDataRpc(&client, params, &res);
> I think it's a bit confusing to have this method return EAGAIN upon failure
Done
http://gerrit.cloudera.org:8080/#/c/5491/1/common/thrift/generate_error_codes.py
File common/thrift/generate_error_codes.py:
Line 233: ("DATASTREAM_SENDER_TIMEOUT", 72, "Sender timed out waiting for receiver fragment "
> Should we mark this as deprecated here?
In the next patchset, I went back to using this, so we still need this.
PS1, Line 314: DATASTREAM_RECEIVER_EAGAIN
> Would it make sense to name this more general, e.g. "RPC_TRY_AGAIN" so we c
This is set only by the DataStreamMgr which technically is a layer above the RPC stack. And this will only be more true after moving to KuduRPC. So I think it's best not to have generic RPC error codes in Impala since KuduRPC will have its own and we will need to stick to those instead.
Line 315: )
> nit: single line?
Done
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Henry Robinson (Code Review)" <ge...@cloudera.org>.
Henry Robinson has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
PS1, Line 53: STREAM_EXPIRATION_TIME_MS
> I've thought about this for a while and it makes sense that the cache is no
I think we can get the same effect as the stream cache without the complexity. The key is distinguishing between all the different states:
If a receiver is not present, return EAGAIN. Either a) this is the first batch, so try again or b) we've already successfully sent > 0 batches, so the sender knows the receiver has gone away. The case you describe, where there's an upstream limit, could lead to a sender retrying if it never contributed a batch to the limit. But that's not very common. If we have concerns about the network usage of retrying, we can always fall back to probing without a payload.
If the receiver is present, but the queue is full, return a different status code to distinguish from the case where the receiver is not present. This allows us to fail fast in the former case where the receiver has been torn down but we've already sent a batch, so we know it was once there.
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 209: TTransmitDataResult res;
> TTransmitDataResult has only one field, i.e. Status.
Don't rely on TTransmitDataResult not changing.
There's no reason L224+ have to be outside the loop.
PS1, Line 217: DoTransmitDataRpc
> I like the idea, but isn't that optimizing for a worse-case scenario? Keepi
Yes, I think the sender needs to time-out of AddBatch(). Otherwise it could get blocked in the queue and hold a service pool thread.
I'm ok with waiting to see if the probe request has a benefit, but I still think we'll need to distinguish the first RPC from all subsequent ones to distinguish between "receiver is not there yet" from "receiver was here and has disappeared" conditions (see other comments for details).
I'd expect the probe to take a few ms at most, and the network capacity for those should be effectively infinite given our requirements. The capacity for full batch sends might be smaller, which affects the latency - I'm not sure we can say that throughput is not an issue. Anyhow, you can defer that change for now.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 3:
> Uploaded patch set 3.
Haven't addressed the latest comments yet. Will do it soon.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
> Uploaded patch set 1.
Ran the core test suite and it passed. Unable to run stress testing yet due to some CM bug that's holding it up. Will run it once it gets resolved.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 2:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
PS1, Line 53: STREAM_EXPIRATION_TIME_MS
> I think we can get the same effect as the stream cache without the complexi
Done
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 209: params.protocol_version
> Don't rely on TTransmitDataResult not changing.
Done
PS1, Line 217: conds(FLAGS_datas
> Yes, I think the sender needs to time-out of AddBatch(). Otherwise it could
Ok, that makes sense. I added it as a TODO, and we can address it as a separate patch.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Lars Volker (Code Review)" <ge...@cloudera.org>.
Lars Volker has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
I'll do the first round of reviews.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Henry Robinson (Code Review)" <ge...@cloudera.org>.
Henry Robinson has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 217: DoTransmitDataRpc
> Since a row batch can potentially be many megabytes large, I wonder if it m
Thinking about this a bit more - that might still be worthwhile for the initial RPC, but the recvr should still return EAGAIN from SenderQueue::AddBatch() if the queue is full and the sender has waited some amount of time.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Henry Robinson (Code Review)" <ge...@cloudera.org>.
Henry Robinson has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 4:
(13 comments)
http://gerrit.cloudera.org:8080/#/c/5491/4/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
PS4, Line 42:
Unfortunately you can't just remove flags, because then Impala won't start if someone set them. Instead, change the comment to "DEPRECATED", and leave a TODO to remove in the next compat-breaking release.
PS4, Line 117: == true
remove
http://gerrit.cloudera.org:8080/#/c/5491/4/be/src/runtime/data-stream-recvr.cc
File be/src/runtime/data-stream-recvr.cc:
PS4, Line 53: This does not block
Mention that senders are expected to try again in this instance.
PS4, Line 151: bool* is_queue_full
Just return a boolean?
Line 167: *is_queue_full = true;
I thought you were going to add a timed-wait here.
http://gerrit.cloudera.org:8080/#/c/5491/4/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
Line 220: system_time timeout = get_system_time() +
Why not use MontonicMillis() for this?
PS4, Line 223: at-least
"at least".
But in general this comment is a bit confusing. We don't want to give the impression that the RPC could logically be sent (or really, received) more than once. Instead, you should spell out the state machine that TransmitData() now follows in a single comment, possibly at the definition of TransmitData(), or maybe in this method. It's complicated enough that we should document it in one place, rather than across several comments.
PS4, Line 245: DATASTREAM_RECEIVER_EAGAIN
Now that it's clearer when this could be received I'd rename it to DATASTREAM_RECEIVER_NOT_READY
PS4, Line 249: else
Don't need else since previous block returns.
PS4, Line 252: shutdown
shut down
Line 265: SleepForMs(DATASTREAM_RPC_RETRY_SLEEP_DURATION_MS);
indentation
Line 270: rpc_status_ = Status(TErrorCode::DATASTREAM_SENDER_TIMEOUT, PrintId(fragment_instance_id_));
long line
http://gerrit.cloudera.org:8080/#/c/5491/4/be/src/runtime/data-stream-test.cc
File be/src/runtime/data-stream-test.cc:
PS4, Line 574: // Set a higher timeout for this test.
: FLAGS_datastream_sender_timeout_ms = 5000;
This will affect all tests. Consider using ScopedFlagSetter (see webserver-test.cc).
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Anonymous Coward (Code Review)" <ge...@cloudera.org>.
Anonymous Coward #168 has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/5491/4/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
Line 113: return Status(TErrorCode::DATASTREAM_RECEIVER_EAGAIN, PrintId(fragment_instance_id));
did you consider this the case: ReachLimit() then Recvr deregister . then some sender first rpc coming .
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Anonymous Coward #168
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has uploaded a new patch set (#3).
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
IMPALA-3977: TransmitData() should not block
TransmitData() calls effectively block until an error occurs (e.g.
datastream_sender_timeout_ms expires) or the RPC is serviced by the
receiver. This is bad for a variety of reasons, not least that it
makes it impossible to cancel the sender without also cancelling the
recipient (who might not even be running!).
With our current RPC stack, this holds up the connection for as long
as the receiver takes to get ready (or until it times out), which
means that that connection is unusable by other threads.
When we move to KuduRPC, we will have a different problem if this RPC
remains blocking, in that it will hold up a service thread on the
receiver side potentially blocking progress for other tasks on that
host that require a service thread.
This patch introduces a EAGAIN like error code that the receiver sends
back to the sender if the DataStreamReceiver object is not yet ready
to receive data. The sender tries again up to 5 times with intervals
in between.
Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
---
M be/src/runtime/data-stream-mgr.cc
M be/src/runtime/data-stream-mgr.h
M be/src/runtime/data-stream-sender.cc
M common/thrift/generate_error_codes.py
4 files changed, 86 insertions(+), 142 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/91/5491/3
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has uploaded a new patch set (#2).
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
IMPALA-3977: TransmitData() should not block
TransmitData() calls effectively block until an error occurs (e.g.
datastream_sender_timeout_ms expires) or the RPC is serviced by the
receiver. This is bad for a variety of reasons, not least that it
makes it impossible to cancel the sender without also cancelling the
recipient (who might not even be running!).
With our current RPC stack, this holds up the connection for as long
as the receiver takes to get ready (or until it times out), which
means that that connection is unusable by other threads.
When we move to KuduRPC, we will have a different problem if this RPC
remains blocking, in that it will hold up a service thread on the
receiver side potentially blocking progress for other tasks on that
host that require a service thread.
This patch introduces a EAGAIN like error code that the receiver sends
back to the sender if the DataStreamReceiver object is not yet ready
to receive data. The sender tries again up to 5 times with intervals
in between.
Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
---
M be/src/runtime/data-stream-mgr.cc
M be/src/runtime/data-stream-mgr.h
M be/src/runtime/data-stream-sender.cc
M common/thrift/generate_error_codes.py
4 files changed, 85 insertions(+), 139 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/91/5491/2
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has uploaded a new patch set (#4).
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
IMPALA-3977: TransmitData() should not block
TransmitData() calls effectively block until an error occurs (e.g.
datastream_sender_timeout_ms expires) or the RPC is serviced by the
receiver. This is bad for a variety of reasons, not least that it
makes it impossible to cancel the sender without also cancelling the
recipient (who might not even be running!).
With our current RPC stack, this holds up the connection for as long
as the receiver takes to get ready (or until it times out), which
means that that connection is unusable by other threads.
When we move to KuduRPC, we will have a different problem if this RPC
remains blocking, in that it will hold up a service thread on the
receiver side potentially blocking progress for other tasks on that
host that require a service thread.
This patch introduces a EAGAIN like error code that the receiver sends
back to the sender if the DataStreamReceiver object is not yet ready
to receive data. The sender tries again up to 5 times with intervals
in between.
This patch also removes the closed_stream_cache in the DataStreamMgr.
Also, if the SenderQueue is full, the DataStreamRecvr does not block
in AddBatch() anymore. It returns a QUEUE_FULL error code to signal
the sender to try again.
Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
---
M be/src/runtime/data-stream-mgr.cc
M be/src/runtime/data-stream-mgr.h
M be/src/runtime/data-stream-recvr.cc
M be/src/runtime/data-stream-recvr.h
M be/src/runtime/data-stream-sender.cc
M be/src/runtime/data-stream-test.cc
M common/thrift/generate_error_codes.py
7 files changed, 112 insertions(+), 262 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/91/5491/4
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Lars Volker (Code Review)" <ge...@cloudera.org>.
Lars Volker has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 226: FLAGS_datastream_sender_timeout_ms
> rather than have the sleep period be a function of the total timeout, it ma
Does it make sense to add some exponential back-off here, let's say up to a maximum value? That way, if the sender out-races the receiver we will try again sooner and bound delays.
http://gerrit.cloudera.org:8080/#/c/5491/1/common/thrift/generate_error_codes.py
File common/thrift/generate_error_codes.py:
Line 233: ("DATASTREAM_SENDER_TIMEOUT", 72, "Sender timed out waiting for receiver fragment "
Should we mark this as deprecated here?
PS1, Line 314: DATASTREAM_RECEIVER_EAGAIN
Would it make sense to name this more general, e.g. "RPC_TRY_AGAIN" so we can re-use it in similar situations?
Line 315: "Datastream receiver is not yet ready"),
nit: single line?
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Sailesh Mukil (Code Review)" <ge...@cloudera.org>.
Sailesh Mukil has abandoned this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Abandoned
Addressed by one of the KuduRPC patches.
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: abandon
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Anonymous Coward #168
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
[Impala-ASF-CR] IMPALA-3977: TransmitData() should not block
Posted by "Henry Robinson (Code Review)" <ge...@cloudera.org>.
Henry Robinson has posted comments on this change.
Change subject: IMPALA-3977: TransmitData() should not block
......................................................................
Patch Set 1:
(8 comments)
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-mgr.cc
File be/src/runtime/data-stream-mgr.cc:
PS1, Line 53: STREAM_EXPIRATION_TIME_MS
Do you think we still need the stream cache? In the case where a receiver has completed before it receives an initial RPC, we should be able to rely on cancellation being detected on the sender side. The cost is that we might retry that initial RPC a couple of times before we receive cancellation from the coordinator.
Can you think this through and work out whether there's a state where the stream cache is really worth the extra complexity?
PS1, Line 99: if (acquire_lock) lock_.lock();
Can we just require now that the caller takes the lock?
http://gerrit.cloudera.org:8080/#/c/5491/1/be/src/runtime/data-stream-sender.cc
File be/src/runtime/data-stream-sender.cc:
PS1, Line 209: TTransmitDataResult res;
Let's move this inside the loop so it's freshly initialized on each iteration. That avoids any bugs where one RPC returns EAGAIN and sets a field in the result that - for some reason - a subsequent successful RPC does not overwrite.
PS1, Line 217: DoTransmitDataRpc
Since a row batch can potentially be many megabytes large, I wonder if it makes sense to have an initial 'probe' RPC that has no payload, but just confirms that the receiver is ready. Then we can limit the retry logic to that probe only, and if a subsequent RPC returns EAGAIN, we know that the receiver is closed and don't need to retry.
Line 224: if (res.status.status_code != TErrorCode::DATASTREAM_RECEIVER_EAGAIN) break;
Is cancellation detected during this loop? That's part of the point of moving control back to the sender on EAGAIN, so that cancellation can be detected. Otherwise this blocks from the sender's perspective in the same way that it did before.
PS1, Line 225: VLOG_RPC << "Datastream receiver not yet ready. Retrying";
Not very informative without the fragment ID / destination address etc.
PS1, Line 226: FLAGS_datastream_sender_timeout_ms
rather than have the sleep period be a function of the total timeout, it makes more sense to have a fixed retry interval and exit this loop if the timeout has been exceeded.
For example, if someone sets the timeout to ten minutes (because they're being ultra conservative on a heavy cluster), this will retry every two minutes.
Line 228:
I think it's a bit confusing to have this method return EAGAIN upon failure. Can you replace the status with timeout if it times-out of the loop?
--
To view, visit http://gerrit.cloudera.org:8080/5491
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I47f9d6c1de95a72ab73471dcd2a3118ef13e7db0
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Henry Robinson <he...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes