mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 01:30:51 +00:00
dbms: added reset of cache in alter modify [#METR-10242]
This commit is contained in:
parent
9c269c7b81
commit
108342491f
@ -102,6 +102,16 @@ public:
|
||||
return cells.size();
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
Poco::ScopedLock<Poco::FastMutex> lock(mutex);
|
||||
queue.clear();
|
||||
cells.clear();
|
||||
current_size = 0;
|
||||
hits = 0;
|
||||
misses = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::list<Key> LRUQueue;
|
||||
typedef typename LRUQueue::iterator LRUQueueIterator;
|
||||
|
@ -53,6 +53,11 @@ public:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
Base::reset();
|
||||
}
|
||||
};
|
||||
|
||||
typedef Poco::SharedPtr<UncompressedCache> UncompressedCachePtr;
|
||||
|
@ -62,6 +62,11 @@ public:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
Base::reset();
|
||||
}
|
||||
};
|
||||
|
||||
typedef Poco::SharedPtr<MarkCache> MarkCachePtr;
|
||||
|
@ -245,7 +245,7 @@ void IStorage::alterColumns(const ASTAlterQuery::Parameters & params, NamesAndTy
|
||||
String type_string = String(type_range.first, type_range.second - type_range.first);
|
||||
|
||||
DB::DataTypePtr data_type = context.getDataTypeFactory().get(type_string);
|
||||
NameAndTypePair pair(ast_name_type.name, data_type );
|
||||
NameAndTypePair pair(ast_name_type.name, data_type);
|
||||
NamesAndTypesList::iterator column_it = std::find_if(columns->begin(), columns->end(), boost::bind(namesEqual, ast_name_type.name, _1) );
|
||||
if (column_it == columns->end())
|
||||
throw Exception("Wrong column name. Cannot find column " + ast_name_type.name + " to modify.", DB::ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
@ -1270,7 +1270,7 @@ void StorageMergeTree::alter(const ASTAlterQuery::Parameters & params)
|
||||
{
|
||||
if (params.type == ASTAlterQuery::MODIFY)
|
||||
{
|
||||
/// @TODO поддержка alter primary ключа
|
||||
{
|
||||
Poco::ScopedWriteRWLock mlock(merge_lock);
|
||||
Poco::ScopedWriteRWLock wlock(write_lock);
|
||||
|
||||
@ -1343,6 +1343,9 @@ void StorageMergeTree::alter(const ASTAlterQuery::Parameters & params)
|
||||
LOG_TRACE(log, "Removing old column " << path + ".mrk" + ".old");
|
||||
Poco::File(path + ".mrk" + ".old").remove();
|
||||
}
|
||||
}
|
||||
context.getUncompressedCache()->reset();
|
||||
context.getMarkCache()->reset();
|
||||
}
|
||||
{
|
||||
Poco::ScopedLock<Poco::FastMutex> lock(data_parts_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user