Disable S3 requests processing during context shutdown to speed up termination process.

This commit is contained in:
Pavel Kovalenko 2020-09-04 17:17:27 +03:00
parent c96a2b4f22
commit c933f72adb
4 changed files with 17 additions and 0 deletions

View File

@ -183,6 +183,9 @@ public:
/// Return disk type - "local", "s3", etc.
virtual const String getType() const = 0;
/// Invoked when Global Context is shutdown.
virtual void shutdown() { }
private:
/// Returns executor to perform asynchronous operations.
Executor & getExecutor() { return *executor; }

View File

@ -746,4 +746,9 @@ void DiskS3::setReadOnly(const String & path)
Poco::File(metadata_path + path).setReadOnly(true);
}
void DiskS3::shutdown()
{
client->DisableRequestProcessing();
}
}

View File

@ -102,6 +102,8 @@ public:
const String getType() const override { return "s3"; }
void shutdown() override;
private:
bool tryReserve(UInt64 bytes);

View File

@ -1973,6 +1973,13 @@ void Context::reloadConfig() const
void Context::shutdown()
{
auto disks = getDisksMap();
for (auto & [disk_name, disk] : disks)
{
LOG_INFO(shared->log, "Shutdown disk {}", disk_name);
disk->shutdown();
}
shared->shutdown();
}