You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Gabor Kaszab (Code Review)" <ge...@cloudera.org> on 2017/11/15 00:16:38 UTC

[Impala-ASF-CR] IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

Gabor Kaszab has uploaded this change for review. ( http://gerrit.cloudera.org:8080/8549


Change subject: IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell
......................................................................

IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

When query was cancelled via CTRL+C while Impala-shell was fetching the
query results then an exception was thrown from Impala backend saying
'Invalid query handle'.
This was because one ImpalaClient was fetching the result in a loop while
another ImpalaClient cancelled the query on the backend without letting the
fetching client know that the query was cancelled. As a result when the
resources needed for fetching the results were cleared from the backend
the related ClientRequestState was not found anymore.

As a solution query cancellation is indicated to ImpalaClient via a bool
member, and fetching stops if it indicates cancellation.

Another issue was that every time a query was cancelled a 'use db' command
was issued automatically. This happened to historical reasons but not needed
anymore (see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
2 files changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/1
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 1
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 9:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/1538/


-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 9
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 29 Nov 2017 00:12:27 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 6:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
> The test reproducing this seems pretty stable.
Aparently, the new tests pass with debug build, but fail for both release and asan builds. I'll have to dig deeper, but I suspect that the 0.5 sec sleep won't be enough for them.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 6
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Tue, 21 Nov 2017 17:34:18 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

Posted by "David Knupp (Code Review)" <ge...@cloudera.org>.
David Knupp has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_client.py@336
PS2, Line 336:         break;
Python abhors a semi-colon.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 2
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 15 Nov 2017 00:40:35 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Philip Zeyliger (Code Review)" <ge...@cloudera.org>.
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 5:

> The only way to guarantee that there is no race condition around is_query_cancelled flag is to Introduce locking around that variable.

It certainly does make sense to swallow cancellation errors, especially if they're "query doesn't exist."

I'll note that if we're having trouble with the "reset", we need not: a query can only go from running to cancelled. It can't go from cancelled back to running. There's still a race, of course, if the query finishes and we try to cancel it, which is what I think you're saying.

> Re: flaky tests

If it's stable ~100 times, I think it's fine to push it in. If it turns out to be a bad idea, we'll change the test.


-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 5
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Sat, 18 Nov 2017 00:52:16 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 3:

(6 comments)

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@7
PS2, Line 7: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
> Perhaps: Fix exception when cancelling query in impala-shell with Ctrl-C
Done


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@11
PS2, Line 11: 'Invalid query handle'. This was because one ImpalaClient was fetching
> nit: reformat this as one paragraph?
Done


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@22
PS2, Line 22: was issued automatically. This happened to historical reasons but is not
> nit: "but is not needed" (insert "is")
Done


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Tested manually starting with a select from a random table that has few
> Can we write a normal test for this? I don't know if it's true, but "select
I haven't figured out a way to test this automatically.
The one you mention wouldn't cover this case as this issue only appears if the Impala-shell had started fetching the results when the cancellation comes. With sleep(..) no fetching is done, hence the issue is not triggered.

I'm open to further suggestions though :)


http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_client.py@336
PS2, Line 336:         break
> Python abhors a semi-colon.
Done


http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_shell.py
File shell/impala_shell.py:

http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_shell.py@485
PS2, Line 485:         new_imp_client = self._new_impala_client()
> does new_imp_client need to be closed? or old_imp_client?
The only purpose of new_imp_client is to cancel the query while the old_imp_shell is busy fetching the results. Once, that happened we keep the old_imp_client and let the new_imp_client disappear.

Btw, I checked the open connections of an impalad before and after doing my tests, and the number doesn't increase so old_imp_client's connections gets closed by destructing it's members.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 3
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 15 Nov 2017 04:24:03 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 9: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 9
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 29 Nov 2017 00:12:20 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#6).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 56 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/6
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 6
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#7).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 56 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/7
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 7
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#5).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 54 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/5
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 5
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 5:

(4 comments)

We discussed this issue with Tim from a different angle with the following outcome:
- The only way to guarantee that there is no race condition around is_query_cancelled flag is to Introduce locking around that variable.
- To make this work well the flag should be checked inside _do_rpc right before the rpc() call. In addition the rpc() call itself should be protected by the same lock block we use for is_query_cancelled check.
- Unfortunately, as a result cancelling a query would have to wait until the actual rpc() call is finished. If it runs long then we've shot ourselves in the foot as the error wont be shown at the end but the query cancellation would lag for long.

For a solution we considered a symptomatic treatment like approach to let the whole cancellation race condition throw it's exception and then where we catch that exception we can decide to suppress it or not.

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
> So, um, if you want a query that returns a lot of rows:
Thanks for the nice example, Phil!

I created a TC using your example and it seems to stably reproduce the issue. I wonder what is the probability of this test to become flaky. (I executed it like 100 times and seems to be still stable)


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@319
PS3, Line 319:   def wait_to_finish(self, last_query_handle, periodic_callback=None):
> Do we also need to check is_cancelled here? In the case of a long-running D
Indeed.


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@335
PS3, Line 335:     """Fetch all the results.
> Why does this need to be set back to False? Seems confusing since the query
This in fact not needed here.
Done


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@355
PS3, Line 355:         if not result.has_more:
> I think some of these other methods might also be subject to the same bug -
Good point, thx.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 5
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Sat, 18 Nov 2017 00:33:43 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 3:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@319
PS3, Line 319:       elif query_state == self.query_state["EXCEPTION"]:
Do we also need to check is_cancelled here? In the case of a long-running DML query like an insert, not sure if an error can bubble up here.


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@334
PS3, Line 334:       if self.is_query_cancelled:
How do we avoid the two threads racing?

E.g. 
* Fetch thread checks is_query_cancelled, sees False, then starts fetch RPC
* Cancellation thread sets is_query_cancelled to True and sends Cancelled RPC around the same time
* Fetch fails, either with CANCELLED or invalid query handle
* The cancelled or invalid query handle bubbles up to the client.

Assignment of variables is atomic in Python, so I think it's sufficient to re-check is_query_cancelled after the fetch RPC returns, but we should add some concise comments to explain how concurrent fetch and cancel work.


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@335
PS3, Line 335:         self.is_query_cancelled = False
Why does this need to be set back to False? Seems confusing since the query is still cancelled and we haven't started a new one at this point. Isn't setting it in execute_query() sufficient.


http://gerrit.cloudera.org:8080/#/c/8549/3/shell/impala_client.py@355
PS3, Line 355:   def close_dml(self, last_query_handle):
I think some of these other methods might also be subject to the same bug - it seems like these RPCs could race with cancellation too.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 3
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 15 Nov 2017 17:45:28 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 8: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 8
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 29 Nov 2017 00:12:09 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, Dan Hecht, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#3).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

When query was cancelled via CTRL-C while Impala-shell was fetching the
query results then an exception was thrown from Impala backend saying
'Invalid query handle'. This was because one ImpalaClient was fetching
the results in a loop while another ImpalaClient cancelled the query on
the backend without letting the fetching client know that the query was
cancelled. As a result when the resources needed for fetching the results
were cleared from the backend the related ClientRequestState was not
found anymore.

As a solution query cancellation is indicated to ImpalaClient via a bool
member, and fetching stops if it indicates cancellation.

Another issue was that every time a query was cancelled a 'use db' command
was issued automatically. This happened to historical reasons but is not
needed anymore (see Jira for more details).

Tested manually starting with a select from a random table that has few
million rows. When the result rows started to show I hit CTRL+C to cancel
the query. Verified that the query stops, no error message, and no use
statement is executed.
After this I executed another random select query to see that fetching
still works and the cancellation indicator was reset successfully.

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/3
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 3
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

Posted by "Philip Zeyliger (Code Review)" <ge...@cloudera.org>.
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell
......................................................................


Patch Set 2:

(5 comments)

The Python looks fine to me (after David's semicolon comment). I think it'd be good to try to add a regular test for cancellation in the shell.

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@7
PS2, Line 7: IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell
Perhaps: Fix exception when cancelling query in impala-shell with Ctrl-C

"when CTRL+C" reads oddly to me.


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@11
PS2, Line 11: 'Invalid query handle'.
nit: reformat this as one paragraph?


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@22
PS2, Line 22: was issued automatically. This happened to historical reasons but not needed
nit: "but is not needed" (insert "is")


http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Tested manually starting with a select from a random table that has few
Can we write a normal test for this? I don't know if it's true, but "select sleep(60000) from functional.whatever" may actually work with cancellation. Or it may not: I haven't tried it!


http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_shell.py
File shell/impala_shell.py:

http://gerrit.cloudera.org:8080/#/c/8549/2/shell/impala_shell.py@485
PS2, Line 485:         new_imp_client = self._new_impala_client()
does new_imp_client need to be closed? or old_imp_client?



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 2
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 15 Nov 2017 00:52:20 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 5:

(10 comments)

Overall approach seems good to me, but had quite a few comments about comments and naming.

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
> Thanks for the nice example, Phil!
It seems ok that it doesn't reproduce it every time - it's inherently racy. We could probably have a deterministic unit test by mocking out enough things, but I think I prefer the end-to-end shell test.

It would be good to also test on release and ASAN builds to make sure that it doesn't immediately fail when the daemon is slow or fast.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@58
PS5, Line 58: QueryCancelledException
Can we call this QueryCancelledByShellException or ExpectedQueryCancellationException or something like that to distinguish from the case when the query was cancelled unexpectedly (e.g. by an admin from the impala debug ui).


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@60
PS5, Line 60:       self.value = value
The value might not be necessary if we're always going to pass in the same string. The existing exceptions do this but seems like an odd pattern. We could just print that string instead of stringifying the exception.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@83
PS5, Line 83:     self.is_query_cancelled = False
Can you add a brief comment explaining how this works. I.e. that it's set to true by the cancellation signal handler and suppresses any errors after cancellation.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@435
PS5, Line 435:     except BeeswaxService.QueryNotFoundException:
It's weird that we don't need the logic for QueryNotFoundException. Does Impala even throw this? I'm ok with leaving this in since it's part of the beeswax protocol but we should also check for cancellation for consistency.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_shell.py
File shell/impala_shell.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_shell.py@1026
PS5, Line 1026:       print_to_stderr(str(e))
It might be to just not print anything - we don't always throw this exception when the query is cancelled so the message only gets printed sometimes.


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py
File tests/shell/test_shell_commandline.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@333
PS5, Line 333:         'select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9;"'
Maybe add a few more tables to the cross join to make sure that it runs for a very long time. We don't want a flaky test if it sometimes finishes quicker.


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@342
PS5, Line 342:            'tpch.customer c3 order by c1.c_name"'
You could also do something like:
  order by c1.c_name, sleep(1)

That would make it pause 1ms per row and slow it down further.


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@346
PS5, Line 346: query_txt
Isn't this the command-line arguments?


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@349
PS5, Line 349:     sleep(3)
Can you add a comment to the function explaining that it waits 3 seconds before cancelling and expects the query to be cancelled.

Is there any reason why 3 seconds is the right amount of time? Currently it just seems like a magic number. Would be good to reduce it if possible, since it will make the tests very slow (other shell tests have this problem already).



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 5
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 20 Nov 2017 18:41:17 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue 1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue 2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Reviewed-on: http://gerrit.cloudera.org:8080/8549
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 56 insertions(+), 6 deletions(-)

Approvals:
  Tim Armstrong: Looks good to me, approved
  Impala Public Jenkins: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 10
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, Dan Hecht, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#2).

Change subject: IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell
......................................................................

IMPALA-1144: Fix exception when CTRL+C on running query in Impala-shell

When query was cancelled via CTRL+C while Impala-shell was fetching the
query results then an exception was thrown from Impala backend saying
'Invalid query handle'.
This was because one ImpalaClient was fetching the result in a loop while
another ImpalaClient cancelled the query on the backend without letting the
fetching client know that the query was cancelled. As a result when the
resources needed for fetching the results were cleared from the backend
the related ClientRequestState was not found anymore.

As a solution query cancellation is indicated to ImpalaClient via a bool
member, and fetching stops if it indicates cancellation.

Another issue was that every time a query was cancelled a 'use db' command
was issued automatically. This happened to historical reasons but not needed
anymore (see Jira for more details).

Tested manually starting with a select from a random table that has few
million rows. When the result rows started to show I hit CTRL+C to cancel
the query. Verified that the query stops, no error message, and no use statement
is executed.
After this I executed another random select query to see that fetching still
works and the cancellation indicator was reset successfully.

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/2
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 2
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 6:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8549/6/tests/shell/test_shell_commandline.py
File tests/shell/test_shell_commandline.py:

http://gerrit.cloudera.org:8080/#/c/8549/6/tests/shell/test_shell_commandline.py@352
PS6, Line 352:     sleep(0.5)
Increased this to 1.5 as RELEASE and ASAN build failed with this value.
As a result RELEASE passes but ASAN still fails. Increasing this further to check where ASAN turns green.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 6
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 22 Nov 2017 18:23:35 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 7:

(1 comment)

Apparently, the 2s timeout is the value where all the builds (DEBUG, RELEASE, ASAN) succeed.

(Note, I moved locally this atch separate from the query option branch, hence you see those changes removed in the 7th patch set)

http://gerrit.cloudera.org:8080/#/c/8549/6//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/6//COMMIT_MSG@9
PS6, Line 9: Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
> nit: "Issue 1" reads better to me.
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 7
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Nov 2017 08:35:33 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#4).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 56 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/4
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 4
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Philip Zeyliger (Code Review)" <ge...@cloudera.org>.
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 6: Code-Review+1

(1 comment)

Looks good to me at this point. I'll let you figure out the right timings for the test. Feel free to limit the environments in which we run it, too.

http://gerrit.cloudera.org:8080/#/c/8549/6//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/6//COMMIT_MSG@9
PS6, Line 9: Issue1: When query is cancelled via CTRL-C while being executed in Impala-shell
nit: "Issue 1" reads better to me.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 6
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 22 Nov 2017 18:46:15 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Philip Zeyliger (Code Review)" <ge...@cloudera.org>.
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Tested manually starting with a select from a random table that has few
> I haven't figured out a way to test this automatically.
So, um, if you want a query that returns a lot of rows:

 with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9

will do it. (Customize as necessary.) 

In my very quick experiment, that query is long enough that Ctrl-C worked (but got the query handle error), and, um, takes 20 seconds to go to /dev/null, so you've got time to try the cancellation.

$impala-shell.sh --query ' with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9' -o /dev/null
Starting Impala Shell without Kerberos authentication
Connected to localhost:21000
Server version: impalad version 2.11.0-SNAPSHOT DEBUG (build 454a4aefa426725ab8806cfc814fb8e9df3ab8e5)
Query: with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9
Fetched 262144 row(s) in 21.50s

$impala-shell.sh --query ' with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9' -o /dev/null
Starting Impala Shell without Kerberos authentication
Connected to localhost:21000
Server version: impalad version 2.11.0-SNAPSHOT DEBUG (build 454a4aefa426725ab8806cfc814fb8e9df3ab8e5)
Query: with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9
^C Cancelling Query
ERROR: Invalid query handle: 864b2a5cd241853b:c45bb8fe00000000

Could not execute command: with v as (values (1 as x), (2), (3), (4)) select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, v v9


Note that I didn't get "Invalid query handle" every time; depends a little bit on the timing of Ctrl-C.



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 3
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 15 Nov 2017 05:03:45 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 6:

(10 comments)

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/8549/2//COMMIT_MSG@25
PS2, Line 25: Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
> It seems ok that it doesn't reproduce it every time - it's inherently racy.
The test reproducing this seems pretty stable.
I'll run the production/ASAN tests, sure.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py
File shell/impala_client.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@58
PS5, Line 58: QueryCancelledByShellEx
> Can we call this QueryCancelledByShellException or ExpectedQueryCancellatio
Sure, I'll go for QueryCancelledByShellException.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@60
PS5, Line 60: class ImpalaClient(object):
> The value might not be necessary if we're always going to pass in the same 
Done


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@83
PS5, Line 83: 
> Can you add a brief comment explaining how this works. I.e. that it's set t
Done


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_client.py@435
PS5, Line 435:       if suppress_error_on_cancel and self.is_query_cancelled:
> It's weird that we don't need the logic for QueryNotFoundException. Does Im
I haven't found any usage in the non-generated part of Impala.
I'll add the cancellation check here, though to make consistent.


http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_shell.py
File shell/impala_shell.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/shell/impala_shell.py@1026
PS5, Line 1026:           (verb, num_rows, error_report, time_elapsed))
> It might be to just not print anything - we don't always throw this excepti
Done


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py
File tests/shell/test_shell_commandline.py:

http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@333
PS5, Line 333:         'select * from v, v v2, v v3, v v4, v v5, v v6, v v7, v v8, ' + \
> Maybe add a few more tables to the cross join to make sure that it runs for
Well, this already runs for more than 20s but I see your point, we can be on the safe side adding more tables.
With 2 more tables the runtime increases over 5min :)

Done


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@342
PS5, Line 342:     args = '-q "select * from tpch.customer c1, tpch.customer c2, ' + \
> You could also do something like:
I think this query should be fine. I gave it a try and after ~30 mins it still haven't reached the fetching state.


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@346
PS5, Line 346: 
> Isn't this the command-line arguments?
Done


http://gerrit.cloudera.org:8080/#/c/8549/5/tests/shell/test_shell_commandline.py@349
PS5, Line 349:     execution in fact starts and then cancels it. Expects the query
> Can you add a comment to the function explaining that it waits 3 seconds be
Sure, I'll add these comments to the function description.

In fact, this 3 sec is a magic number I took from the other cancellation tests. I played around a little bit on my local machine and started decreasing the value. Apparently, the turning point is somewhere between 0.2 and 0.1 secs where the test starts failing.
To be on the safe side, I decided to go for 0.5sec.

Do you think it's reasonable?

(I'll kick of a release and asan test in Jenkins to see how they behave with this value)



-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 6
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 20 Nov 2017 23:51:26 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8549 )

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................


Patch Set 9: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 9
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Wed, 29 Nov 2017 03:44:50 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Posted by "Gabor Kaszab (Code Review)" <ge...@cloudera.org>.
Hello Lars Volker, Laszlo Gaal, Michael Brown, Zoltan Borok-Nagy, Philip Zeyliger, David Knupp, Attila Jeges, Tim Armstrong, Csaba Ringhofer, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/8549

to look at the new patch set (#8).

Change subject: IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C
......................................................................

IMPALA-1144: Fix exception when cancelling query in Impala-shell with CTRL-C

Issue 1: When query is cancelled via CTRL-C while being executed in Impala-shell
then an exception is thrown from Impala backend saying 'Invalid query handle'.
This is because one ImpalaClient was making RPC's while another ImpalaClient
cancelled the query on the backend. As a result RPC handlers in ImpalaServer
try to access a ClientRequestState that had been cleared from the backend. The
issue is confidently reproducable both in wait_to_finish and in fetch states of
the query.

As a solution the query cancellation is indicated to ImpalaClient via a bool
flag. Once a cancellation originated exception reaches Impala shell this flag
is checked to decide whether to suppress the error or not.

Issue 2: Every time a query was cancelled a 'use db' command was issued
automatically. This happened to historical reasons but is not needed anymore
(see Jira for more details).

Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
---
M shell/impala_client.py
M shell/impala_shell.py
M tests/shell/test_shell_commandline.py
3 files changed, 56 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/49/8549/8
-- 
To view, visit http://gerrit.cloudera.org:8080/8549
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6cefaf1dae78baae238289816a7cb9d210fb38e2
Gerrit-Change-Number: 8549
Gerrit-PatchSet: 8
Gerrit-Owner: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Attila Jeges <at...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: David Knupp <dk...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Brown <mi...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <ph...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>