Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reading with uncompressed cache #31826

Merged
merged 2 commits into from
Nov 27, 2021

Conversation

CurtizJ
Copy link
Member

@CurtizJ CurtizJ commented Nov 25, 2021

Changelog category (leave one):

  • Bug Fix (user-visible misbehaviour in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix reading from MergeTree tables with enabled use_uncompressed_cache.

Fixes #31449.

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Nov 25, 2021
@CurtizJ CurtizJ marked this pull request as draft November 25, 2021 18:22
@@ -77,7 +77,7 @@ class IColumn;
M(UInt64, s3_max_connections, 1024, "The maximum number of connections per server.", 0) \
M(UInt64, hsts_max_age, 0, "Expired time for hsts. 0 means disable HSTS.", 0) \
M(Bool, extremes, false, "Calculate minimums and maximums of the result columns. They can be output in JSON-formats.", IMPORTANT) \
M(Bool, use_uncompressed_cache, false, "Whether to use the cache of uncompressed blocks.", 0) \
M(Bool, use_uncompressed_cache, true, "Whether to use the cache of uncompressed blocks.", 0) \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarly enable this setting, because we have only 2 tests with use_uncompressed_cache=true.

@@ -87,7 +87,7 @@ CachedCompressedReadBuffer::CachedCompressedReadBuffer(
void CachedCompressedReadBuffer::seek(size_t offset_in_compressed_file, size_t offset_in_decompressed_block)
{
/// Nothing to do if we already at required position
if (file_pos == offset_in_compressed_file
if (!owned_cell && file_pos == offset_in_compressed_file
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change we could proceed to next compressed block and leave offset of buffer in inconsistent state. (when we have offset() != offset_in_decompressed_block, but nextimpl_working_buffer_offset == offset_in_decompressed_block, because nextimpl_working_buffer_offset is left from previous call.

@CurtizJ
Copy link
Member Author

CurtizJ commented Nov 25, 2021

3 tests failed with enabled use_uncompressed_cache, what is ok:
01533_multiple_nested and 01475_read_subcolumns check number of opened files.
01605_adaptive_granularity_block_borders checks memory consumption, which is also implementation defined.

@CurtizJ CurtizJ marked this pull request as ready for review November 25, 2021 19:54
@alesapin alesapin self-assigned this Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

query does not return the expected results but mixing columns
3 participants