ClickHouse/dbms/src/Common/ActionLock.cpp
Vitaliy Lyudvichenko c888903488
Add query ALTER TABLE t1 [REPLACE|ATTACH] PARTITION FROM t2
* Add ATTACH PARTITION FROM table for MergeTree. [#CLICKHOUSE-3546]

* Implemented replicated case on non-leader replica. [#CLICKHOUSE-3546]

* Disable merges in the dropping range. [#CLICKHOUSE-3546]

* DROP PARTITION is atomic and simpler now. [#CLICKHOUSE-3546]

* Implemented more SYSTEM queries. [#CLICKHOUSE-2931] [#CLICKHOUSE-3546]

SYSTEM queries:
RESTART REPLICAS
SYNC REPLICA db.name
STOP MERGES [db.name]
START MERGES [db.name]
STOP FETCHES [db.name]
START FETCHES [db.name]
STOP REPLICATED SENDS [db.name]
START REPLICATED SENDS [db.name]
STOP REPLICATION QUEUES [db.name]
START REPLICATION QUEUES [db.name]

* Fixed a bunch of bugs in REPLACE PARTITION. [#CLICKHOUSE-3546]

* Add tests for REPLACE PARTITION and SYSTEM. [#CLICKHOUSE-3546]

* Add system.part_log logging. [#CLICKHOUSE-3546]

* Fixed long wait in SYNC REPLICA. [#CLICKHOUSE-3546]

* Add requested changes. [#CLICKHOUSE-3546]

Fixed clickhouse-client bad return code.

* Add requested chenges. [#CLICKHOUSE-3546]

* Add requested chenges. [#CLICKHOUSE-3546]
2018-05-21 16:49:54 +03:00

34 lines
642 B
C++

#include "ActionLock.h"
#include <Common/ActionBlocker.h>
namespace DB
{
ActionLock::ActionLock(const ActionBlocker & blocker) : counter_ptr(blocker.counter)
{
if (auto counter = counter_ptr.lock())
++(*counter);
}
ActionLock::ActionLock(ActionLock && other)
{
*this = std::move(other);
}
ActionLock & ActionLock::operator=(ActionLock && other)
{
auto lock_lhs = this->counter_ptr.lock();
counter_ptr = std::move(other.counter_ptr);
/// After move other.counter_ptr still points to counter, reset it explicitly
other.counter_ptr.reset();
if (lock_lhs)
--(*lock_lhs);
return *this;
}
}