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

Support multiple ZooKeeper clusters #17070

Merged
merged 7 commits into from Nov 27, 2020
Merged

Support multiple ZooKeeper clusters #17070

merged 7 commits into from Nov 27, 2020

Conversation

fastio
Copy link
Contributor

@fastio fastio commented Nov 16, 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):

  • Add configuration for multi zookeeper clusters.

Now it's possible to make different ReplicatedMergeTree engine with different ZooKeeper clusters.
The auxiliary zookeepers configuration (#14155 ) is reused to support this feature.
We can create table like follow:

CREATE TABLE t1 (a String) ENGINE= ReplicatedMergeTree('test:/tables/t1','{replica}') ORDER BY a;

It means that the metadata of the table named t1 is saved in zookeeper cluster named test, which configurated in
auxiliary_zookeepers.

CREATE TABLE t2 (a String) ENGINE= ReplicatedMergeTree('/tables/t2','{replica}') ORDER BY a;
It means that the metadata of the table named t2 is saved in the default zookeeper cluster, which configurated in
zookeeper.

<auxiliary_zookeepers>


172.19.0.11
2181


</auxiliary_zookeepers>
In fact, the implementation compatibles with the old configuration.

Detailed description / Documentation draft:

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Nov 16, 2020
@fastio
Copy link
Contributor Author

fastio commented Nov 16, 2020

@Akazz I create a new pr, and close the old one #15087
Thanks for your review.

@Akazz Akazz self-assigned this Nov 16, 2020
@@ -212,6 +216,22 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
, allow_renaming(allow_renaming_)
, replicated_fetches_pool_size(global_context.getSettingsRef().background_fetches_pool_size)
{
if (zookeeper_path_.empty())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like copy-paste. We can have a common function instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I fix it soon. Thanks.

@Akazz
Copy link
Contributor

Akazz commented Nov 17, 2020

Looking good to me. Let's wait for you to make CI checks happy and merge

@Akazz
Copy link
Contributor

Akazz commented Nov 17, 2020

@fastio FYI, failed "Stress test (memory)" is irrelevant to this PR and is a known issue with RocksDB lib in our contrib.

Received signal Aborted (6)
2020.11.17 17:34:55.551210 [ 255 ] {} <Fatal> BaseDaemon: (version 20.12.1.5203, build id: 557EDE393D39EB80) (from thread 27547) Terminate called without an active exception
2020.11.17 17:34:55.677583 [ 52487 ] {} <Fatal> BaseDaemon: ########################################
2020.11.17 17:34:55.680374 [ 52487 ] {} <Fatal> BaseDaemon: (version 20.12.1.5203, build id: 557EDE393D39EB80) (from thread 27547) (query_id: 13cab25b-a12d-423f-8890-b033fd330bf7) Received signal Aborted (6)
2020.11.17 17:34:55.681426 [ 52487 ] {} <Fatal> BaseDaemon: 
2020.11.17 17:34:55.683703 [ 52487 ] {} <Fatal> BaseDaemon: Stack trace: 0x7fb1a40593eb 0x7fb1a4038899 0x8cc80ae 0x3d194299 0x3d1940d3 0x3d0cba11 0x3c28874e 0x3c285df7 0x3ba69830 0x3b946af1 0x3b93f50a 0x2bbfd59c 0x2bbfd2a1 0x2bc0387f 0x2bc1d5f3 0x2b3a503d 0x296b3c51 0x296afb2a 0x296ba558 0x2aa5c620 0x2aa573b5 0x2c7670b3 0x2c792f86 0x375ff29b 0x376008ba 0x37a8f473 0x37a8a859 0x37a86cec
2020.11.17 17:34:55.687940 [ 52487 ] {} <Fatal> BaseDaemon: 4. raise @ 0x463eb in /usr/lib/x86_64-linux-gnu/libc-2.30.so
2020.11.17 17:34:55.688782 [ 52487 ] {} <Fatal> BaseDaemon: 5. abort @ 0x25899 in /usr/lib/x86_64-linux-gnu/libc-2.30.so
2020.11.17 17:34:55.701695 [ 52487 ] {} <Fatal> BaseDaemon: 6. /build/obj-x86_64-linux-gnu/../base/daemon/BaseDaemon.cpp:384: terminate_handler() @ 0x8cc80ae in /usr/bin/clickhouse
2020.11.17 17:34:55.709344 [ 52487 ] {} <Fatal> BaseDaemon: 7. /build/obj-x86_64-linux-gnu/../contrib/libcxxabi/src/cxa_handlers.cpp:61: std::__terminate(void (*)()) @ 0x3d194299 in /usr/bin/clickhouse
2020.11.17 17:34:55.722383 [ 52487 ] {} <Fatal> BaseDaemon: 8. /build/obj-x86_64-linux-gnu/../contrib/libcxxabi/src/cxa_handlers.cpp:82: std::terminate() @ 0x3d1940d3 in /usr/bin/clickhouse
2020.11.17 17:34:55.730167 [ 52487 ] {} <Fatal> BaseDaemon: 9. /build/obj-x86_64-linux-gnu/../contrib/libcxx/src/thread.cpp:47: ? @ 0x3d0cba11 in /usr/bin/clickhouse
2020.11.17 17:34:55.746738 [ 52487 ] {} <Fatal> BaseDaemon: 10. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2363: rocksdb::Timer::Start() @ 0x3c28874e in /usr/bin/clickhouse
2020.11.17 17:34:55.759781 [ 52487 ] {} <Fatal> BaseDaemon: 11. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2587: rocksdb::StatsDumpScheduler::Register(rocksdb::DBImpl*, unsigned int, unsigned int) @ 0x3c285df7 in /usr/bin/clickhouse
2020.11.17 17:34:55.791128 [ 52487 ] {} <Fatal> BaseDaemon: 12. /build/obj-x86_64-linux-gnu/../contrib/rocksdb/db/db_impl/db_impl.cc:700: rocksdb::DBImpl::StartStatsDumpScheduler() @ 0x3ba69830 in /usr/bin/clickhouse
2020.11.17 17:34:55.844609 [ 52487 ] {} <Fatal> BaseDaemon: 13. /build/obj-x86_64-linux-gnu/../contrib/rocksdb/db/db_impl/db_impl_open.cc:1740: rocksdb::DBImpl::Open(rocksdb::DBOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<rocksdb::ColumnFamilyDescriptor, std::__1::allocator<rocksdb::ColumnFamilyDescriptor> > const&, std::__1::vector<rocksdb::ColumnFamilyHandle*, std::__1::allocator<rocksdb::ColumnFamilyHandle*> >*, rocksdb::DB**, bool, bool) @ 0x3b946af1 in /usr/bin/clickhouse
2020.11.17 17:34:55.856219 [ 52487 ] {} <Fatal> BaseDaemon: 14. /build/obj-x86_64-linux-gnu/../contrib/rocksdb/db/db_impl/db_impl_open.cc:1403: rocksdb::DB::Open(rocksdb::Options const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rocksdb::DB**) @ 0x3b93f50a in /usr/bin/clickhouse
2020.11.17 17:34:55.861052 [ 52487 ] {} <Fatal> BaseDaemon: 15. /build/obj-x86_64-linux-gnu/../src/Storages/RocksDB/StorageEmbeddedRocksDB.cpp:0: DB::StorageEmbeddedRocksDB::initDb() @ 0x2bbfd59c in /usr/bin/clickhouse
2020.11.17 17:34:55.866863 [ 52487 ] {} <Fatal> BaseDaemon: 16. /build/obj-x86_64-linux-gnu/../src/Storages/RocksDB/StorageEmbeddedRocksDB.cpp:256: DB::StorageEmbeddedRocksDB::StorageEmbeddedRocksDB(DB::StorageID const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::StorageInMemoryMetadata const&, bool, DB::Context&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x2bbfd2a1 in /usr/bin/clickhouse
2020.11.17 17:34:55.878793 [ 52487 ] {} <Fatal> BaseDaemon: 17. /build/obj-x86_64-linux-gnu/../base/common/../ext/shared_ptr_helper.h:19: DB::create(DB::StorageFactory::Arguments const&) @ 0x2bc0387f in /usr/bin/clickhouse
2020.11.17 17:34:55.892141 [ 52487 ] {} <Fatal> BaseDaemon: 18. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1714: std::__1::__function::__func<std::__1::shared_ptr<DB::IStorage> (*)(DB::StorageFactory::Arguments const&), std::__1::allocator<std::__1::shared_ptr<DB::IStorage> (*)(DB::StorageFactory::Arguments const&)>, std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)>::operator()(DB::StorageFactory::Arguments const&) @ 0x2bc1d5f3 in /usr/bin/clickhouse
2020.11.17 17:34:55.898951 [ 52487 ] {} <Fatal> BaseDaemon: 19. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/vector:662: DB::StorageFactory::get(DB::ASTCreateQuery const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, DB::Context&, DB::ColumnsDescription const&, DB::ConstraintsDescription const&, bool) const @ 0x2b3a503d in /usr/bin/clickhouse
2020.11.17 17:34:55.905032 [ 52487 ] {} <Fatal> BaseDaemon: 20. /build/obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:786: DB::InterpreterCreateQuery::doCreateTable(DB::ASTCreateQuery&, DB::InterpreterCreateQuery::TableProperties const&) @ 0x296b3c51 in /usr/bin/clickhouse
2020.11.17 17:34:55.910071 [ 52487 ] {} <Fatal> BaseDaemon: 21. /build/obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:0: DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) @ 0x296afb2a in /usr/bin/clickhouse
2020.11.17 17:34:55.915785 [ 52487 ] {} <Fatal> BaseDaemon: 22. /build/obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:0: DB::InterpreterCreateQuery::execute() @ 0x296ba558 in /usr/bin/clickhouse
2020.11.17 17:34:55.919687 [ 52487 ] {} <Fatal> BaseDaemon: 23. /build/obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:482: DB::executeQueryImpl(char const*, char const*, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, DB::ReadBuffer*) @ 0x2aa5c620 in /usr/bin/clickhouse
2020.11.17 17:34:55.923307 [ 52487 ] {} <Fatal> BaseDaemon: 24. /build/obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:813: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0x2aa573b5 in /usr/bin/clickhouse
2020.11.17 17:34:55.928153 [ 52487 ] {} <Fatal> BaseDaemon: 25. /build/obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:254: DB::TCPHandler::runImpl() @ 0x2c7670b3 in /usr/bin/clickhouse
2020.11.17 17:34:55.934166 [ 52487 ] {} <Fatal> BaseDaemon: 26. /build/obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:0: DB::TCPHandler::run() @ 0x2c792f86 in /usr/bin/clickhouse
2020.11.17 17:34:55.938977 [ 52487 ] {} <Fatal> BaseDaemon: 27. /build/obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:57: Poco::Net::TCPServerConnection::start() @ 0x375ff29b in /usr/bin/clickhouse
2020.11.17 17:34:55.945046 [ 52487 ] {} <Fatal> BaseDaemon: 28. /build/obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:1036: Poco::Net::TCPServerDispatcher::run() @ 0x376008ba in /usr/bin/clickhouse
2020.11.17 17:34:55.953262 [ 52487 ] {} <Fatal> BaseDaemon: 29. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:0: Poco::PooledThread::run() @ 0x37a8f473 in /usr/bin/clickhouse
2020.11.17 17:34:55.961898 [ 52487 ] {} <Fatal> BaseDaemon: 30. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:56: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x37a8a859 in /usr/bin/clickhouse
2020.11.17 17:34:55.970178 [ 52487 ] {} <Fatal> BaseDaemon: 31. /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/include/Poco/AutoPtr.h:215: Poco::ThreadImpl::runnableEntry(void*) @ 0x37a86cec in /usr/bin/clickhouse

@fastio
Copy link
Contributor Author

fastio commented Nov 18, 2020

@fastio FYI, failed "Stress test (memory)" is irrelevant to this PR and is a known issue with RocksDB lib in our contrib.

Received signal Aborted (6)

Thanks for the reminder.

@fastio
Copy link
Contributor Author

fastio commented Nov 20, 2020

Ping @Akazz :)

@fastio
Copy link
Contributor Author

fastio commented Nov 27, 2020

@Akazz Please merge this pr to master. I am worried that it will be conflicted with master branch again. Thanks :)

@alexey-milovidov
Copy link
Member

I will take this PR for review.

@alexey-milovidov
Copy link
Member

But Akazz already approved :)

@alexey-milovidov alexey-milovidov merged commit dfae1ef into ClickHouse:master Nov 27, 2020
ReplicatedMergeTree engine as follow:

```
CREATE TABLE table_name ( ... ) ENGINE = ReplicatedMergeTree('zookeeper_name_configurated_in_auxiliary_zookeepers:path', 'replica_name') ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configurated -> configured

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in master.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also reviewed and it LGTM.

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.

None yet

5 participants