-
Notifications
You must be signed in to change notification settings - Fork 763
RFC: ts-ct-migration: STM coexistence [PR 2] #30887
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
sjust-redpanda
wants to merge
6
commits into
redpanda-data:dev
Choose a base branch
from
sjust-redpanda:sjust/ts-ct-migration-pr2
base: dev
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
Show all changes
6 commits
Select commit
Hold shift + click to select a range
91c1c2e
cloud_topics/stm: don't pin truncation on an idle ctp_stm
sjust-redpanda a3a48c3
cloud_topics/stm: pre-install an idle ctp_stm on tiered-storage parti…
sjust-redpanda 1702aa6
cloud_topics/stm: add explicit-log-offset advance_reconciled_offset o…
sjust-redpanda 29f156c
archival: create the archival STM on cloud-topic partitions
sjust-redpanda 52b9849
archival: clamp local-log trim while the manifest holds archived data
sjust-redpanda dfd6695
cluster: install the eviction STM on cloud-topic partitions
sjust-redpanda 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
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
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 |
|---|---|---|
|
|
@@ -1373,6 +1373,18 @@ model::offset archival_metadata_stm::max_removable_local_log_offset() { | |
| collect_all = false; | ||
| } | ||
|
|
||
| // The manifest, not the storage mode, governs local-log truncation. While | ||
| // the partition still holds archived data (a non-empty live manifest or a | ||
| // spillover archive) it is still served from tiered storage and may hold | ||
| // local data not yet uploaded, so its local log must not be trimmed past | ||
| // cloud_recoverable_offset(). is_archival_enabled() can report false while | ||
| // archived data is still present -- e.g. a partition mid tiered->cloud | ||
| // migration whose effective storage mode is cloud -- which would otherwise | ||
| // collect_all and stop constraining truncation, evicting the not-yet- | ||
| // uploaded data. Gate collect_all on holds_archived_data() so it takes | ||
| // effect only once the manifest is cleared. | ||
| collect_all = collect_all && !holds_archived_data(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is_archival_enabled() could be set to false by the user
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that's a complication. |
||
|
|
||
| if (collect_all || is_read_replica || (uploads_paused && gaps_allowed)) { | ||
| // The archival is disabled but the state machine still exists so we | ||
| // shouldn't stop eviction from happening. | ||
|
|
@@ -1690,6 +1702,11 @@ model::offset archival_metadata_stm::get_archive_start_offset() const { | |
| return _manifest->get_archive_start_offset(); | ||
| } | ||
|
|
||
| bool archival_metadata_stm::holds_archived_data() const { | ||
| return _manifest->size() > 0 | ||
| || _manifest->get_archive_start_offset() != model::offset{}; | ||
| } | ||
|
|
||
| model::offset archival_metadata_stm::get_archive_clean_offset() const { | ||
| return _manifest->get_archive_clean_offset(); | ||
| } | ||
|
|
@@ -1729,10 +1746,14 @@ archival_metadata_stm_factory::archival_metadata_stm_factory( | |
|
|
||
| bool archival_metadata_stm_factory::is_applicable_for( | ||
| const storage::ntp_config& ntp_cfg) const { | ||
| // The archival STM is created on cloud-topic partitions too (no | ||
| // cloud_topic_enabled() == false guard). For a partition migrated from | ||
| // tiered storage it is reconstructed from its snapshot and its manifest | ||
| // stays available to gate local-log truncation. For a partition that was | ||
| // always a cloud topic the manifest is empty, so it is an inert passenger. | ||
| return _cloud_storage_enabled && _cloud_storage_api.local_is_initialized() | ||
| && ntp_cfg.ntp().tp.topic != model::kafka_consumer_offsets_topic | ||
| && ntp_cfg.ntp().ns == model::kafka_namespace | ||
| && ntp_cfg.cloud_topic_enabled() == false; | ||
| && ntp_cfg.ntp().ns == model::kafka_namespace; | ||
| } | ||
|
|
||
| void archival_metadata_stm_factory::create( | ||
|
|
||
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
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.
This is not the only problem that
ctp_stmcreates. Thectp_stmalso implements its own log eviction (same aslog_eviction_stm).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.
Yeah, a subsequent PR goes over behaviors like that in both the TS and CT to prevent them from operating at the same time.