Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55944 from azat/rmt-retriable-exception-log
Do not write retriable errors for Replicated mutate/merge into error log
- Loading branch information
Showing
6 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
1 change: 1 addition & 0 deletions
1
tests/queries/0_stateless/02903_rmt_retriable_merge_exception.reference
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Information 1 |
72 changes: 72 additions & 0 deletions
72
tests/queries/0_stateless/02903_rmt_retriable_merge_exception.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env bash | ||
# Tags: no-ordinary-database | ||
# Tag no-ordinary-database: requires UUID | ||
|
||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
# shellcheck source=../shell_config.sh | ||
. "$CUR_DIR"/../shell_config.sh | ||
|
||
# Test that retriable errors during merges/mutations | ||
# (i.e. "No active replica has part X or covering part") | ||
# does not appears as errors (level=Error), only as info message (level=Information). | ||
|
||
$CLICKHOUSE_CLIENT -nm -q " | ||
drop table if exists rmt1; | ||
drop table if exists rmt2; | ||
create table rmt1 (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', '1') order by key settings always_fetch_merged_part=1; | ||
create table rmt2 (key Int) engine=ReplicatedMergeTree('/clickhouse/{database}', '2') order by key settings always_fetch_merged_part=0; | ||
insert into rmt1 values (1); | ||
insert into rmt1 values (2); | ||
system sync replica rmt1; | ||
system stop pulling replication log rmt2; | ||
optimize table rmt1 final settings alter_sync=0, optimize_throw_if_noop=1; | ||
" || exit 1 | ||
|
||
table_uuid=$($CLICKHOUSE_CLIENT -q "select uuid from system.tables where database = currentDatabase() and table = 'rmt1'") | ||
if [[ -z $table_uuid ]]; then | ||
echo "Table does not have UUID" >&2 | ||
exit 1 | ||
fi | ||
|
||
# NOTE: that part name can be different from all_0_1_1, in case of ZooKeeper retries | ||
part_name='%' | ||
|
||
# wait while there be at least one 'No active replica has part all_0_1_1 or covering part' in logs | ||
for _ in {0..50}; do | ||
no_active_repilica_messages=$($CLICKHOUSE_CLIENT -nm -q " | ||
system flush logs; | ||
select count() | ||
from system.text_log | ||
where | ||
event_date >= yesterday() and event_time >= now() - 600 and | ||
( | ||
(logger_name = 'MergeTreeBackgroundExecutor' and message like '%{$table_uuid::$part_name}%No active replica has part $part_name or covering part%') or | ||
(logger_name like '$table_uuid::$part_name (MergeFromLogEntryTask)' and message like '%No active replica has part $part_name or covering part%') | ||
); | ||
") | ||
if [[ $no_active_repilica_messages -gt 0 ]]; then | ||
break | ||
fi | ||
# too frequent "system flush logs" causes troubles | ||
sleep 1 | ||
done | ||
|
||
$CLICKHOUSE_CLIENT -nm -q " | ||
system start pulling replication log rmt2; | ||
system flush logs; | ||
select | ||
level, count() > 0 | ||
from system.text_log | ||
where | ||
event_date >= yesterday() and event_time >= now() - 600 and | ||
( | ||
(logger_name = 'MergeTreeBackgroundExecutor' and message like '%{$table_uuid::$part_name}%No active replica has part $part_name or covering part%') or | ||
(logger_name like '$table_uuid::$part_name (MergeFromLogEntryTask)' and message like '%No active replica has part $part_name or covering part%') | ||
) | ||
group by level; | ||
" |