fix rewrite disk object storage transaction#81787
Conversation
|
proof |
749361c to
eb12ea6
Compare
|
I need to check fast tests. |
| String local_path; /// or equivalent "metadata_path" | ||
|
|
||
| uint64_t bytes_size = 0; | ||
| uint64_t bytes_size = std::numeric_limits<uint64_t>::max(); |
There was a problem hiding this comment.
May be std::optional is better?
There was a problem hiding this comment.
It has a wide usage range as just uint64_t. Usually it is well defined because this struct represent the context of disk metadata files.
Making it optional makes this case better but the rest would be less comprehensive.
| std::shared_ptr<StoredObject> object_, | ||
| ObjectStorageKey remote_key_, | ||
| WriteMode mode_, | ||
| bool do_not_write_empty_blob_) |
There was a problem hiding this comment.
The negation is less convenient to use, may be just like this (with reversing all current values of course):
| bool do_not_write_empty_blob_) | |
| bool create_blob_if_empty_) |
| wb->finalize(); | ||
| } | ||
|
|
||
| DB::FailPointInjection::enableFailPoint("disk_object_storage_fail_commit_metadata_transaction"); |
There was a problem hiding this comment.
Can we do a similar test with failpoint but as stateless?
There was a problem hiding this comment.
We could.
One of my aims was make ut-test as more flexible.
There was a problem hiding this comment.
Having both is better, isn't it?
There was a problem hiding this comment.
That would take a time.
Also I suspect it hits not in the public but in private functionality.
84600cf to
262c03a
Compare
262c03a to
6a12319
Compare
|
Dear @kssenii, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
06aa12b to
02de0d2
Compare
|
This is related to public version as well. The file |
d6ac829 to
6d4992f
Compare
This reverts commit bd81c7d.
#65914
Here is an attempt to remove blob from previous file version
ClickHouse/src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp
Line 842 in 04b2135
That deletion is made even before metadata transaction is tried to cimmit.
When metadata transaction is not commited or is rolled back the blobs are lost.
See the test
TEST_F(DiskObjectStorageTest, RewriteFileTxUndo)with repro.The fix is straight forward: truncation operation should be done before rewrite operation. Truncation removes remote blobs correctly, it removes them after successful metadata transaction commit.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
rewrite disk object storage transaction removes previous remote blobs if metadata transaction is committed.
Documentation entry for user-facing changes