Add description for getUniqueId method, fix typos

This commit is contained in:
Anton Ivashkin 2021-02-26 14:06:24 +03:00
parent 5b267b7eec
commit 3c11d44494
4 changed files with 12 additions and 5 deletions

View File

@ -367,6 +367,8 @@ public:
/// part creation (using alter query with materialize_ttl setting). /// part creation (using alter query with materialize_ttl setting).
bool checkAllTTLCalculated(const StorageMetadataPtr & metadata_snapshot) const; bool checkAllTTLCalculated(const StorageMetadataPtr & metadata_snapshot) const;
/// Return some uniq string for file
/// Required for distinguish different copies of the same part on S3
String getUniqueId() const; String getUniqueId() const;
protected: protected:

View File

@ -739,16 +739,16 @@ public:
bool areBackgroundMovesNeeded() const; bool areBackgroundMovesNeeded() const;
/// Lock part in zookeeper for use common S3 data in several nodes /// Lock part in zookeeper for use common S3 data in several nodes
/// Overrided in StorageReplicatedMergeTree /// Overridden in StorageReplicatedMergeTree
virtual void lockSharedData(const IMergeTreeDataPart &) const {} virtual void lockSharedData(const IMergeTreeDataPart &) const {}
/// Unlock common S3 data part in zookeeper /// Unlock common S3 data part in zookeeper
/// Overrided in StorageReplicatedMergeTree /// Overridden in StorageReplicatedMergeTree
virtual bool unlockSharedData(const IMergeTreeDataPart &) const { return true; } virtual bool unlockSharedData(const IMergeTreeDataPart &) const { return true; }
virtual bool unlockSharedData(const IMergeTreeDataPart &, const String &) const { return true; } virtual bool unlockSharedData(const IMergeTreeDataPart &, const String &) const { return true; }
/// Fetch part only if some replica has it on shared storage like S3 /// Fetch part only if some replica has it on shared storage like S3
/// Overrided in StorageReplicatedMergeTree /// Overridden in StorageReplicatedMergeTree
virtual bool tryToFetchIfShared(const IMergeTreeDataPart &, const DiskPtr &, const String &) const { return false; } virtual bool tryToFetchIfShared(const IMergeTreeDataPart &, const DiskPtr &, const String &) const { return false; }
protected: protected:

View File

@ -142,6 +142,10 @@ static const auto MERGE_SELECTING_SLEEP_MS = 5 * 1000;
static const auto MUTATIONS_FINALIZING_SLEEP_MS = 1 * 1000; static const auto MUTATIONS_FINALIZING_SLEEP_MS = 1 * 1000;
static const auto MUTATIONS_FINALIZING_IDLE_SLEEP_MS = 5 * 1000; static const auto MUTATIONS_FINALIZING_IDLE_SLEEP_MS = 5 * 1000;
std::atomic_uint StorageReplicatedMergeTree::total_fetches {0};
void StorageReplicatedMergeTree::setZooKeeper() void StorageReplicatedMergeTree::setZooKeeper()
{ {
std::lock_guard lock(current_zookeeper_mutex); std::lock_guard lock(current_zookeeper_mutex);
@ -1730,7 +1734,6 @@ bool StorageReplicatedMergeTree::executeFetch(LogEntry & entry)
const auto storage_settings_ptr = getSettings(); const auto storage_settings_ptr = getSettings();
auto metadata_snapshot = getInMemoryMetadataPtr(); auto metadata_snapshot = getInMemoryMetadataPtr();
static std::atomic_uint total_fetches {0};
if (storage_settings_ptr->replicated_max_parallel_fetches && total_fetches >= storage_settings_ptr->replicated_max_parallel_fetches) if (storage_settings_ptr->replicated_max_parallel_fetches && total_fetches >= storage_settings_ptr->replicated_max_parallel_fetches)
{ {
throw Exception("Too many total fetches from replicas, maximum: " + storage_settings_ptr->replicated_max_parallel_fetches.toString(), throw Exception("Too many total fetches from replicas, maximum: " + storage_settings_ptr->replicated_max_parallel_fetches.toString(),
@ -1934,7 +1937,6 @@ bool StorageReplicatedMergeTree::executeFetchShared(ReplicatedMergeTreeLogEntry
const auto storage_settings_ptr = getSettings(); const auto storage_settings_ptr = getSettings();
auto metadata_snapshot = getInMemoryMetadataPtr(); auto metadata_snapshot = getInMemoryMetadataPtr();
static std::atomic_uint total_fetches {0};
if (storage_settings_ptr->replicated_max_parallel_fetches && total_fetches >= storage_settings_ptr->replicated_max_parallel_fetches) if (storage_settings_ptr->replicated_max_parallel_fetches && total_fetches >= storage_settings_ptr->replicated_max_parallel_fetches)
{ {
throw Exception("Too many total fetches from replicas, maximum: " + storage_settings_ptr->replicated_max_parallel_fetches.toString(), throw Exception("Too many total fetches from replicas, maximum: " + storage_settings_ptr->replicated_max_parallel_fetches.toString(),

View File

@ -307,6 +307,9 @@ private:
/// Event that is signalled (and is reset) by the restarting_thread when the ZooKeeper session expires. /// Event that is signalled (and is reset) by the restarting_thread when the ZooKeeper session expires.
Poco::Event partial_shutdown_event {false}; /// Poco::Event::EVENT_MANUALRESET Poco::Event partial_shutdown_event {false}; /// Poco::Event::EVENT_MANUALRESET
/// Limiting parallel fetches per node
static std::atomic_uint total_fetches;
/// Limiting parallel fetches per one table /// Limiting parallel fetches per one table
std::atomic_uint current_table_fetches {0}; std::atomic_uint current_table_fetches {0};