Repository navigation
Fix write with append with plain_rewritable/plain metadata types - #83695
Conversation
|
Workflow [PR], commit [c2c96e2] Summary: ❌
|
dffb0ef to
d3182c3
Compare
d3182c3 to
ce6dab9
Compare
ce6dab9 to
a7565e5
Compare
a7565e5 to
66d4888
Compare
|
PTAL at the test in private. |
66d4888 to
f2d45da
Compare
azat
left a comment
There was a problem hiding this comment.
LGTM, though note, that this is still not enough to fix transactions for MergeTree on plain_rewriteable (since there the exception will be thrown from noexcept scope and will lead to std::terminate), but I will rebase #84084 on top of this PR once it will be merged
Also can you please adjust the PR title and description to something more user-friendly? Since right now it is pretty internal.
f2d45da to
d63ea7a
Compare
…rageTransaction 2) Add supportAddingBlobToMetadata to MetadataStorageFromDiskTransaction indicating if addBlobToMetadata is supported 3) Handle DiskObjectStorageTransaction::writeFile and CopyFileObjectStorageOperation with supportAddingBlobToMetadata
d63ea7a to
c2c96e2
Compare
I updated the title and description. |
plain_rewritable/plain metadata types
I've adjusted it one more time to avoid using internal class names (since this is the bug fix and it will be visible in changelog and users may struggle to understand what this mean), hope you are OK with it |
| file_name_non_existing_target="file_non_existing_target_03578_$(random_str 10).txt" | ||
|
|
||
| printf "%s" "abc" | clickhouse-disks -C "$config" --disk "$disk_name" --save-logs --query "write $file_name_src" | ||
| printf "%s" "123" | clickhouse-disks -C "$config" --disk "$disk_name" --save-logs --query "write --mode append $file_name_src" 2>/dev/null |
There was a problem hiding this comment.
(minor) I would prefer to print exception message in this case, but we can improve it later.
There was a problem hiding this comment.
The reason is that we need to make sure that it fails, not simply ignored, for instance this test likely will pass with previous implementation, since the add to blob was simply noop
Hm, also, are you sure that this will use copy? It looks like a plain write to me...
There was a problem hiding this comment.
My bad, I will update it in another PR to use copy.
Oh, I want to append it so that it will create multiple blobs if the disk metadata is local.
There was a problem hiding this comment.
I will tidy up the tests in a separate PR.
|
plain_rewritable/plain metadata typesplain_rewritable/plain metadata types
Got it. Thanks for helping. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix write with append (in MergeTree used for experimental transactions) with
plain_rewritable/plainmetadata types, previously they were simply ignoredInternal explanation:
In
MetadataStorageFromDisk, we store mapping: local_path ->DiskObjectStorageMetadataIn
DiskObjectStorageMetadata, it has a list of blobs stored in ObjectKeysWithMetadata keys_with_meta;It is a 1-to-n mapping from a local_path to multiple blobs. Each
object_keyinkeys_with_metapoints to the blob stored in the object storage.When writing with append, it simply adds a new blob to
keys_with_metainDiskObjectStorageMetadata. The buffer will point to the newly created object in the object storage.In
MetadataStorageFromPlainObjectStorage, things are different.It uses
object_storage->generateObjectKeyForPathto generate the remote_path from the local_path. In other words, it is a 1-to-1 mapping fromlocal_pathtoremote_path.In
MetadataStorageFromPlainRewritableObjectStorage, it inherits fromMetadataStorageFromPlainObjectStorage, which hasstd::shared_ptr<InMemoryDirectoryPathMap> path_map.In the object storage, we store in
_metaa mapping fromremote_directory_pathtolocal_directory_path.Under
remote_directory_path, there are files which belong tolocal_directory_path.The directory paths and files are loaded into
path_mapduring initialization or refresh.It is also a 1-to-1 mapping
Documentation entry for user-facing changes