Skip to content

clickhouse-local can work without tmp directory#16280

Merged
akuzm merged 6 commits intoClickHouse:masterfrom
filimonov:clickhouse-local-tmp-folder
Oct 26, 2020
Merged

clickhouse-local can work without tmp directory#16280
akuzm merged 6 commits intoClickHouse:masterfrom
filimonov:clickhouse-local-tmp-folder

Conversation

@filimonov
Copy link
Copy Markdown
Contributor

@filimonov filimonov commented Oct 23, 2020

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
If there are no tmp folder in the system (chroot, misconfigutation etc) clickhouse-local will create temporary subfolder in the current directory.

Detailed description / Documentation draft:
Some extra logging added. Fixes #12123

Before

$ TMP=/non-existent-folder-12123 clickhouse-local -q 'SELECT 1'
filesystem error: in temp_directory_path: path "/non-existent-folder-12123" is not a directory: Not a directory

After:

$ TMP=/non-existent-folder-12123 clickhouse-local -q 'SELECT 1'
1

$ TMP=/asdfasd clickhouse-local -q 'SELECT 1' --logger.console=1 
Logging trace to console
2020.10.23 14:55:45.388044 [ 223 ] {} <Debug> Application: Can not get temporary folder: filesystem error: in temp_directory_path: path "/asdfasd" is not a directory: Not a directory
2020.10.23 14:55:45.390411 [ 223 ] {} <Debug> Application: Will create working directory inside current directory: /
2020.10.23 14:55:45.390540 [ 223 ] {} <Debug> Application: Working directory created: /clickhouse-local-223-1603464945-5194555242134056268
2020.10.23 14:55:45.392250 [ 223 ] {} <Debug> Application: Loading metadata from /clickhouse-local-223-1603464945-5194555242134056268/
2020.10.23 14:55:45.420139 [ 223 ] {} <Information> DatabaseAtomic (system): Total 0 tables and 0 dictionaries.
2020.10.23 14:55:45.420166 [ 223 ] {} <Information> DatabaseAtomic (system): Starting up tables.
2020.10.23 14:55:45.421046 [ 223 ] {} <Information> BackgroundSchedulePool/BgSchPool: Create BackgroundSchedulePool with 16 threads
2020.10.23 14:55:45.422479 [ 223 ] {} <Debug> Application: Loaded metadata.
2020.10.23 14:55:45.422692 [ 223 ] {} <Trace> ContextAccess (default): Settings: readonly=0, allow_ddl=true, allow_introspection_functions=false
2020.10.23 14:55:45.422717 [ 223 ] {} <Trace> ContextAccess (default): List of all grants: GRANT SHOW, SELECT, INSERT, ALTER, CREATE, DROP, TRUNCATE, OPTIMIZE, KILL QUERY, SYSTEM, dictGet, SOURCES ON *.*
2020.10.23 14:55:45.422882 [ 223 ] {a5fb7054-15f3-4b95-9775-90174ae1a086} <Debug> executeQuery: (from 0.0.0.0:0) SELECT 1
2020.10.23 14:55:45.423244 [ 223 ] {a5fb7054-15f3-4b95-9775-90174ae1a086} <Trace> ContextAccess (default): Access granted: SELECT(dummy) ON system.one
2020.10.23 14:55:45.423335 [ 223 ] {a5fb7054-15f3-4b95-9775-90174ae1a086} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
1
2020.10.23 14:55:45.423644 [ 223 ] {a5fb7054-15f3-4b95-9775-90174ae1a086} <Information> executeQuery: Read 1 rows, 1.00 B in 0.000717001 sec., 1394 rows/sec., 1.36 KiB/sec.
2020.10.23 14:55:45.423681 [ 223 ] {a5fb7054-15f3-4b95-9775-90174ae1a086} <Debug> MemoryTracker: Peak memory usage (for query): 0.00 B.
2020.10.23 14:55:45.423984 [ 223 ] {} <Trace> BackgroundSchedulePool/BgSchPool: Waiting for threads to finish.
2020.10.23 14:55:45.424182 [ 223 ] {} <Debug> Application: Removing temporary directory: /clickhouse-local-223-1603464945-5194555242134056268
2020.10.23 14:55:45.424556 [ 223 ] {} <Debug> Application: Uninitializing subsystem: Logging Subsystem

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Oct 23, 2020
@akuzm akuzm self-assigned this Oct 26, 2020
@akuzm akuzm merged commit 6552613 into ClickHouse:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clickhouse-local does not work if there is no /tmp directory

4 participants