Conversation
|
Workflow [PR], commit [13a23c7] Summary: ❌
|
|
Thank you for pointing it. The comment could be further improved by adding the article: "starting up after a sudden server shutdown". Will usage of |
|
Yes, because recursive removal is absolutely scary. Like you are in shock seeing this code and cannot work for the rest of the day. |
|
Btw, why does the server use |
|
BTW I reviewed my original PR for changes https://github.com/ClickHouse/ClickHouse/pull/46071/files#diff-98109370c20111715a20a680345d9bbe14149dfe5657152f3b356d01da474543 it was not me who started to use void DatabaseMemory::removeDataPath(ContextPtr local_context)
{
std::filesystem::remove_all(local_context->getPath() + data_path);
} |
|
Ok. I'm a little bit confused - as the Memory database does not have any files, why does it have a directory? And if it does have some files, why? And then my changes might be incorrect (however, tests have passed). |
|
Consider example: CREATE TEMPORARY TABLE table_memory_02561(name String);
INSERT INTO table_memory_02561 (name) VALUES ('test');
CREATE TEMPORARY TABLE table_merge_tree_02525
(
id UInt64,
info String
)
ENGINE = MergeTree
ORDER BY id
PRIMARY KEY id;
INSERT INTO table_merge_tree_02525 VALUES (1, 'a'), (2, 'b'), (3, 'c');When we create the second table table_merge_tree_02525 then the folder If we close clickhouse-client we see the log records like: BTW src/Storages/MergeTree/MergeTreeData.cpp: LOG_INFO(log, "dropAllData: removing table directory recursive to cleanup garbage");
disk->removeRecursive(relative_data_path);Temporary tables live in user sessions. So it's OK. But if instead of closing clickhouse-client we drop ClickHouse server by Ctrl+C then the folder So from one side it's clear that temporary tables live in database which is DatabaseMemory and it should not have any data on disk. But it's quite tricky/not so simple with temporary tables (as even they were implemented before my PR). BTW we could also explore how external tables are saved in |
|
Reverted, see comment #94003 (comment) @rvasin may you create a PR with comment to |
@vdimir Do you mean it's needed to create PR with commenting the code? void DatabaseMemory::removeDataPath(ContextPtr)
{
// auto db_disk = getDisk();
// db_disk->removeDirectoryIfExists(data_path);
} |
|
@rvasin Sorry for not being clear, I meant adding a comment explaining why this code is needed, but only if you have the context, of course. |
|
@vdimir I will create a PR with comment about this code in few minutes. |
|
The problem of |
|
Why can the directory for memory databases contain garbage? |
|
If the server was not shutted down properly then there can be leftovers from the |
Changelog category (leave one):
@rvasin, the code was extremely dangerous, also the comments were written in broken English.