More robust protection from recursive Buffer#40640
Closed
azat wants to merge 1 commit intoClickHouse:masterfrom
Closed
More robust protection from recursive Buffer#40640azat wants to merge 1 commit intoClickHouse:masterfrom
azat wants to merge 1 commit intoClickHouse:masterfrom
Conversation
This fixes the following places: - IStorage::totalRows() - flushing buffer - StorageBuffer::mayBenefitFromIndexForIn() (lack of check for table existence) And it also makes this error fatal, i.e. now you will always got INFINITE_LOOP error, while before getQueryProcessingStage() ignores the error. Fixes: ClickHouse#40637 Signed-off-by: Azat Khuzhin <[email protected]>
3341511 to
5169cdb
Compare
Member
|
It does not protect from two Buffer tables referencing each other, see #40643. |
azat
commented
Aug 25, 2022
| throw Exception("Destination table is myself. Read will cause infinite loop.", ErrorCodes::INFINITE_LOOP); | ||
| auto destination = getDestinationTable(); | ||
| if (destination) | ||
| return destination->mayBenefitFromIndexForIn(left_in_operand, query_context, destination->getInMemoryMetadataPtr()); |
Member
Author
There was a problem hiding this comment.
@alexey-milovidov could you also modify this in your PR, before it does not check that the table still exists
azat
commented
Aug 25, 2022
| try | ||
| { | ||
| writeBlockToDestination(block_to_write, DatabaseCatalog::instance().tryGetTable(destination_id, getContext())); | ||
| writeBlockToDestination(block_to_write, getDestinationTable()); |
Member
Author
There was a problem hiding this comment.
@alexey-milovidov and this place also should be fixed in #40643 then
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
More robust protection from recursive Buffer (fix possible SIGSEGV for
select * from system.tableswhen Buffer points to itself)This fixes the following places:
existence)
And it also makes this error fatal, i.e. now you will always got
INFINITE_LOOP error, while before getQueryProcessingStage() ignores the
error.
Fixes: #40637 (cc @alexey-milovidov )