forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 15
[DO NOT REVIEW YET] bump retry count upon task initialization as opposed to failure #1366
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
Draft
arthurpassos
wants to merge
1
commit into
export_replicated_mt_partition_v2
Choose a base branch
from
export_partition_retry_count_begin
base: export_replicated_mt_partition_v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,84 @@ | ||
| #pragma once | ||
|
|
||
| #include <Storages/MutationCommands.h> | ||
| #include <Storages/MergeTree/IMergeTreeDataPart.h> | ||
| #include <Storages/MergeTree/PatchParts/PatchPartInfo.h> | ||
| #include <Storages/MergeTree/PatchParts/PatchPartsUtils.h> | ||
| #include <Storages/MergeTree/AlterConversions.h> | ||
| #include <Core/Types.h> | ||
| #include <memory> | ||
| #include <unordered_map> | ||
|
|
||
| namespace DB | ||
| { | ||
|
|
||
| /// Type aliases for partition-related maps (also defined in MergeTreeData.h for backward compatibility) | ||
| using PartitionIdToMinBlock = std::unordered_map<String, Int64>; | ||
| using PartitionIdToMinBlockPtr = std::shared_ptr<const PartitionIdToMinBlock>; | ||
|
|
||
| /// A snapshot of pending mutations that weren't applied to some of the parts yet | ||
| /// and should be applied on the fly (i.e. when reading from the part). | ||
| /// Mutations not supported by AlterConversions (isSupported*Mutation) can be omitted. | ||
| struct IMutationsSnapshot | ||
| { | ||
| /// Contains info that doesn't depend on state of mutations. | ||
| struct Params | ||
| { | ||
| Int64 metadata_version = -1; | ||
| Int64 min_part_metadata_version = -1; | ||
| PartitionIdToMinBlockPtr min_part_data_versions = nullptr; | ||
| PartitionIdToMaxBlockPtr max_mutation_versions = nullptr; | ||
| bool need_data_mutations = false; | ||
| bool need_alter_mutations = false; | ||
| bool need_patch_parts = false; | ||
| }; | ||
|
|
||
| static Int64 getMinPartDataVersionForPartition(const Params & params, const String & partition_id); | ||
| static Int64 getMaxMutationVersionForPartition(const Params & params, const String & partition_id); | ||
|
|
||
| static bool needIncludeMutationToSnapshot(const Params & params, const MutationCommands & commands); | ||
|
|
||
| virtual ~IMutationsSnapshot() = default; | ||
| virtual void addPatches(DataPartsVector patches_) = 0; | ||
|
|
||
| /// Returns mutation commands that are required to be applied to the `part`. | ||
| /// @return list of mutation commands in order: oldest to newest. | ||
| virtual MutationCommands getOnFlyMutationCommandsForPart(const DataPartPtr & part) const = 0; | ||
| virtual PatchParts getPatchesForPart(const DataPartPtr & part) const = 0; | ||
| virtual std::shared_ptr<IMutationsSnapshot> cloneEmpty() const = 0; | ||
| virtual NameSet getAllUpdatedColumns() const = 0; | ||
|
|
||
| virtual bool hasPatchParts() const = 0; | ||
| virtual bool hasDataMutations() const = 0; | ||
| virtual bool hasAlterMutations() const = 0; | ||
| virtual bool hasMetadataMutations() const = 0; | ||
| bool hasAnyMutations() const { return hasDataMutations() || hasAlterMutations() || hasMetadataMutations(); } | ||
| }; | ||
|
|
||
| struct MutationsSnapshotBase : public IMutationsSnapshot | ||
| { | ||
| public: | ||
| Params params; | ||
| MutationCounters counters; | ||
| PatchesByPartition patches_by_partition; | ||
|
|
||
| MutationsSnapshotBase() = default; | ||
| MutationsSnapshotBase(Params params_, MutationCounters counters_, DataPartsVector patches_); | ||
|
|
||
| void addPatches(DataPartsVector patches_) override; | ||
| PatchParts getPatchesForPart(const DataPartPtr & part) const final; | ||
|
|
||
| bool hasPatchParts() const final { return !patches_by_partition.empty(); } | ||
| bool hasDataMutations() const final { return counters.num_data > 0; } | ||
| bool hasAlterMutations() const final { return counters.num_alter > 0; } | ||
| bool hasMetadataMutations() const final { return counters.num_metadata > 0; } | ||
|
|
||
| protected: | ||
| NameSet getColumnsUpdatedInPatches() const; | ||
| void addSupportedCommands(const MutationCommands & commands, UInt64 mutation_version, MutationCommands & result_commands) const; | ||
| }; | ||
|
|
||
| using MutationsSnapshotPtr = std::shared_ptr<const IMutationsSnapshot>; | ||
|
|
||
| } | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new stale-state recovery check only trips when
retry_count > max_retries, so a part that has already consumed its last allowed retry (e.g. a node crashes after incrementingretry_countbut beforehandlePartExportFailurecan mark FAILED) will still be re-attempted. That yields an extra export attempt beyond the configuredexport_merge_tree_partition_max_retries, and can lead to repeated retries if the same crash repeats. Using>=here (and in the analogous scheduler check) would keep behavior consistent with the failure handler’s>=limit and avoid exceeding the configured cap in this crash/pending scenario.Useful? React with 👍 / 👎.