-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fixes for trim interval and persisted lsn watcher #2683
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
289249e
Fix sequencer drain in challenging situations
AhmedSoliman 98dda30
Remote sequencer now handle cancelled/gone sequencers
AhmedSoliman 9aa8f06
Fix treatment of not-found nodes and update provisioning semantics
AhmedSoliman 7dcc469
[Bifrost] Trim improvements
AhmedSoliman 5fb2e0c
Improve replicated-loglet restatectl commands
AhmedSoliman a82fa34
[Bifrost] Allow repair stores on unsealed log-server
AhmedSoliman f0077f9
Fixes for trim interval and persisted lsn watcher
AhmedSoliman 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,14 @@ | |
use std::collections::{BTreeMap, BTreeSet}; | ||
use std::ops::{Add, Deref}; | ||
use std::sync::Arc; | ||
use std::time::Duration; | ||
|
||
use futures::future::OptionFuture; | ||
use itertools::Itertools; | ||
use rand::Rng; | ||
use tokio::sync::watch; | ||
use tokio::time; | ||
use tokio::time::{Interval, MissedTickBehavior}; | ||
use tracing::{debug, info, instrument, trace, warn}; | ||
|
||
use restate_bifrost::Bifrost; | ||
use restate_core::network::TransportConnect; | ||
use restate_core::{my_node_id, Metadata}; | ||
|
@@ -26,11 +29,8 @@ use restate_types::config::{AdminOptions, Configuration}; | |
use restate_types::identifiers::PartitionId; | ||
use restate_types::logs::{LogId, Lsn, SequenceNumber}; | ||
use restate_types::net::metadata::MetadataKind; | ||
use restate_types::retries::with_jitter; | ||
use restate_types::{GenerationalNodeId, PlainNodeId, Version}; | ||
use tokio::sync::watch; | ||
use tokio::time; | ||
use tokio::time::{Interval, MissedTickBehavior}; | ||
use tracing::{debug, info, instrument, trace, warn}; | ||
|
||
use crate::cluster_controller::cluster_state_refresher::ClusterStateWatcher; | ||
use crate::cluster_controller::logs_controller::{ | ||
|
@@ -230,7 +230,7 @@ where | |
_ = self.find_logs_tail_interval.tick() => { | ||
self.logs_controller.find_logs_tail(); | ||
} | ||
_ = OptionFuture::from(self.log_trim_check_interval.as_mut().map(|interval| interval.tick())) => { | ||
Some(_) = OptionFuture::from(self.log_trim_check_interval.as_mut().map(|interval| interval.tick())) => { | ||
return Ok(LeaderEvent::TrimLogs); | ||
} | ||
result = self.logs_controller.run_async_operations() => { | ||
|
@@ -354,13 +354,13 @@ fn create_log_trim_check_interval(options: &AdminOptions) -> Option<Interval> { | |
.log_trim_threshold | ||
.inspect(|_| info!("The log trim threshold setting is deprecated and will be ignored")); | ||
|
||
options.log_trim_interval.map(|interval| { | ||
// delay the initial trim check, and add a small amount of jitter to avoid synchronization | ||
options.log_trim_interval().map(|interval| { | ||
// delay the initial trim check, and introduces small amount of jitter (+/-10%) to avoid synchronization | ||
// among partition leaders in case of coordinated cluster restarts | ||
let jitter = rand::rng().random_range(Duration::ZERO..interval.mul_f32(0.1)); | ||
let start_at = time::Instant::now().add(interval.into()).add(jitter); | ||
let effective_interval = with_jitter(interval, 0.1); | ||
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. Thank you!! |
||
let start_at = time::Instant::now().add(effective_interval); | ||
|
||
let mut interval = time::interval_at(start_at, interval.into()); | ||
let mut interval = time::interval_at(start_at, effective_interval); | ||
interval.set_missed_tick_behavior(MissedTickBehavior::Delay); | ||
interval | ||
}) | ||
|
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Thanks for fixing this 🙏 I wasn't fully aware of the
OptionFuture
API back when I wrote it.