Skip to content

Avoid re-loading completion from the history file after each query#13086

Merged
alexey-milovidov merged 2 commits intoClickHouse:masterfrom
azat:client-replxx-no-load-on-save
Jul 30, 2020
Merged

Avoid re-loading completion from the history file after each query#13086
alexey-milovidov merged 2 commits intoClickHouse:masterfrom
azat:client-replxx-no-load-on-save

Conversation

@azat
Copy link
Member

@azat azat commented Jul 29, 2020

Changelog category (leave one):

  • Other

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Avoid re-loading completion from the history file after each query (to avoid history overlaps with other client sessions)

By default replxx reload history from the file in
replxx::Replxx::history_save(), and this will overlaps current session
history with the history from other sessions, and this does not looks a
great idea (bash and other interpreters don't do this).

So to avoid this, use separate replxx::Replxx instance.

Refs: #11453

azat added 2 commits July 29, 2020 21:00
By default replxx reload history from the file in
replxx::Replxx::history_save(), and this will overlaps current session
history with the history from other sessions, and this does not looks a
great idea (bash and other interpreters don't do this).

So to avoid this, use separate replxx::Replxx instance.
@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 29, 2020
@alexey-milovidov
Copy link
Member

But when we save history from different clients, all histories should be saved.
(Bash and all readline-based tools that I know don't do that and it's a huge drawback).

@alexey-milovidov alexey-milovidov self-assigned this Jul 29, 2020
@alexey-milovidov
Copy link
Member

The code looks Ok.

@alexey-milovidov
Copy link
Member

This is significant change for changelog, please edit the description accordingly.

@azat
Copy link
Member Author

azat commented Jul 29, 2020

(Bash and all readline-based tools that I know don't do that and).

By default, but can be enabled in bash:

shopt -s histappend
# or proper append ...
PROMPT_COMMAND='history -a'

it's a huge drawback

Agree, bash is completely unusable w/o this

This is significant change for changelog, please edit the description accordingly.

Ok

@robot-clickhouse robot-clickhouse added the pr-other Pull request with changes not fitting to other categories label Jul 29, 2020
@alexey-milovidov
Copy link
Member

I usually have 10s of tabs with bash opened and I would prefer shared history on every server.
So, when I click on random tab and press "Up", I will see full history.

You said that according to your experience, it's not convenient for clickhouse-client... Ok but I don't understand why.

@azat
Copy link
Member Author

azat commented Jul 29, 2020

I usually have 10s of tabs with bash opened and I would prefer shared history on every server.
So, when I click on random tab and press "Up", I will see full history.

You mean inter-server history?

You said that according to your experience, it's not convenient for clickhouse-client... Ok but I don't understand why.

I'm running multiple instances of clickhouse-client that are for different things, and when I write something in one, I get the same query in another, that is not what I want (for me the history should be saved but should not be reloaded after each query execution)

Looks like you don't need/want this, then how about add an option for this?

@alexey-milovidov
Copy link
Member

Looks like you don't need/want this, then how about add an option for this?

No, option is too complex, no one will use it.
Let's proceed with your variant.

@azat
Copy link
Member Author

azat commented Jul 30, 2020

Looks like pr-not-for-changelog label should be removed?

@alexey-milovidov alexey-milovidov removed the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 30, 2020
@alexey-milovidov alexey-milovidov merged commit c6ac339 into ClickHouse:master Jul 30, 2020
@azat azat deleted the client-replxx-no-load-on-save branch July 30, 2020 12:12
@alexey-milovidov
Copy link
Member

After this PR client started to be extremely slow in debug build (about 0.5 seconds per query) in interactive mode. Revert?

@azat
Copy link
Member Author

azat commented Aug 2, 2020

After this PR client started to be extremely slow in debug build (about 0.5 seconds per query) in interactive mode. Revert?

@alexey-milovidov let me fix it in another way

@azat
Copy link
Member Author

azat commented Aug 2, 2020

@alexey-milovidov How about ClickHouse/replxx#10 ? (After I will submit PR that uses this flag)

azat added a commit to azat/ClickHouse that referenced this pull request Oct 12, 2020
This replxx object is pretty heavy and in debug build may slow down [1]
(although I cannot confirm 0.5s delay for each query in debug build) the
client and besides it is not required since ClickHouse/replxx#10,
which changes the behaviour of history_save(), and now it will not
update current session anymore, only save the history to the disk.

  [1]: ClickHouse#13086 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-other Pull request with changes not fitting to other categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants