mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-07-26 07:58:14 +00:00
add missing repair-on-read for k2v range reads
This commit is contained in:
@@ -114,6 +114,7 @@ async fn handle_read_batch_query(
|
|||||||
query.limit,
|
query.limit,
|
||||||
Some(filter),
|
Some(filter),
|
||||||
EnumerationOrder::from_reverse(query.reverse),
|
EnumerationOrder::from_reverse(query.reverse),
|
||||||
|
monotonic_read,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -222,6 +223,7 @@ async fn handle_delete_batch_query(
|
|||||||
None,
|
None,
|
||||||
Some(filter),
|
Some(filter),
|
||||||
EnumerationOrder::Forward,
|
EnumerationOrder::Forward,
|
||||||
|
K2VMonotonicRead::NonMonotonic,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
assert!(!more);
|
assert!(!more);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use serde::Serialize;
|
|||||||
use garage_table::util::*;
|
use garage_table::util::*;
|
||||||
|
|
||||||
use garage_model::k2v::item_table::{BYTES, CONFLICTS, ENTRIES, VALUES};
|
use garage_model::k2v::item_table::{BYTES, CONFLICTS, ENTRIES, VALUES};
|
||||||
|
use garage_model::k2v::rpc::K2VMonotonicRead;
|
||||||
|
|
||||||
use garage_api_common::helpers::*;
|
use garage_api_common::helpers::*;
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ pub async fn handle_read_index(
|
|||||||
limit,
|
limit,
|
||||||
Some((DeletedFilter::NotDeleted, node_id_vec)),
|
Some((DeletedFilter::NotDeleted, node_id_vec)),
|
||||||
EnumerationOrder::from_reverse(reverse),
|
EnumerationOrder::from_reverse(reverse),
|
||||||
|
K2VMonotonicRead::NonMonotonic,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|||||||
+27
-9
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use garage_model::k2v::rpc::K2VMonotonicRead;
|
||||||
|
|
||||||
use garage_table::replication::TableShardedReplication;
|
use garage_table::replication::TableShardedReplication;
|
||||||
use garage_table::*;
|
use garage_table::*;
|
||||||
|
|
||||||
@@ -23,6 +25,7 @@ pub(crate) async fn read_range<F>(
|
|||||||
limit: Option<u64>,
|
limit: Option<u64>,
|
||||||
filter: Option<F::Filter>,
|
filter: Option<F::Filter>,
|
||||||
enumeration_order: EnumerationOrder,
|
enumeration_order: EnumerationOrder,
|
||||||
|
monotonic_read: K2VMonotonicRead,
|
||||||
) -> Result<(Vec<F::E>, bool, Option<String>), Error>
|
) -> Result<(Vec<F::E>, bool, Option<String>), Error>
|
||||||
where
|
where
|
||||||
F: TableSchema<S = String> + 'static,
|
F: TableSchema<S = String> + 'static,
|
||||||
@@ -53,15 +56,30 @@ where
|
|||||||
1000,
|
1000,
|
||||||
limit.map(|x| x as usize).unwrap_or(usize::MAX - 10) - entries.len() + 2,
|
limit.map(|x| x as usize).unwrap_or(usize::MAX - 10) - entries.len() + 2,
|
||||||
);
|
);
|
||||||
let get_ret = table
|
let get_ret = match monotonic_read {
|
||||||
.get_range(
|
K2VMonotonicRead::Monotonic => {
|
||||||
partition_key,
|
table
|
||||||
start.clone(),
|
.get_range_monotonic(
|
||||||
filter.clone(),
|
partition_key,
|
||||||
n_get,
|
start.clone(),
|
||||||
enumeration_order,
|
filter.clone(),
|
||||||
)
|
n_get,
|
||||||
.await?;
|
enumeration_order,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
K2VMonotonicRead::NonMonotonic => {
|
||||||
|
table
|
||||||
|
.get_range(
|
||||||
|
partition_key,
|
||||||
|
start.clone(),
|
||||||
|
filter.clone(),
|
||||||
|
n_get,
|
||||||
|
enumeration_order,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let get_ret_len = get_ret.len();
|
let get_ret_len = get_ret.len();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user