Scale-out storage: IMAP CONDSTORE raises the mark, and the two-node check (ST-7, test 11)
A FETCH with CHANGEDSINCE presents its mod-sequence to the read scope, so a replica must have that change before it answers, as a JMAP sinceState already did. replica_cluster_tests covers test 11: with the replica's replay paused, a write on one node is read back through a second store with its own marks, sharing through Redis. Composite stores nest store futures deeply enough to pass rustc's default query depth once both postgres and redis are compiled in, so the server crates raise their recursion limit.
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use crate::auth::{AccessTokenInner, EmailAddress};
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
#[allow(unused_imports)]
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
pub mod calendar;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use crate::backend::oidc::OpenIdDirectory;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
pub mod cache;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use calcard::common::timezone::Tz;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
pub mod api;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
@@ -175,6 +175,8 @@ impl<T: SessionStream> SessionData<T> {
|
||||
|
||||
// Convert state to modseq
|
||||
if let Some(changed_since) = arguments.changed_since {
|
||||
// inbuxa: ST-7: a replica must have the state the client knows
|
||||
store::backend::scaleout::replica::present_change(self.account_id, changed_since);
|
||||
// Obtain changes since the modseq.
|
||||
let changelog = self
|
||||
.server
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use jmap_proto::object::JmapObjectId;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
pub mod core;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use std::{net::IpAddr, sync::Arc};
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use broadcast::publisher::spawn_broadcast_publisher;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
use common::{
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
// inbuxa: composite stores (sharded members, read replicas) nest store
|
||||
// futures deeply enough to pass rustc's default query depth
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#![warn(clippy::large_futures)]
|
||||
|
||||
pub mod analysis;
|
||||
|
||||
@@ -141,12 +141,26 @@ pub fn is_replica_subspace(subspace: u8) -> bool {
|
||||
/// the client presented (ST-7, step 4), and the replica it settled on.
|
||||
pub struct ReadScope {
|
||||
accounts: Vec<(u32, u64)>,
|
||||
/// Change ids the client presented during the scope (ST-7, step 4).
|
||||
presented: Mutex<Vec<(u32, u64)>>,
|
||||
choice: tokio::sync::OnceCell<Option<usize>>,
|
||||
/// Set by any write made inside the scope: from then on it reads from
|
||||
/// the primary (ST-6: a read in a request that writes).
|
||||
wrote: std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
/// A state the client presented raises the mark a replica must have
|
||||
/// reached before it may answer this scope (ST-7, step 4).
|
||||
pub fn present_change(account_id: u32, change_id: u64) {
|
||||
let _ = READ_SCOPE.try_with(|scope| {
|
||||
scope
|
||||
.presented
|
||||
.lock()
|
||||
.unwrap()
|
||||
.push((account_id, change_id))
|
||||
});
|
||||
}
|
||||
|
||||
/// A write happened in the current task: a read scope, if any, stops using
|
||||
/// replicas.
|
||||
pub fn note_scope_write() {
|
||||
@@ -167,6 +181,7 @@ pub async fn replica_read<F: Future>(
|
||||
.scope(
|
||||
Arc::new(ReadScope {
|
||||
accounts: accounts.into_iter().collect(),
|
||||
presented: Mutex::new(Vec::new()),
|
||||
choice: tokio::sync::OnceCell::new(),
|
||||
wrote: std::sync::atomic::AtomicBool::new(false),
|
||||
}),
|
||||
@@ -310,8 +325,15 @@ impl ReplicatedStore {
|
||||
if !replica.usable() {
|
||||
continue;
|
||||
}
|
||||
for (account_id, presented) in &scope.accounts {
|
||||
let mark = self.mark(*account_id).await.max(*presented);
|
||||
let presented = scope.presented.lock().unwrap().clone();
|
||||
for (account_id, from_request) in &scope.accounts {
|
||||
let highest = presented
|
||||
.iter()
|
||||
.filter(|(id, _)| id == account_id)
|
||||
.map(|(_, change_id)| *change_id)
|
||||
.max()
|
||||
.unwrap_or_default();
|
||||
let mark = self.mark(*account_id).await.max(*from_request).max(highest);
|
||||
if mark == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user