Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2d1c5aa
Never report a namespace whose entry was emptied as missing
tszymczyszyn-shopify Oct 14, 2026
8ab44e3
Test the give-up path of NamespaceStore::with
tszymczyszyn-shopify Oct 14, 2026
54dac36
Do not spend an attempt on dropping a left-empty entry
tszymczyszyn-shopify Oct 14, 2026
b3bd3be
Refuse to open a namespace once the store has shut down
tszymczyszyn-shopify Oct 14, 2026
8db440a
Answer UNAVAILABLE from the replica proxy while the store is shut down
tszymczyszyn-shopify Oct 14, 2026
7ed0029
Count give-ups and dropped left-empty entries
tszymczyszyn-shopify Oct 14, 2026
b4fc5c9
Test the destroy race against the real destroy
tszymczyszyn-shopify Oct 14, 2026
38b75db
Assert that reloads go into a fresh cache entry
tszymczyszyn-shopify Oct 14, 2026
6c14aea
Test several requests waiting on one left-empty entry
tszymczyszyn-shopify Oct 14, 2026
aeb4d28
Make comments and logs match what the code guarantees
tszymczyszyn-shopify Oct 15, 2026
0fddec6
Send a forged proxy auth header in the shutdown test
tszymczyszyn-shopify Oct 15, 2026
25fcdf6
Test hygiene for the namespace store tests
tszymczyszyn-shopify Oct 15, 2026
7ca4302
Leave entries that stay empty to a follow-up and simplify the retry loop
tszymczyszyn-shopify Oct 15, 2026
c7bae56
Remove the record of a create that shutdown interrupted before its load
tszymczyszyn-shopify Oct 15, 2026
63d583d
Classify namespace errors for authentication in one place
tszymczyszyn-shopify Oct 15, 2026
db746ff
Name the left-empty test after what it guards
tszymczyszyn-shopify Oct 16, 2026
4fc0947
Test that waiters on an evicted entry share one load, and that 503s n…
tszymczyszyn-shopify Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libsql-server/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub enum Error {
UrlParseError(#[from] url::ParseError),
#[error("Namespace store has shutdown")]
NamespaceStoreShutdown,
#[error("Namespace `{0}` is temporarily unavailable")]
NamespaceUnavailable(String),
#[error("Unable to update metastore: {0}")]
MetaStoreUpdateFailure(Box<dyn std::error::Error + Send + Sync>),
// This is for errors returned by moka
Expand Down Expand Up @@ -131,9 +133,10 @@ pub enum Error {
}

impl AsRef<Self> for Error {
/// The error behind any number of `Ref` wrappers, like `into_response`.
fn as_ref(&self) -> &Self {
match self {
Self::Ref(this) => this.as_ref(),
Self::Ref(this) => <Error as AsRef<Error>>::as_ref(this),
_ => self,
}
}
Expand Down Expand Up @@ -212,6 +215,7 @@ impl IntoResponse for &Error {
PrimaryStreamInterupted => self.format_err(StatusCode::INTERNAL_SERVER_ERROR),
UrlParseError(_) => self.format_err(StatusCode::BAD_REQUEST),
NamespaceStoreShutdown => self.format_err(StatusCode::SERVICE_UNAVAILABLE),
NamespaceUnavailable(_) => self.format_err(StatusCode::SERVICE_UNAVAILABLE),
MetaStoreUpdateFailure(_) => self.format_err(StatusCode::INTERNAL_SERVER_ERROR),
Ref(this) => this.as_ref().into_response(),
ProstDecode(_) => self.format_err(StatusCode::INTERNAL_SERVER_ERROR),
Expand Down
16 changes: 16 additions & 0 deletions libsql-server/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ pub static STREAM_HANDLES_COUNT: Lazy<Gauge> = Lazy::new(|| {
describe_gauge!(NAME, "amount of in-memory stream handles");
register_gauge!(NAME)
});
pub static NAMESPACE_EMPTIED_ENTRY: Lazy<Counter> = Lazy::new(|| {
const NAME: &str = "libsql_server_namespace_emptied_entry";
describe_counter!(
NAME,
"number of times a request found its namespace cache entry emptied (by shutdown, eviction or destroy) and looked again"
);
register_counter!(NAME)
});
pub static NAMESPACE_EMPTIED_ENTRY_GAVE_UP: Lazy<Counter> = Lazy::new(|| {
const NAME: &str = "libsql_server_namespace_emptied_entry_gave_up";
describe_counter!(
NAME,
"number of requests answered `namespace unavailable` because every lookup of their namespace, which still exists, found its cache entry emptied"
);
register_counter!(NAME)
});
pub static NAMESPACE_LOAD_LATENCY: Lazy<Histogram> = Lazy::new(|| {
const NAME: &str = "libsql_server_namespace_load_latency";
describe_histogram!(NAME, "latency is us when loading a namespace");
Expand Down
2 changes: 2 additions & 0 deletions libsql-server/src/namespace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use crate::stats::Stats;

use self::meta_store::MetaStoreHandle;
pub use self::name::NamespaceName;
#[cfg(test)]
pub(crate) use self::store::test::make_store as make_test_store;
pub use self::store::NamespaceStore;

pub mod broadcasters;
Expand Down
Loading
Loading