MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / backupData

Method backupData

src/Storages/StorageMergeTree.cpp:3143–3171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3141
3142
3143void StorageMergeTree::backupData(BackupEntriesCollector & backup_entries_collector, const String & data_path_in_backup, const std::optional<ASTs> & partitions)
3144{
3145 const auto & backup_settings = backup_entries_collector.getBackupSettings();
3146 auto local_context = backup_entries_collector.getContext();
3147
3148 /// TODO(unique-key): sidecar-aware backup. The per-part delete-bitmap
3149 /// sidecars are not enumerated as part artifacts, so BACKUP would silently
3150 /// omit them and restore would resurrect deleted rows. Reject for now.
3151 if (auto uk_metadata = getInMemoryMetadataPtr(local_context, false); uk_metadata && uk_metadata->hasUniqueKey())
3152 throw Exception(ErrorCodes::SUPPORT_IS_DISABLED,
3153 "BACKUP is not supported for UNIQUE KEY tables yet: delete-bitmap sidecars "
3154 "are not preserved across backup/restore.");
3155
3156 DataPartsVector data_parts;
3157 if (partitions)
3158 data_parts = getVisibleDataPartsVectorInPartitions(local_context, getPartitionIDsFromQuery(*partitions, local_context));
3159 else
3160 data_parts = getVisibleDataPartsVector(local_context);
3161
3162 Int64 min_data_version = std::numeric_limits<Int64>::max();
3163 for (const auto & data_part : data_parts)
3164 min_data_version = std::min(min_data_version, data_part->info.getDataVersion() + 1);
3165
3166 auto parts_backup_entries = backupParts(data_parts, data_path_in_backup, backup_settings, local_context);
3167 for (auto & part_backup_entries : parts_backup_entries)
3168 backup_entries_collector.addBackupEntries(std::move(part_backup_entries.backup_entries));
3169
3170 backup_entries_collector.addBackupEntries(backupMutations(min_data_version, data_path_in_backup));
3171}
3172
3173
3174BackupEntries StorageMergeTree::backupMutations(UInt64 version, const String & data_path_in_backup) const

Callers

nothing calls this directly

Calls 7

hasUniqueKeyMethod · 0.80
getDataVersionMethod · 0.80
addBackupEntriesMethod · 0.80
ExceptionClass · 0.50
maxFunction · 0.50
minFunction · 0.50
getContextMethod · 0.45

Tested by

no test coverage detected