Thomas Tauber-Marshall has posted comments on this change.

Change subject: IMPALA-5416: Fix an impala-shell command recursion bug
......................................................................


Patch Set 2:

(1 comment)

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

PS2, Line 12: The cause is that there is a "cmdqueue" member in cmd library, 
which is
            : used to execute commands not directly from user input. When 
impala-shell
            : reads a line with multiple commands, it splits the line into 
multiple
            : queries and insert them into the queue, and then gives control 
back to
            : the eventloop in cmd library. The problem is that a source command
            : calls execute_query_list(), which executes queries in the 
cmdqueue as
            : well. So any query in the cmdqueue will be executed twice. And if 
there
            : is unfortunately a source command in the cmdqueue, it will call
            : execute_query_list() again, and there will be an infinite 
recursion.
            : The original purpose of running queued queries in 
execute_query_list()
            : is that in non-interactive mode, there is no event loop. And 
still,
            : there are queries like "use database" queued by connection setup
            : procedures, which need to be run before the user query.
            : This patch avoids running queries from the queue in
            : execute_query_list(), and for non-interactive mode, runs queued 
queries
            : in execute_queries_non_interactive_mode() instead.
Thanks for the explanation.

Hate to be picky, but this is more technical detail than I was looking for. The 
idea here is to give the reader a high level idea of what's going on while 
keeping it simple.

Maybe something like (assuming I understand completely):
The cmdqueue member of cmd.Cmd is used to execute commands not directly from 
user input in an event loop. When a 'source' is run, execute_query_list() is 
called which also executes the commands in cmdqueue, causing them to be 
executed twice.

The fix is for execute_query_list() to not run the commands in cmdqueue. For 
the non-interactive case, where the event loop won't be run, we call 
execute_query_list() with cmdqueue so that the commands get run.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I453af2d4694d47e184031cb07ecd2af259ba20f3
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tianyi Wang <tw...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tmarsh...@cloudera.com>
Gerrit-Reviewer: Tianyi Wang <tw...@cloudera.com>
Gerrit-HasComments: Yes

Reply via email to