Skip to content

Do not consider data part as broken if projection is broken #56593

Closed

Description

@alesapin

In MergeTree table engines family we have an ability to create projections of data. They stored inside data parts as sub-directories:

table_dir/all_0_0_0/data.bin
table_dir/all_0_0_0/columns.txt
table_dir/all_0_0_0/checksums.txt
table_dir/all_0_0_0/my_lovely_projection.proj/data.bin
table_dir/all_0_0_0/my_lovely_projection.proj/columns.txt
...

Projections are much more fresh and less stable functionality then data parts in MergeTree. However the checksums of projections are stored in primary data part's checksums.txt and also participate as part of the whole part checksum. Main idea is to make projections a seconds class citizen from storage point of view: if projection is broken we shouldn't consider primary data as broken.

Unfortunately data parts in MergeTree are immutable. We cannot change parts content including projections and checksums.txt. So the simplest backward-compatible solution will be in-memory flag which will allow to ignore broken projection.

The implementation will be mostly at IMergeTreeDataPart level and checkDataPart. So if we tried to touch some projection inside a data part and it appeared to be broken we will send this part to background check. Background check will eventually execute checkDataPart. The output of this function should be more detailed, we should be able to understand what exactly is broken: primary data, or some projections. After we receive the outcome we mark projections inside part as broken and ignore them everywhere except:

  1. Background fetches (send them over network)
  2. DROP PROJECTION query (we should be able to drop projection).

During merges we rebuild all projections so we don't have to propagate this flag. During mutations we need to check if projection is broken and remove it.

Activity

  1. UnamedRus commented on Nov 12, 2023

    @UnamedRus
    Contributor

    Merges calculate new projection from source projections, afaik

  2. self-assigned this
    on Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions