Repository navigation
Revert "Support real hard links for plain_rewritable metadata." - #119276
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [79745e1] AI ReviewSummaryThis PR reverts Missing context / blind spots
Findings❌ Blockers
Tests
Final VerdictChanges requested: the rollback backs out a risky feature, but it also drops upgrade compatibility and reopens the |
| @@ -217,28 +180,24 @@ void MetadataStorageFromPlainRewritableObjectStorage::load(bool is_initial_load, | |||
| } | |||
| } | |||
|
|
|||
| /// In the implicit form, the files of the directory are the blobs stored under its prefix. | |||
| if (!has_explicit_file_list) | |||
| /// Load the list of files inside the directory. | |||
| for (auto dir_iterator = object_storage->iterate(layout->constructFilesDirectoryKey(remote_path.value()), 0, /*with_tags=*/ false, std::nullopt); dir_iterator->isValid(); dir_iterator->next()) | |||
| { | |||
| for (auto dir_iterator = object_storage->iterate(layout->constructFilesDirectoryKey(remote_path.value()), 0, /*with_tags=*/ false, std::nullopt); dir_iterator->isValid(); dir_iterator->next()) | |||
| const auto remote_file = dir_iterator->current(); | |||
| const auto unpacked_remote_file_path = layout->parseFileObjectKey(remote_file->getPath()); | |||
| if (!unpacked_remote_file_path.has_value()) | |||
| { | |||
| const auto remote_file = dir_iterator->current(); | |||
| const auto unpacked_remote_file_path = layout->parseFileObjectKey(remote_file->getPath()); | |||
| if (!unpacked_remote_file_path.has_value()) | |||
| { | |||
| LOG_WARNING(log, "Legacy layout is in use, ignoring '{}'", remote_file->getPath()); | |||
| continue; | |||
| } | |||
|
|
|||
| const auto & [directory_remote_path, filename] = unpacked_remote_file_path.value(); | |||
| chassert(directory_remote_path == remote_path); | |||
|
|
|||
| files.emplace(filename, FileRemoteInfo{ | |||
| .bytes_size = remote_file->metadata->size_bytes, | |||
| .last_modified = remote_file->metadata->last_modified.epochTime(), | |||
| .blob_key = {}, | |||
| }); | |||
| LOG_WARNING(log, "Legacy layout is in use, ignoring '{}'", remote_file->getPath()); | |||
| continue; | |||
| } | |||
|
|
|||
| const auto & [directory_remote_path, filename] = unpacked_remote_file_path.value(); | |||
| chassert(directory_remote_path == remote_path); | |||
|
|
|||
| files.emplace(filename, FileRemoteInfo{ | |||
| .bytes_size = remote_file->metadata->size_bytes, | |||
| .last_modified = remote_file->metadata->last_modified.epochTime(), | |||
| }); | |||
There was a problem hiding this comment.
This removes the explicit prefix.path reader entirely, but the feature was already merged on 2026-09-09 and disks can already contain that layout. A directory that ever used enable_hard_links = 1 now reloads the whole metadata object as its logical path here, and later getStorageObjectsIfExist reconstructs every blob as <directory_remote_path>/<filename> instead of using the stored cross-directory blob key. That makes an ordinary upgrade to this revert unable to read a plain_rewritable disk that already created a hard link.
If we need to stop creating new hard links, we still need read-compat for the explicit layout, or a migration that rewrites those directories first.
|
|
||
| std::lock_guard guard(remote_layout_mutex); | ||
| remote_layout[local_path] = DirectoryRemoteInfo{remote_path.value(), metadata->etag, last_modified.epochTime(), std::move(files), has_explicit_file_list}; | ||
| remote_layout[local_path] = DirectoryRemoteInfo{remote_path.value(), metadata->etag, last_modified.epochTime(), std::move(files)}; |
There was a problem hiding this comment.
The old guard for a non-root prefix.path object without a logical path is gone, but LocalObjectStorage::writeObject still writes directly to the final path unless an If-Match/If-None-Match flow is used. A crash during that write leaves a visible zero-byte metadata object; with this code, local_path stays empty and remote_layout[local_path] overwrites the real root mapping. On restart the root directory is hidden behind that random directory's prefix, so reads under / go to the wrong place again.
That bug is independent of hard links; we still need to ignore non-root metadata objects whose contents are empty.
| if ((*getSettings())[MergeTreeSetting::table_disk]) | ||
| removeOwnFilesInDiskRootOnDrop(); |
There was a problem hiding this comment.
Dropping this special-case cleanup reintroduces the table_disk root-state bug. MergeTreeData::initializeDirectoriesAndFormatVersion leaves relative_data_path empty for table_disk, and MetadataStorageFromPlainObjectStorageRemoveRecursiveOperation::execute still turns removeRecursive("") into a no-op, so dropAllData() cannot remove state kept in the disk root. deduplication_logs/ and mutation_*.txt survive DROP TABLE, and the next table on the same disk can silently deduplicate new inserts or load stale mutation entries.
The deleted 05137_table_disk_drop_deduplication_log test was covering a real regression here, not the hard-link feature itself.
Reverts #110939
Workflow [PR]
Sync PR [sync-upstream/pr/119276]
Version info
26.9.1.1159(included in26.9and later)