Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system.detached_parts doesn't works after change detault storage policy to multiple disk #26078

Closed
Slach opened this issue Jul 8, 2021 · 0 comments · Fixed by #26236
Closed
Assignees
Labels
easy task Good for first contributors feature minor Priority: minor

Comments

@Slach
Copy link
Contributor

Slach commented Jul 8, 2021

Describe the bug

After adding the second disk to default storage policy, any questions to system.detached_parts return error

Does it reproduce on recent release?

yes reproduced, and any LTS release 20.3 (ordinary), 20.8 21.3

How to reproduce

git clone https://gist.github.com/c17d50ca4b2e2785ce957debc7548420.git ./detached_and_storage_policy 
cd ./detached_and_storage_policy 
bash -x steps-to-reproduce.sh
  • Queries to run that lead to unexpected result
SELECT
  count() AS detached_parts,
  database,
  table,
  disk,
  if(coalesce(reason,'unknown')='','detached_by_user',coalesce(reason,'unknown')) AS detach_reason
FROM system.detached_parts
GROUP BY
  database,
  table,
  disk,
  reason

Expected behavior
empty result

Error message and/or stacktrace

2021.07.08 13:01:53.805096 [ 51 ] {52b361e2-8e58-4757-859e-7f867a3f7a8b} <Error> executeQuery: Poco::Exception. Code: 1000, e.code() = 2, e.displayText() = File not found: /var/lib/clickhouse2/store/8f9/8f932fde-af5a-43e1-8f93-2fdeaf5af3e1/detached (version 21.6.6.51 (official build)) (from 127.0.0.1:60496) (in query:  SELECT count() AS detached_parts, database, table, disk, if(coalesce(reason,'unknown')='','detached_by_user',coalesce(reason,'unknown')) AS detach_reason FROM system.detached_parts GROUP BY database, table, disk, reason ), Stack trace (when copying this message, always include the lines below):

0. Poco::FileImpl::handleLastErrorImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x12b47ab5 in /usr/bin/clickhouse
1. Poco::DirectoryIteratorImpl::DirectoryIteratorImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x12b30b97 in /usr/bin/clickhouse
2. Poco::DirectoryIterator::DirectoryIterator(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x12b30e3f in /usr/bin/clickhouse
3. DB::DiskLocalDirectoryIterator::DiskLocalDirectoryIterator(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xf4a5b9d in /usr/bin/clickhouse
4. DB::DiskLocal::iterateDirectory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xf4a2643 in /usr/bin/clickhouse
5. DB::MergeTreeData::getDetachedParts() const @ 0x1017d7a4 in /usr/bin/clickhouse
6. DB::StorageSystemDetachedParts::read(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo&, std::__1::shared_ptr<DB::Context>, DB::QueryProcessingStage::Enum, unsigned long, unsigned int) @ 0xef96f79 in /usr/bin/clickhouse
7. DB::IStorage::read(DB::QueryPlan&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo&, std::__1::shared_ptr<DB::Context>, DB::QueryProcessingStage::Enum, unsigned long, unsigned int) @ 0xfe06117 in /usr/bin/clickhouse
8. DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) @ 0xf921a2f in /usr/bin/clickhouse
9. DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::shared_ptr<DB::IBlockInputStream> const&, std::__1::optional<DB::Pipe>) @ 0xf919463 in /usr/bin/clickhouse
10. DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0xf918520 in /usr/bin/clickhouse
11. DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0xfa888de in /usr/bin/clickhouse
12. DB::InterpreterSelectWithUnionQuery::execute() @ 0xfa899b1 in /usr/bin/clickhouse
13. ? @ 0xfc44781 in /usr/bin/clickhouse
14. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, bool) @ 0xfc42e03 in /usr/bin/clickhouse
15. DB::TCPHandler::runImpl() @ 0x10468bb2 in /usr/bin/clickhouse
16. DB::TCPHandler::run() @ 0x1047bab9 in /usr/bin/clickhouse
17. Poco::Net::TCPServerConnection::start() @ 0x12a7a50f in /usr/bin/clickhouse
18. Poco::Net::TCPServerDispatcher::run() @ 0x12a7bf9a in /usr/bin/clickhouse
19. Poco::PooledThread::run() @ 0x12bb52f9 in /usr/bin/clickhouse
20. Poco::ThreadImpl::runnableEntry(void*) @ 0x12bb12ea in /usr/bin/clickhouse
21. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
22. clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so

Additional context
for Ordinary database

Received exception from server (version 20.3.21):
Code: 1000. DB::Exception: Received from localhost:9000. DB::Exception: File not found: /var/lib/clickhouse2/data/default/t1/detached.

Also a lot of background errors in logs with directory in not exists, but it not affect to successful work

@Slach Slach added the bug Confirmed user-visible misbehaviour in official release label Jul 8, 2021
@alexey-milovidov alexey-milovidov added minor Priority: minor feature easy task Good for first contributors and removed bug Confirmed user-visible misbehaviour in official release labels Jul 9, 2021
@alexey-milovidov alexey-milovidov self-assigned this Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy task Good for first contributors feature minor Priority: minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants