| 498 | |
| 499 | |
| 500 | void MergeTreeMetaBase::checkTTLExpressions(const StorageInMemoryMetadata & new_metadata, const StorageInMemoryMetadata & old_metadata) const |
| 501 | { |
| 502 | auto new_column_ttls = new_metadata.column_ttls_by_name; |
| 503 | |
| 504 | if (!new_column_ttls.empty()) |
| 505 | { |
| 506 | NameSet columns_ttl_forbidden; |
| 507 | |
| 508 | if (old_metadata.hasPartitionKey()) |
| 509 | for (const auto & col : old_metadata.getColumnsRequiredForPartitionKey()) |
| 510 | columns_ttl_forbidden.insert(col); |
| 511 | |
| 512 | if (old_metadata.hasSortingKey()) |
| 513 | for (const auto & col : old_metadata.getColumnsRequiredForSortingKey()) |
| 514 | columns_ttl_forbidden.insert(col); |
| 515 | |
| 516 | for (const auto & [name, ttl_description] : new_column_ttls) |
| 517 | { |
| 518 | if (columns_ttl_forbidden.count(name)) |
| 519 | throw Exception("Trying to set TTL for key column " + name, ErrorCodes::ILLEGAL_COLUMN); |
| 520 | } |
| 521 | } |
| 522 | auto new_table_ttl = new_metadata.table_ttl; |
| 523 | |
| 524 | if (new_table_ttl.definition_ast) |
| 525 | { |
| 526 | for (const auto & move_ttl : new_table_ttl.move_ttl) |
| 527 | { |
| 528 | if (move_ttl.destination_type == DataDestinationType::BYTECOOL) |
| 529 | continue; |
| 530 | |
| 531 | if (!getDestinationForMoveTTL(move_ttl)) |
| 532 | { |
| 533 | String message; |
| 534 | if (move_ttl.destination_type == DataDestinationType::DISK) |
| 535 | message = "No such disk " + backQuote(move_ttl.destination_name) + " for given storage policy."; |
| 536 | else |
| 537 | message = "No such volume " + backQuote(move_ttl.destination_name) + " for given storage policy."; |
| 538 | throw Exception(message, ErrorCodes::BAD_TTL_EXPRESSION); |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | MergeTreeMetaBase::PinnedPartUUIDsPtr MergeTreeMetaBase::getPinnedPartUUIDs() const |
| 545 | { |
nothing calls this directly
no test coverage detected