2019-03-05 10:12:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/RWLock.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-03-07 18:34:46 +00:00
|
|
|
/// Structs that hold table structure (columns, their types, default values etc.) locks when executing queries.
|
|
|
|
/// See IStorage::lock* methods for comments.
|
|
|
|
|
2019-03-07 18:04:47 +00:00
|
|
|
struct TableStructureWriteLockHolder
|
2019-03-05 10:12:20 +00:00
|
|
|
{
|
2019-03-07 18:04:47 +00:00
|
|
|
void release()
|
|
|
|
{
|
|
|
|
*this = TableStructureWriteLockHolder();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class IStorage;
|
|
|
|
|
2019-03-05 10:12:20 +00:00
|
|
|
/// Order is important.
|
|
|
|
RWLockImpl::LockHolder alter_intention_lock;
|
|
|
|
RWLockImpl::LockHolder new_data_structure_lock;
|
|
|
|
RWLockImpl::LockHolder structure_lock;
|
2019-03-07 18:04:47 +00:00
|
|
|
};
|
2019-03-05 10:12:20 +00:00
|
|
|
|
2019-03-07 18:04:47 +00:00
|
|
|
struct TableStructureReadLockHolder
|
|
|
|
{
|
2019-08-27 14:31:34 +00:00
|
|
|
void release()
|
|
|
|
{
|
|
|
|
*this = TableStructureReadLockHolder();
|
|
|
|
}
|
|
|
|
|
2019-03-07 18:04:47 +00:00
|
|
|
private:
|
|
|
|
friend class IStorage;
|
|
|
|
|
|
|
|
/// Order is important.
|
|
|
|
RWLockImpl::LockHolder new_data_structure_lock;
|
|
|
|
RWLockImpl::LockHolder structure_lock;
|
2019-03-05 10:12:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|