mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
fix tests
This commit is contained in:
parent
7c37079a96
commit
88dbbcb15d
@ -124,7 +124,8 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String
|
||||
if (engine_name == "Ordinary")
|
||||
{
|
||||
if (!create.attach && !context->getSettingsRef().allow_deprecated_database_ordinary)
|
||||
throw Exception(ErrorCodes::UNKNOWN_DATABASE_ENGINE, "Ordinary database engine is deprecated");
|
||||
throw Exception(ErrorCodes::UNKNOWN_DATABASE_ENGINE,
|
||||
"Ordinary database engine is deprecated (see also allow_deprecated_database_ordinary setting)");
|
||||
return std::make_shared<DatabaseOrdinary>(database_name, metadata_path, context);
|
||||
}
|
||||
|
||||
|
@ -608,6 +608,7 @@ void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeep
|
||||
/// and make possible creation of new table with the same UUID.
|
||||
String query = fmt::format("CREATE DATABASE IF NOT EXISTS {} ENGINE=Ordinary", backQuoteIfNeed(to_db_name));
|
||||
auto query_context = Context::createCopy(getContext());
|
||||
query_context->setSetting("allow_deprecated_database_ordinary", 1);
|
||||
executeQuery(query, query_context, true);
|
||||
|
||||
/// But we want to avoid discarding UUID of ReplicatedMergeTree tables, because it will not work
|
||||
|
@ -30,6 +30,7 @@ namespace DB
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int NOT_IMPLEMENTED;
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
static void executeCreateQuery(
|
||||
@ -212,7 +213,7 @@ static void loadSystemDatabaseImpl(ContextMutablePtr context, const String & dat
|
||||
|
||||
static void convertOrdinaryDatabaseToAtomic(ContextMutablePtr context, const DatabasePtr & database)
|
||||
{
|
||||
/// It's kind of C++ script that creates temporary table with Atomic engine,
|
||||
/// It's kind of C++ script that creates temporary database with Atomic engine,
|
||||
/// moves all tables to it, drops old database and then renames new one to old name.
|
||||
|
||||
Poco::Logger * log = &Poco::Logger::get("loadMetadata");
|
||||
|
@ -304,10 +304,11 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
arg_idx, e.message(), getMergeTreeVerboseHelp(is_extended_storage_def));
|
||||
}
|
||||
}
|
||||
else if (!args.attach && !args.local_context.lock()->getSettingsRef().allow_deprecated_syntax_for_merge_tree)
|
||||
else if (!args.attach && !args.getLocalContext()->getSettingsRef().allow_deprecated_syntax_for_merge_tree)
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "This syntax for *MergeTree engine is deprecated. "
|
||||
"Use extended storage definition syntax with ORDER BY/PRIMARY KEY clause.");
|
||||
"Use extended storage definition syntax with ORDER BY/PRIMARY KEY clause."
|
||||
"See also allow_deprecated_syntax_for_merge_tree setting.");
|
||||
}
|
||||
|
||||
/// For Replicated.
|
||||
@ -319,9 +320,6 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
bool is_replicated_database = args.getLocalContext()->getClientInfo().query_kind == ClientInfo::QueryKind::SECONDARY_QUERY &&
|
||||
DatabaseCatalog::instance().getDatabase(args.table_id.database_name)->getEngineName() == "Replicated";
|
||||
|
||||
if (is_replicated_database && !is_extended_storage_def)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Old syntax is not allowed for *MergeTree tables in Replicated databases");
|
||||
|
||||
if (replicated)
|
||||
{
|
||||
bool has_arguments = arg_num + 2 <= arg_cnt;
|
||||
|
@ -70,4 +70,8 @@ def test_convert_system_db_to_atomic(start_cluster):
|
||||
and "1\n" == node.count_in_log("Can't receive Netlink response")
|
||||
)
|
||||
assert "0\n" == node.count_in_log("<Warning> Database")
|
||||
assert "0\n" == node.count_in_log("always include the lines below")
|
||||
errors_count = node.count_in_log("always include the lines below")
|
||||
assert "0\n" == errors_count or (
|
||||
"1\n" == errors_count
|
||||
and "1\n" == node.count_in_log("Can't receive Netlink response")
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ for table_engine in "${table_engines[@]}"; do
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_metadata_cache.check_part_metadata_cache SYNC;"
|
||||
${CLICKHOUSE_CLIENT} --query "DROP DATABASE IF EXISTS test_metadata_cache;"
|
||||
${CLICKHOUSE_CLIENT} --query "CREATE DATABASE test_metadata_cache ENGINE = ${database_engine};"
|
||||
${CLICKHOUSE_CLIENT} --allow_deprecated_database_ordinary=1 --query "CREATE DATABASE test_metadata_cache ENGINE = ${database_engine};"
|
||||
|
||||
table_engine_clause=""
|
||||
if [[ "$table_engine" == "ReplicatedMergeTree" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user