add option to force deduplicate children

This commit is contained in:
Yury Stankevich 2020-02-11 10:38:39 +03:00
parent 2734347cc0
commit 1d391e2841
2 changed files with 5 additions and 2 deletions

View File

@ -395,6 +395,7 @@ struct Settings : public SettingsCollection<Settings>
M(SettingBool, enable_early_constant_folding, true, "Enable query optimization where we analyze function and subqueries results and rewrite query if there're constants there", 0) \
\
M(SettingBool, partial_revokes, false, "Makes it possible to revoke privileges partially.", 0) \
M(SettingBool, force_deduplicate_childrens, false, "If the 'root' table deduplicates blocks, there are no need to make deduplication for children. Use true to always deduplicate childrens.", 0) \
\
/** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \
\

View File

@ -29,7 +29,9 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
/// If the "root" table deduplactes blocks, there are no need to make deduplication for children
/// Moreover, deduplication for AggregatingMergeTree children could produce false positives due to low size of inserting blocks
bool disable_deduplication_for_children = !no_destination && storage->supportsDeduplication();
bool disable_deduplication_for_children = false;
if (!context.getSettingsRef().force_deduplicate_childrens)
disable_deduplication_for_children = !no_destination && storage->supportsDeduplication();
auto table_id = storage->getStorageID();
Dependencies dependencies = context.getDependencies(table_id);
@ -130,7 +132,7 @@ void PushingToViewsBlockOutputStream::write(const Block & block)
}
/// Don't process materialized views if this block is duplicate
if (replicated_output && replicated_output->lastBlockIsDuplicate())
if (!context.getSettingsRef().force_deduplicate_childrens && replicated_output && replicated_output->lastBlockIsDuplicate())
return;
// Insert data into materialized views only after successful insert into main table