[ 
https://issues.apache.org/jira/browse/HIVE-9310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288028#comment-14288028
 ] 

Prasanth Jayachandran commented on HIVE-9310:
---------------------------------------------

[~gopalv] Yes. The history dir is the user's home directory which exists. The 
history file .hivehistory also exists (will be created if it doesn't exist). 
But still the commands are not logged to the hive history file.

To reproduce
1) Remove the .hivehistory file
2) Restart hive cli
3) Run some commands and quit cli
4) When we rerun the hive cli again, press up arrow nothing will show up from 
history. 

I suspect, the flushing doesn't happen because of quit command which issues 
System.exit(0) and quits the cli without ever calling the history.flush(). Same 
happens with SIGINT as well. I think we need to flush the history before 
processing every command. Adding the history flushing just before executing the 
command seems to fix the issue. I can put up a patch for it if you can confirm 
that the current way of flushing does not work.

> CLI JLine does not flush history back to ~/.hivehistory
> -------------------------------------------------------
>
>                 Key: HIVE-9310
>                 URL: https://issues.apache.org/jira/browse/HIVE-9310
>             Project: Hive
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 0.15.0
>            Reporter: Gopal V
>            Assignee: Gopal V
>            Priority: Minor
>             Fix For: 0.15.0
>
>         Attachments: HIVE-9310.1.patch
>
>
> Hive CLI does not seem to be saving history anymore.
> In JLine with the PersistentHistory class, to keep history across sessions, 
> you need to do {{reader.getHistory().flush()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to