fix: fix server level max temporary size limit#87140
fix: fix server level max temporary size limit#87140vdimir merged 8 commits intoClickHouse:masterfrom
Conversation
c8af459 to
9d0d6f4
Compare
vdimir
left a comment
There was a problem hiding this comment.
Thanks for the fix, it's really a great catch! So basically, max_temporary_data_on_disk_size was not properly tested and barely usable. Have you checked by the chance if the metrics were correct before and are now fixed by this change?
| @@ -0,0 +1,35 @@ | |||
| <clickhouse> | |||
There was a problem hiding this comment.
Perhaps it would be better to add this test case to the integration test suite at https://github.com/ClickHouse/ClickHouse/tree/master/tests/integration/test_temporary_data rather than as a stateless test that runs a separate server. However, this is fine for now - we can refactor it in a separate PR if we decide it's necessary.
| void freeAlloc(); | ||
|
|
||
| TemporaryDataOnDiskScope * parent; | ||
| std::shared_ptr<TemporaryDataOnDiskScope> parent; |
There was a problem hiding this comment.
Are there cases where TemporaryDataBuffer's lifetime is greater than TemporaryDataOnDiskScope? I assume the initial intent was to keep the buffer's lifetime shorter than the scope lifetime, so I'm asking just to better understanding.
There was a problem hiding this comment.
For MergeSortingTransform, its TemporaryDataOnDiskScope is created here.
And In MergeSortingTransform, we create tmp_stream use raw pointer of tmp_data
Subsequently, we use tmp_stream to create BufferingToFileSink. This BufferingToFileSink is destroyed in SortingTransform at a point later than the destruction of MergeSortingTransform, which causes the lifetime of TemporaryDataBuffer to exceed that of TemporaryDataOnDiskScope
And I also encountered a Fatal error here with raw pointer
Yeah, I have checked the metrics were correct after the fix |
@alexey-milovidov I initially tried using |
Cherry pick #87140 to 25.9: fix: fix server level max temporary size limit
Cherry pick #87140 to 25.7: fix: fix server level max temporary size limit
Cherry pick #87140 to 25.8: fix: fix server level max temporary size limit
Backport #87140 to 25.9: fix: fix server level max temporary size limit
Backport #87140 to 25.7: fix: fix server level max temporary size limit
Backport #87140 to 25.8: fix: fix server level max temporary size limit
…25.9/87449 * u/backport/25.9/87449: Backport #87426 to 25.9: Ignore only not found errors for s3_plain_rewritable (and some other S3 code) Backport #87231 to 25.9: Fix "Too large size passed to allocator" UB in JOIN due to mixed const and non-const blocks Backport #87198 to 25.9: Disable the setting by default Backport #87392 to 25.9: Fix EmbeddedRocksDB upgrade Backport #87140 to 25.9: fix: fix server level max temporary size limit Backport #87178 to 25.9: PR: fix LEFT/INNER ... RIGHT ... JOINS chain Update autogenerated version to 25.10.1.1 and contributors
Cherry pick #87140 to 25.3: fix: fix server level max temporary size limit
Cherry pick #87140 to 25.6: fix: fix server level max temporary size limit
Backport #87140 to 25.6: fix: fix server level max temporary size limit
Backport #87140 to 25.3: fix: fix server level max temporary size limit
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
max_temporary_data_on_disk_sizelimit tracking, close The statistic value of temporary data size always increases #87118