clickhouse-local: fix CREATE DATABASE with Atomic engine

Before it fails to create due to "metadata" directory had not been
created, since metadata_path is different for Atomic database, see
InterpreterCreateQuery.cpp.
This commit is contained in:
Azat Khuzhin 2021-12-08 21:23:00 +03:00
parent 4cc45c1e15
commit 5fad4f6204
3 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,7 @@ DatabaseAtomic::DatabaseAtomic(String name_, String metadata_path_, UUID uuid, c
, db_uuid(uuid)
{
assert(db_uuid != UUIDHelpers::Nil);
fs::create_directories(fs::path(getContext()->getPath()) / "metadata");
fs::create_directories(path_to_table_symlinks);
tryCreateMetadataSymlink();
}

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
for Engine in Atomic Ordinary; do
$CLICKHOUSE_LOCAL --query """
CREATE DATABASE foo_$Engine Engine=$Engine;
DROP DATABASE foo_$Engine;
"""
done