use std::enable_shared_from_this for IStorage#96
Conversation
a1c29cf to
817aa82
Compare
817aa82 to
e5825f7
Compare
dbms/src/Storages/StorageBuffer.cpp
Outdated
| return make_shared( | ||
| name_, columns_, materialized_columns_, alias_columns_, column_defaults_, | ||
| context_, num_shards_, min_thresholds_, max_thresholds_, destination_database_, destination_table_})->thisPtr(); | ||
| context_, num_shards_, min_thresholds_, max_thresholds_, destination_database_, destination_table_);; |
|
В остальном всё понятно. Жаль, что нет очевидных преимуществ: количество строк выросло, а сложность кода примерно такая же или чуть выше, чем была. Впрочем, всё Ок. |
…ommon/include/ext/shared_ptr_helper.hpp
|
В StorageMergeTree теоретически можно было вставить код между созданием экземпляра класса и созданием std::shared_ptr. Если бы он вызывал исключение - мы бы получили утечку памяти, если вставить создание std::shared_ptr( res ) - получили бы double free после res->thisPtr(). Сейчас же создание класса и создание shared_ptr атомарно, что исключает возможность таких ошибок. Так же можно смело использовать стандартную функцию make_shared_from_this(). Прототипы новых методов make_shared и allocate_shared - полностью идентичны методам std::*. Код ext::make_shared полностью соответствует std::make_shared. Код ext::allocate_shared основан на внутренностях g++-v5.3.0/bits/shared_ptr_base.h и близок по выполняемым действиям. Тем не менее у меня есть сомнения на счет shared_ptr_helper::Deleter - она написан по подобию |
|
Понятно. |
|
There was at least two bugs in this code:
Memory is leaking (though very slowly) when creating temporary tables (for example, when using GLOBAL IN/JOIN). It is easily observed with valgrind or address sanitizer. |
* CLICKHOUSEDOCS-559: Started to describe GRANT * CLICKHOUSEDOCS-559: Added headers for some other kinds of quries. * CLICKHOUSEDOCS-559: Further edits. * CLICKHOUSEDOCS-559: Updated grant description. * CLICKHOUSEDOCS-559: The first version for the GRANT statement is finished. * CLICKHOUSEDOCS-559: Almost finished CREATE USER * CLICKHOUSEDOCS-559: Finished the first version of CREATE queries. * CLICKHOUSEDOCS-559: Finished ALTER, DROP and SET. * CLICKHOUSEDOCS-559: Finished the first version of statements. * CLICKHOUSEDOCS-559: Update by review. * CLICKHOUSEDOCS-559: Update by review. * Update docs/en/query_language/alter.md * Update docs/en/query_language/create.md Co-Authored-By: Ilya Yatsishin <[email protected]> * Update docs/en/query_language/grant.md Co-Authored-By: Ilya Yatsishin <[email protected]> * Update by comments. Also RBAC-7 aplied. * moved new files to new structure * Adopted added articles to a new structure. * CLICKHOUSEDOCS-559: Fixed links. * CLICKHOUSEDOCS-559: Links fix. * CLICKHOUSEDOCS-559: Updated privileges by RBAC-8 changes * CLICKHOUSEDOCS-559: Added CREATE, ALTER, DROP, and SHOW queries for QUOTAS and SETTINGS PROFILES. * CLICKHOUSEDOCS-559: Added ON CLUSTER for CREATE, ALTER, DROP. * CLICKHOUSEDOCS-559: Fixed code-blocks and the anchor. * CLICKHOUSEDOCS-559: Edits after the last portion of commentaries. * CLICKHOUSEDOCS-559: Changed example Co-authored-by: Sergei Shtykov <[email protected]> Co-authored-by: Ilya Yatsishin <[email protected]>
…ine table can not succeed due to memory leak of rocksdb object
[ClickHouse#96] bug fix : retries of failed merge task for unique engine table can not succeed due to memory leak of rocksdb object See merge request datacenter/clickhouse!408
No description provided.