2019-03-05 10:12:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/RWLock.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-06-22 09:49:21 +00:00
|
|
|
using TableLockHolder = RWLockImpl::LockHolder;
|
|
|
|
|
|
|
|
/// Table exclusive lock, holds both alter and drop locks. Useful for DROP-like
|
|
|
|
/// queries.
|
2020-06-18 16:10:47 +00:00
|
|
|
struct TableExclusiveLockHolder
|
2019-03-07 18:04:47 +00:00
|
|
|
{
|
2020-06-18 16:10:47 +00:00
|
|
|
void release() { *this = TableExclusiveLockHolder(); }
|
2019-08-27 14:31:34 +00:00
|
|
|
|
2019-03-07 18:04:47 +00:00
|
|
|
private:
|
|
|
|
friend class IStorage;
|
|
|
|
|
|
|
|
/// Order is important.
|
2020-06-22 09:49:21 +00:00
|
|
|
TableLockHolder alter_lock;
|
|
|
|
TableLockHolder drop_lock;
|
2019-03-05 10:12:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|