-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add FindTailAttr for configurable find_tail behavior #2781
base: main
Are you sure you want to change the base?
Conversation
15a86c4
to
ab3d293
Compare
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.
Thank you for working on this. I've left a couple of naming/description suggestions. Please consider them.
crates/bifrost/src/loglet.rs
Outdated
/// Finds the durable tail of the loglet. | ||
#[default] | ||
Durable, |
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.
I'd suggest we call this "ConsistentRead" all find-tail operations will find the durable tail, but Consistent performs a consistent-read instead.
crates/bifrost/src/loglet.rs
Outdated
@@ -150,6 +153,17 @@ pub trait Loglet: Send + Sync { | |||
async fn seal(&self) -> Result<(), OperationError>; | |||
} | |||
|
|||
#[derive(Default, Clone, Copy, PartialEq, Eq)] | |||
pub enum FindTailAttr { |
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.
Can this be FindTailOpts
or FindTailOptions
?
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 reason I have chosen this name over FindTailOptions
is that it conflicts with another FindTailOptions enum defined internally in replicated_loglet. But maybe we can change the other one instead
crates/bifrost/src/loglet.rs
Outdated
/// Approximate find tail of the loglet. This should cheap to run based on the | ||
/// loglet implementation. If an efficient approximation is not possible, it must | ||
/// fall back to a durable check. | ||
Approximate, |
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.
Perhaps Fast
reflects better on what is means.
crates/bifrost/src/loglet.rs
Outdated
/// Approximate find tail of the loglet. This should cheap to run based on the | ||
/// loglet implementation. If an efficient approximation is not possible, it must | ||
/// fall back to a durable check. |
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.
I might have mislead you by suggesting approx as a good name. Instead, I think explaining this in terms of the fact we might be returning a stale value of the tail is better. The enum variant can be StaleAllowed
or Fast
14a42e3
to
8c5ecbe
Compare
Summary: FindTailAttr allows find_tail users to adjust durability and accuracy. Currently, two modes are supported: Approximate: A fast check that usually returns immediately with the last known tail. Durable (default): Ensures a reliable tail find. Loglet implementations can choose to always run Durable find_tail.
Thanks @AhmedSoliman for your review as usual. I considered and applied all your comments. I still had to rename the Other options could be:
|
Add FindTailAttr for configurable find_tail behavior
Summary:
FindTailAttr allows find_tail users to adjust durability and accuracy. Currently, two modes are supported:
Approximate: A fast check that usually returns immediately with the last known tail.
Durable (default): Ensures a reliable tail find.
Loglet implementations can choose to always run Durable find_tail.
Stack created with Sapling. Best reviewed with ReviewStack.