mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
update comments
This commit is contained in:
parent
e4c1ca91c1
commit
8f7daa75d1
@ -184,9 +184,10 @@ struct ContextShared
|
||||
bool shutdown_called = false;
|
||||
|
||||
/// Do not allow simultaneous execution of DDL requests on the same table.
|
||||
/// database -> table -> exception_message
|
||||
/// For the duration of the operation, an element is placed here, and an object is returned, which deletes the element in the destructor.
|
||||
/// In case the element already exists, an exception is thrown. See class DDLGuard below.
|
||||
/// database -> table -> (mutex, counter), counter: how much threads run query on the table at the same time
|
||||
/// For the duration of the operation, an element is placed here, and an object is returned,
|
||||
/// which deletes the element in the destructor when counter becomes zero.
|
||||
/// In case the element already exists, waits, when query will be executed in other thread. See class DDLGuard below.
|
||||
using DDLGuards = std::unordered_map<String, DDLGuard::Map>;
|
||||
DDLGuards ddl_guards;
|
||||
/// If you capture mutex and ddl_guards_mutex, then you need to grab them strictly in this order.
|
||||
|
@ -224,7 +224,6 @@ public:
|
||||
DatabasePtr detachDatabase(const String & database_name);
|
||||
|
||||
/// Get an object that protects the table from concurrently executing multiple DDL operations.
|
||||
/// If such an object already exists, an exception is thrown.
|
||||
std::unique_ptr<DDLGuard> getDDLGuard(const String & database, const String & table) const;
|
||||
|
||||
String getCurrentDatabase() const;
|
||||
@ -465,8 +464,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/// Puts an element into the map, erases it in the destructor.
|
||||
/// If the element already exists in the map, throws an exception containing provided message.
|
||||
/// Allows executing DDL query only in one thread.
|
||||
/// Puts an element into the map, locks tables's mutex, counts how much threads run parallel query on the table,
|
||||
/// when counter is 0 erases element in the destructor.
|
||||
/// If the element already exists in the map, waits, when ddl query will be finished in other thread.
|
||||
class DDLGuard
|
||||
{
|
||||
public:
|
||||
@ -475,7 +476,7 @@ public:
|
||||
UInt32 counter;
|
||||
};
|
||||
|
||||
/// Element name -> message.
|
||||
/// Element name -> (mutex, counter).
|
||||
/// NOTE: using std::map here (and not std::unordered_map) to avoid iterator invalidation on insertion.
|
||||
using Map = std::map<String, Entry>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user