roee zi
roee zi

Reputation: 131

Clickhouse Unable to attach part because of file permission

I'm having some problem backing up partitions and loading them to another instance.

I've done the following

ALTER TABLE Test FREEZE PARTITION 201912

took the generated partition from shadow and moved it to another instance under detached folder , and then ran ALTER TABLE Test ATTACH PARTITION 201912

and it failed for "Access to file denied /....attaching_2019../

which is odd because I set the entire lib with 777 permission and it's happening , any idea?

attaching the error

2019.12.16 08:28:55.541817 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> executeQuery: (from [::ffff:127.0.0.1]:47426) ALTER TABLE test ATTACH PARTITION 201912
2019.12.16 08:28:55.541967 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> default.test: Looking for parts for partition 201912 in detached/
2019.12.16 08:28:55.542005 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> default.test: Found part 201912_0_1_1
2019.12.16 08:28:55.542020 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> default.test: 1 of them are active
2019.12.16 08:28:55.542053 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> default.test: Checking parts
2019.12.16 08:28:55.542061 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> default.test: Checking part attaching_201912_0_1_1
2019.12.16 08:28:55.543951 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Trace> default.test: Renaming temporary part detached/attaching_201912_0_1_1 to 201912_6_6_0.
2019.12.16 08:28:55.544832 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> MemoryTracker: Peak memory usage (total): 0.00 B.
2019.12.16 08:28:55.544864 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Error> executeQuery: Poco::Exception. Code: 1000, e.code() = 1, e.displayText() = Access to file denied: insufficient permissions: /data/clickhouse/data/data/default/test/detached/attaching_201912_0_1_1 (version 19.16.3.6 (official build) (from [::ffff:127.0.0.1]:47426) (in query: ALTER TABLE test ATTACH PARTITION 201912 )
2019.12.16 08:28:55.544954 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Debug> MemoryTracker: Peak memory usage (for query): 0.00 B.
2019.12.16 08:28:55.544972 [ 65 ] {b62d9630-7ab2-48a4-89a5-47d296151802} <Information> TCPHandler: Processed in 0.003 sec

Upvotes: 0

Views: 1819

Answers (1)

Kushagra Verma
Kushagra Verma

Reputation: 489

chown -R clickhouse  /var/lib/clickhouse

This fixed the issue for me

Upvotes: 3

Related Questions