| 425 | } |
| 426 | |
| 427 | BlockIO DatabaseReplicated::tryEnqueueReplicatedDDL(const ASTPtr & query, ContextPtr query_context) |
| 428 | { |
| 429 | if (is_readonly) |
| 430 | throw Exception(ErrorCodes::NO_ZOOKEEPER, "Database is in readonly mode, because it cannot connect to ZooKeeper"); |
| 431 | |
| 432 | if (query_context->getClientInfo().query_kind != ClientInfo::QueryKind::INITIAL_QUERY) |
| 433 | throw Exception(ErrorCodes::INCORRECT_QUERY, "It's not initial query. ON CLUSTER is not allowed for Replicated database."); |
| 434 | |
| 435 | checkQueryValid(query, query_context); |
| 436 | LOG_DEBUG(log, "Proposing query: {}", queryToString(query)); |
| 437 | |
| 438 | DDLLogEntry entry; |
| 439 | entry.query = queryToString(query); |
| 440 | entry.initiator = ddl_worker->getCommonHostID(); |
| 441 | entry.setSettingsIfRequired(query_context); |
| 442 | String node_path = ddl_worker->tryEnqueueAndExecuteEntry(entry, query_context); |
| 443 | |
| 444 | Strings hosts_to_wait = getZooKeeper()->getChildren(zookeeper_path + "/replicas"); |
| 445 | return getDistributedDDLStatus(node_path, entry, query_context, hosts_to_wait); |
| 446 | } |
| 447 | |
| 448 | static UUID getTableUUIDIfReplicated(const String & metadata, ContextPtr context) |
| 449 | { |
no test coverage detected