**Describe the bug**
System.query_log doesn't exist
It is not because of log_query setting
I found that there was a problem when query_log table initialization
My ClickHouse server version is **20.8.2.3**

**How to reproduce**
> First start a docker sever instance (/var/data/clickhouse is an empty local directory) 

```
docker run -d --name clickhouse-server -p 8123:8123 -p 9000:9000 -p 9009:9009 -v /var/data/clickhouse:/var/lib/clickhouse yandex/clickhouse-server 
```

> And then connect it  

```
docker run -it --rm --link clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server
```

> Finally you can find error msg in clickhouse-server.err.log below:

**Error message and/or stacktrace**

```
{} <Error> void DB::SystemLog<LogElement>::flushImpl(const std::__1::vector<T>&, uint64_t) [with LogElement = DB::MetricLogElement; uint64_t = long unsigned int]: Code: 425, e.displayText() = DB::ErrnoException: Cannot rename /var/lib/clickhouse/store/363/3633f3aa-0d9f-4a49-989b-6d888dee71d4/metric_log.sql.tmp to /var/lib/clickhouse/store/363/3633f3aa-0d9f-4a49-989b-6d888dee71d4/metric_log.sql, errno: 22, strerror: Invalid argument, Stack trace (when copying this message, always include the lines below):

0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x1a80ae30 in /usr/bin/clickhouse
1. DB::ErrnoException::ErrnoException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int, std::__1::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) @ 0xffa293b in /usr/bin/clickhouse
2. DB::throwFromErrnoWithPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int) @ 0xffa073a in /usr/bin/clickhouse
3. ? @ 0x1724d3f1 in /usr/bin/clickhouse
4. DB::renameNoReplace(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1724d80a in /usr/bin/clickhouse
5. DB::DatabaseAtomic::commitCreateTable(DB::ASTCreateQuery const&, std::__1::shared_ptr<DB::IStorage> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x172430af in /usr/bin/clickhouse
6. DB::DatabaseOnDisk::createTable(DB::Context const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::IStorage> const&, std::__1::shared_ptr<DB::IAST> const&) @ 0x172621db in /usr/bin/clickhouse
7. DB::InterpreterCreateQuery::doCreateTable(DB::ASTCreateQuery&, DB::InterpreterCreateQuery::TableProperties const&) @ 0x17380c89 in /usr/bin/clickhouse
8. DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) @ 0x1738363d in /usr/bin/clickhouse
9. DB::InterpreterCreateQuery::execute() @ 0x173861d9 in /usr/bin/clickhouse
10. DB::SystemLog<DB::MetricLogElement>::prepareTable() @ 0x1002b15b in /usr/bin/clickhouse
11. DB::SystemLog<DB::MetricLogElement>::flushImpl(std::__1::vector<DB::MetricLogElement, std::__1::allocator<DB::MetricLogElement> > const&, unsigned long) @ 0x10035614 in /usr/bin/clickhouse
12. DB::SystemLog<DB::MetricLogElement>::savingThreadFunction() @ 0x100391a4 in /usr/bin/clickhouse
13. ThreadFromGlobalPool::ThreadFromGlobalPool<DB::SystemLog<DB::MetricLogElement>::startup()::'lambda'()>(DB::MetricLogElement&&, DB::SystemLog<DB::MetricLogElement>::startup()::'lambda'()&&...)::'lambda'()::operator()() const @ 0x100398a6 in /usr/bin/clickhouse
14. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xffce517 in /usr/bin/clickhouse
15. ? @ 0xffccb53 in /usr/bin/clickhouse
16. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
17. clone @ 0x122103 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
 (version 20.8.2.3 (official build))
```



{
    bool check_file_exists = supportsRenameat2();
    SCOPE_EXIT({ std::error_code code; if (check_file_exists) std::filesystem::remove(table_metadata_tmp_path, code); });
    std::unique_lock lock{mutex};
    auto actual_table_id = getTableUnlocked(table_id.table_name, lock)->getStorageID();
    if (table_id.uuid != actual_table_id.uuid)
        throw Exception("Cannot alter table because it was renamed", ErrorCodes::CANNOT_ASSIGN_ALTER);
    if (check_file_exists)
        renameExchange(table_metadata_tmp_path, table_metadata_path);
    else
        std::filesystem::rename(table_metadata_tmp_path, table_metadata_path);
}
void DatabaseAtomic::assertDetachedTableNotInUse(const UUID & uuid)