Commit Graph

156 Commits

Author SHA1 Message Date
Antonio Andelic
ac0b7ab20b Fix backwards compatibility with older snapshots 2022-06-15 13:46:27 +00:00
Antonio Andelic
7e1f64002d Address review comments 2022-06-15 12:48:30 +00:00
Antonio Andelic
6e55593398 Fix remove preprocess 2022-06-14 13:23:46 +00:00
Antonio Andelic
5d4b289550 Update stats in update delta 2022-06-14 09:14:53 +00:00
Antonio Andelic
7e99e9fe43 Fix child num assert 2022-06-14 07:17:11 +00:00
Antonio Andelic
e5504f1b33 Merge branch 'master' into revert-37534-revert-37036-keeper-preprocess-operations 2022-06-13 15:43:10 +00:00
alesapin
aff6b7a8d6 Fix keeper storage 2022-06-12 00:01:41 +02:00
alesapin
682eb6bcc9 Add checks for numChildren 2022-06-10 15:10:45 +02:00
mergify[bot]
4aefcf29e3
Merge branch 'revert-37534-revert-37036-keeper-preprocess-operations' into keeper-real-time-digest 2022-06-01 10:17:49 +00:00
mergify[bot]
cbb26d1677
Merge branch 'master' into revert-37534-revert-37036-keeper-preprocess-operations 2022-06-01 10:16:41 +00:00
Azat Khuzhin
d86181d3cd keeper: store only unique session IDs for watches
This should speed up keeper, especially in case of incorrect usage (like
the case that had been fixed in #37640), especially in case on non
release build.

And also this should fix SIGKILL in stress tests.

You will find some details for one of such SIGKILL in `<details>` tag [1]:

<details>

    $ pigz -cd clickhouse-server.stress.log.gz | tail
    2022.05.27 16:17:24.882971 [ 637 ] {} <Trace> BackgroundSchedulePool/BgSchPool: Waiting for threads to finish.
    2022.05.27 16:17:24.896749 [ 637 ] {} <Debug> MemoryTracker: Peak memory usage (for query): 4.09 MiB.
    2022.05.27 16:17:24.907163 [ 637 ] {} <Debug> Application: Shut down storages.
    2022.05.27 16:17:24.907233 [ 637 ] {} <Debug> Application: Waiting for current connections to servers for tables to finish.
    2022.05.27 16:17:24.934335 [ 637 ] {} <Information> Application: Closed all listening sockets. Waiting for 1 outstanding connections.
    2022.05.27 16:17:29.843491 [ 637 ] {} <Information> Application: Closed connections to servers for tables. But 1 remain. Probably some tables of other users cannot finish their connections after context shutdown.
    2022.05.27 16:17:29.843632 [ 637 ] {} <Debug> KeeperDispatcher: Shutting down storage dispatcher
    2022.05.27 16:17:34.612616 [ 688 ] {} <Test> virtual Coordination::ZooKeeperRequest::~ZooKeeperRequest(): Processing of request xid=2147483647 took 10000 ms
    2022.05.27 16:17:54.612109 [ 3176 ] {} <Debug> KeeperTCPHandler: Session #12 expired
    2022.05.27 16:19:59.823038 [ 635 ] {} <Fatal> Application: Child process was terminated by signal 9 (KILL). If it is not done by 'forcestop' command or manually, the possible cause is OOM Killer (see 'dmesg' and look at the '/var/log/kern.log' for the details).

    Thread 26 (Thread 0x7f1c7703f700 (LWP 708)):
    0  0x000000000b074b2a in __tsan::MemoryAccessImpl(__tsan::ThreadState*, unsigned long, int, bool, bool, unsigned long long*, __tsan::Shadow) ()
    1  0x000000000b08630c in __tsan::MemoryAccessRange(__tsan::ThreadState*, unsigned long, unsigned long, unsigned long, bool) ()
    2  0x000000000b01ff03 in memmove ()
    3  0x000000001bbc8996 in std::__1::__move<long, long> (__first=0xb8600000d83304, __last=<optimized out>, __result=0x7f1c021cd000) at ../contrib/libcxx/include/__algorithm/move.h:57
    4  std::__1::move<long*, long*> (__first=0xb8600000d83304, __last=<optimized out>, __result=0x7f1c021cd000) at ../contrib/libcxx/include/__algorithm/move.h:70
    5  std::__1::vector<long, std::__1::allocator<long> >::erase (this=0x7b1400584c48, __position=...) at ../contrib/libcxx/include/vector:1608
    6  DB::KeeperStorage::clearDeadWatches (this=0x7b5800001ad8, this@entry=0x7b5800001800, session_id=session_id@entry=12) at ../src/Coordination/KeeperStorage.cpp:1228
    7  0x000000001bbc5c55 in DB::KeeperStorage::processRequest (this=0x7b5800001800, zk_request=..., session_id=12, time=1, new_last_zxid=..., check_acl=true) at ../src/Coordination/KeeperStorage.cpp:1122
    8  0x000000001bba06a3 in DB::KeeperStateMachine::commit (this=<optimized out>, log_idx=3549, data=...) at ../src/Coordination/KeeperStateMachine.cpp:143
    9  0x000000001bba6193 in nuraft::state_machine::commit_ext (this=0x7b4c00001f98, params=...) at ../contrib/NuRaft/include/libnuraft/state_machine.hxx:75
    10 0x00000000202c5a55 in nuraft::raft_server::commit_app_log (this=this@entry=0x7b6c00002a18, idx_to_commit=idx_to_commit@entry=3549, le=..., need_to_handle_commit_elem=true, initial_commit_exec=false) at ../contrib/NuRaft/src/handle_commit.cxx:311
    11 0x00000000202c4f98 in nuraft::raft_server::commit_in_bg_exec (this=<optimized out>, this@entry=0x7b6c00002a18, timeout_ms=timeout_ms@entry=0, initial_commit_exec=false) at ../contrib/NuRaft/src/handle_commit.cxx:241
    12 0x00000000202c4613 in nuraft::raft_server::commit_in_bg (this=this@entry=0x7b6c00002a18) at ../contrib/NuRaft/src/handle_commit.cxx:149
    ...
    Thread 28 (Thread 0x7f1c7603d700 (LWP 710)):
    0  0x00007f1d22a6d110 in __lll_lock_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
    1  0x00007f1d22a650a3 in pthread_mutex_lock () from /lib/x86_64-linux-gnu/libpthread.so.0
    2  0x000000000b0337b0 in pthread_mutex_lock ()
    3  0x00000000221884da in std::__1::__libcpp_mutex_lock (__m=0x7b4c00002088) at ../contrib/libcxx/include/__threading_support:303
    4  std::__1::mutex::lock (this=0x7b4c00002088) at ../contrib/libcxx/src/mutex.cpp:33
    5  0x000000001bba4188 in std::__1::lock_guard<std::__1::mutex>::lock_guard (__m=..., this=<optimized out>) at ../contrib/libcxx/include/__mutex_base:91
    6  DB::KeeperStateMachine::getDeadSessions (this=0x7b4c00001f98) at ../src/Coordination/KeeperStateMachine.cpp:360
    7  0x000000001bb79b4b in DB::KeeperServer::getDeadSessions (this=0x7b4400012700) at ../src/Coordination/KeeperServer.cpp:572
    8  0x000000001bb64d1a in DB::KeeperDispatcher::sessionCleanerTask (this=<optimized out>, this@entry=0x7b640001c218) at ../src/Coordination/KeeperDispatcher.cpp:399
    ...
    Thread 1 (Thread 0x7f1d227148c0 (LWP 637)):
    0  0x00007f1d22a69376 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
    1  0x000000000b0895e0 in __tsan::call_pthread_cancel_with_cleanup(int (*)(void*), void (*)(void*), void*) ()
    2  0x000000000b017091 in pthread_cond_wait ()
    3  0x0000000020569d98 in Poco::EventImpl::waitImpl (this=0x7b2000008798) at ../contrib/poco/Foundation/src/Event_POSIX.cpp:106
    4  0x000000001bb636cf in Poco::Event::wait (this=0x7b2000008798) at ../contrib/poco/Foundation/include/Poco/Event.h:97
    5  ThreadFromGlobalPool::join (this=<optimized out>) at ../src/Common/ThreadPool.h:217
    6  DB::KeeperDispatcher::shutdown (this=0x7b640001c218) at ../src/Coordination/KeeperDispatcher.cpp:322
    7  0x0000000019ca8bfc in DB::Context::shutdownKeeperDispatcher (this=<optimized out>) at ../src/Interpreters/Context.cpp:2111
    8  0x000000000b0a979b in DB::Server::main(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&)::$_9::operator()() const (this=0x7ffcde44f0a0) at ../programs/server/Server.cpp:1407

</details>

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/37593/2613149f6bf4f242bbbf2c3c8539b5176fd77286/stress_test__thread__actions_.html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-30 11:50:48 +03:00
Antonio Andelic
d9dd11bb66
Revert "Revert "Add support for preprocessing ZooKeeper operations in clickhouse-keeper"" 2022-05-26 08:14:55 +02:00
Antonio Andelic
6a962549d5
Revert "Add support for preprocessing ZooKeeper operations in clickhouse-keeper" 2022-05-25 16:45:32 +02:00
Antonio Andelic
9e5a635da2 Fix rollback 2022-05-25 14:21:26 +00:00
Antonio Andelic
c55f4e470a Small fix 2022-05-24 13:11:11 +00:00
Antonio Andelic
85e7118300 Fix integrations test 2022-05-24 09:10:45 +00:00
Antonio Andelic
2b8f71b4a8 Fix style 2022-05-23 07:55:23 +00:00
Antonio Andelic
ea1cbff0d8 Fix unit tests 2022-05-23 07:51:26 +00:00
Antonio Andelic
f379f225fa Add ephemerals on preprocess 2022-05-23 06:48:39 +00:00
Antonio Andelic
25ab817c2b Revert formatting 2022-05-20 10:12:09 +00:00
Antonio Andelic
c133f815bd Merge branch 'keeper-preprocess-operations' into keeper-real-time-digest 2022-05-20 07:57:47 +00:00
Antonio Andelic
f5759e2d7e Cache nodes latest state 2022-05-19 12:30:57 +00:00
Antonio Andelic
6fba1c96ed Define small test for digest check 2022-05-17 13:53:12 +00:00
Antonio Andelic
c5e4598447 Calculate digest on preprocess 2022-05-17 10:23:51 +00:00
Antonio Andelic
639ceb84b1 Add comment and fix typo 2022-05-17 10:15:12 +00:00
alesapin
f958203b6c
Update src/Coordination/KeeperStorage.cpp
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2022-05-17 11:55:54 +02:00
Antonio Andelic
fc5a79f186 Polishing changes 2022-05-17 08:16:55 +00:00
Antonio Andelic
b88f3fcfb1 Merge branch 'keeper-preprocess-operations' into keeper-real-time-digest 2022-05-17 06:52:30 +00:00
Antonio Andelic
573e42d0dd Address PR comments 2022-05-17 06:45:51 +00:00
Antonio Andelic
2205c01697 Add to snapshot and config for digest 2022-05-16 13:36:31 +00:00
Antonio Andelic
99b7e23812 Add version for digest 2022-05-16 13:36:31 +00:00
Antonio Andelic
2ec61a8d7f Initial implementation of digest 2022-05-16 13:36:31 +00:00
Antonio Andelic
0dccafda2e Fetch zxid independently of log idx 2022-05-16 13:35:54 +00:00
Antonio Andelic
adb8ac4fda Change log level 2022-05-16 13:15:31 +00:00
Antonio Andelic
e6d187001c Fix unit tests and modify messages 2022-05-11 12:10:17 +00:00
Antonio Andelic
0fb11ab3ff Rename uncommitted state 2022-05-11 09:08:39 +00:00
Antonio Andelic
15672a8374 Fix integration tests 2022-05-11 07:53:32 +00:00
Antonio Andelic
79080ff0cd Fix style 2022-05-10 13:43:45 +00:00
Antonio Andelic
8610d74177 init cversion 2022-05-10 13:31:39 +00:00
Antonio Andelic
88007809c2 Add rollback support 2022-05-10 13:04:35 +00:00
Antonio Andelic
02319f92a3 Define auth for sessions with preprocess 2022-05-10 12:53:18 +00:00
Antonio Andelic
f8d0aa4bc1 Fix update delta 2022-05-10 09:53:15 +00:00
Antonio Andelic
7eeb463fdb Fix local 2022-05-10 07:00:38 +00:00
Antonio Andelic
a988cfa27b Small fixes 2022-05-09 13:23:31 +00:00
Antonio Andelic
a89b57aeb6 Fix commit 2022-05-09 10:19:20 +00:00
Antonio Andelic
f5bdef4435 Remove indentation 2022-05-09 09:57:06 +00:00
Antonio Andelic
7c7bac180f Rename variables with short names 2022-05-09 09:52:43 +00:00
Antonio Andelic
246a5043b4 Rewrite commit with single lambda 2022-05-09 09:52:39 +00:00
Antonio Andelic
285bb21b91 Define close session 2022-05-09 09:35:16 +00:00
Antonio Andelic
9796527890 Support Auth check 2022-05-09 09:16:05 +00:00
Antonio Andelic
ad7226e151 Add processLocal for read requests 2022-05-09 08:32:25 +00:00
Antonio Andelic
7f6fa9fe83 Fix splitting impl of basic operations 2022-05-09 07:02:42 +00:00
Antonio Andelic
cff68aa31f Precommit implementation 2022-05-09 07:02:42 +00:00
Antonio Andelic
94ba3d129c Define preprocess with updated nodes 2022-05-09 07:02:42 +00:00
Amos Bird
4a5e4274f0
base should not depend on Common 2022-04-29 10:26:35 +08:00
Antonio Andelic
d296eeee2d Small changes for Keeper 2022-04-05 13:56:28 +00:00
Maksim Kita
b1a956c5f1 clang-tidy check performance-move-const-arg fix 2022-03-02 18:15:27 +00:00
zhangxiao871
74796c6e01 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into yandex-master 2022-01-26 17:51:46 +08:00
alesapin
2ee3f70330 Fix erase 2022-01-22 22:36:23 +03:00
alesapin
460c01f2ea Fix path 2022-01-22 18:29:36 +03:00
alesapin
ab2146d2a0 Better hash set and less locks 2022-01-21 17:26:50 +03:00
alesapin
9248a1ae03 Not so ugly interface 2022-01-21 16:35:28 +03:00
alesapin
9ea6b8c2d3 Some interm state 2022-01-19 14:46:29 +03:00
alesapin
3d325aacf6 Merge branch 'master' into better_hashmap 2022-01-19 12:31:23 +03:00
Azat Khuzhin
aee034a597 Use explicit template instantiation for SystemLog
- Move some code into module part to avoid dependency from IStorage in SystemLog
- Remove extra headers from SystemLog.h
- Rewrite some code that was relying on headers that was included by SystemLog.h

v2: rebase
v3: squash move into module part with explicit template instantiation
    (to make each commit self compilable after rebase)
2022-01-10 22:01:41 +03:00
zhangxiao871
377cc208d0 add time 2022-01-06 21:14:45 +08:00
alesapin
f8114126ed Use HashMap and arena with free lists for keeper 2021-12-30 19:21:49 +03:00
zhangxiao871
daa4c9e33b clickhouse-keeper acl consistent with zookeeper, accept generated digest 2021-12-28 17:17:01 +08:00
zhanglistar
bc4a2ca073
Update KeeperStorage.cpp
modify potential overflow sub.
2021-12-16 09:25:38 +08:00
zhanglistar
2af221df18 1. update node size in set processor. 2021-12-11 22:24:59 +08:00
zhanglistar
368fa9144a 1. opt keeper sizeInBytes caculation. 2021-12-08 14:52:21 +08:00
alesapin
1afef1733b Ignore overhead 2021-11-19 18:22:46 +03:00
alesapin
587a1a622d Fix tests 2021-11-19 16:03:01 +03:00
alesapin
3f8f08e816 Slightly better 2021-11-19 12:30:58 +03:00
alesapin
dcec086573 Small refactoring 2021-11-18 23:17:22 +03:00
JackyWoo
a2f3337ca1 code style change 2021-11-12 20:48:42 +08:00
JackyWoo
c71fb3337f add more 4lwd commands 2021-11-09 17:39:28 +08:00
Alexey Milovidov
fe6b7c77c7 Rename "common" to "base" 2021-10-02 10:13:14 +03:00
alesapin
010985ce87 Add comment 2021-09-02 14:54:32 +03:00
alesapin
c5470864e8 Fixup 2021-09-02 14:43:34 +03:00
alesapin
4c613f30b3 Simplier sessions expiration in Keeper 2021-09-02 14:40:54 +03:00
alesapin
ebfac8cfbb More correct list watches semantics in ClickHouse Keeper 2021-08-26 14:50:08 +03:00
alesapin
dc576e952a
Update KeeperStorage.cpp 2021-08-25 12:31:02 +03:00
alesapin
95cf0634dc Clickhouse-keeper: renames and comments 2021-08-24 15:30:31 +03:00
zhangxiao871
3d3b1658c5 Fix clickhouse-keeper create znode exists and empty condition. 2021-08-03 17:59:08 +08:00
alesapin
ed34844d02 Fix build 2021-07-10 11:42:25 +03:00
alesapin
b2fb551bd4 Fix several bugs in ZooKeeper snapshots deserialization 2021-07-09 16:00:50 +03:00
alesapin
bf0a4864ac Add support for set/get ACL commands 2021-06-22 13:49:35 +03:00
alesapin
731edc9a6d Fixes in ACLs 2021-06-21 18:45:45 +03:00
alesapin
76cee4e3cf Debugging 2021-06-21 16:58:39 +03:00
alesapin
b5dae909dd Add some tests 2021-06-18 21:36:19 +03:00
alesapin
a1efea20dc Better ACLs storage on disk (update snapshot version) 2021-05-28 14:52:19 +03:00
alesapin
4d59590b7f Slightly better 2021-05-27 11:15:46 +03:00
alesapin
d72d28a0a5 Fix clang tidy 2021-05-24 18:53:11 +03:00
alesapin
11ac483e12 Add tests 2021-05-24 15:18:04 +03:00
alesapin
472a41b287 Superdigest support 2021-05-23 20:54:42 +03:00
alesapin
bdb52bb643 Fixup ACL 2021-05-22 19:21:52 +03:00
alesapin
b9e9c9cf23 More correct implementation 2021-05-22 19:07:47 +03:00
alesapin
6e593cda7b Working test 2021-05-22 10:38:50 +03:00
alesapin
ec8394ed1d Initial implementation 2021-05-22 00:19:22 +03:00