Tamas Mate has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/15345 )

Change subject: IMPALA-9398: Fix shell history duplication when cmdloop breaks
......................................................................


Patch Set 4:

Hi Fang-Yu,

It is a bit hard to create formatted text on gerrit, I am splitting the 
paragraphs with "---".
---
ImpalaShell.postloop() will only be called once per ImpalaShell object lifetime 
because it is tied to ImpalaShell.is_alive. The postloop() does the persisting 
of history and can be reached when the Cmd.cmdloop() is stopped normally. This 
is where it is called:
https://github.com/python/cpython/blob/master/Lib/cmd.py#L139
---
This postloop() can be reached when the postcmd() in line 139 returns True. 
ImpalaShell.postcmd() just returns the status provided by the caller.
https://github.com/apache/impala/blob/master/shell/impala_shell.py#L664
---
The status can be the following three predefined in impala-shell.py CmdStatus:
https://github.com/apache/impala/blob/master/shell/impala_shell.py#L81
---
I am skipping some part of the code flow here and changing my approach. From 
this point the relevant status is CmdStatus.ABORT, because that is the only one 
with True value which could stop the Cmd.cmdloop() normally. Abort is only 
returned by the ImpalaShell.do_quit(). This method can be called multiple ways, 
however it ties the ABORT and is_alive=False together. When is_alive is false, 
ImpalaShell's main loop terminates, therefore with normal quit both loops and 
ImpalaShell will be terminated.
https://github.com/apache/impala/blob/master/shell/impala_shell.py#L787
---
The reading logic was moved to the constructor next to where the readline 
module is being imported.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If4faf46134f44d91e56748642f47d448707db53c
Gerrit-Change-Number: 15345
Gerrit-PatchSet: 4
Gerrit-Owner: Tamas Mate <tm...@cloudera.com>
Gerrit-Reviewer: David Knupp <dkn...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fangyu....@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Tamas Mate <tm...@cloudera.com>
Gerrit-Reviewer: Vincent Tran <vtt...@cloudera.com>
Gerrit-Comment-Date: Wed, 08 Apr 2020 09:18:51 +0000
Gerrit-HasComments: No

Reply via email to