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

skip hardlinking inverted index files in mutation #47663

Merged
merged 3 commits into from Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Storages/MergeTree/MutateTask.cpp
Expand Up @@ -19,6 +19,7 @@
#include <Storages/MergeTree/MergeTreeDataWriter.h>
#include <Storages/MutationCommands.h>
#include <Storages/MergeTree/MergeTreeDataMergerMutator.h>
#include <Storages/MergeTree/MergeTreeIndexInverted.h>
#include <DataTypes/DataTypeNullable.h>
#include <boost/algorithm/string/replace.hpp>
#include <Common/ProfileEventsScope.h>
Expand Down Expand Up @@ -551,6 +552,16 @@ static NameSet collectFilesToSkip(
/// Since MinMax index has .idx2 extension, we need to add correct extension.
files_to_skip.insert(index->getFileName() + index->getSerializedFileExtension());
files_to_skip.insert(index->getFileName() + mrk_extension);

// Skip all inverted index files, for they will be rebuilt
if (dynamic_cast<const MergeTreeIndexInverted *>(index.get()))
{
auto index_filename = index->getFileName();
files_to_skip.insert(index_filename + ".gin_dict");
files_to_skip.insert(index_filename + ".gin_post");
files_to_skip.insert(index_filename + ".gin_sed");
files_to_skip.insert(index_filename + ".gin_sid");
}
}

for (const auto & projection : projections_to_recalc)
Expand Down
@@ -0,0 +1,3 @@
1
2
I am not inverted
25 changes: 25 additions & 0 deletions tests/queries/0_stateless/02346_inverted_index_mutation.sql
@@ -0,0 +1,25 @@
SET allow_experimental_inverted_index=1;

DROP TABLE IF EXISTS t;
CREATE TABLE t
(
`timestamp` UInt64,
`s` String,
INDEX idx s TYPE inverted(3) GRANULARITY 1
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS min_rows_for_wide_part = 1, min_bytes_for_wide_part = 1;

INSERT INTO t (s) VALUES ('I am inverted');

SELECT data_version FROM system.parts WHERE database=currentDatabase() AND table='t' AND active=1;

-- do update column synchronously
ALTER TABLE t UPDATE s='I am not inverted' WHERE 1 SETTINGS mutations_sync=1;

SELECT data_version FROM system.parts WHERE database=currentDatabase() AND table='t' AND active=1;

SELECT s FROM t WHERE s LIKE '%inverted%' SETTINGS force_data_skipping_indices='idx';

DROP TABLE t;