Skip to content
Open
Changes from all commits
Commits
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
13 changes: 1 addition & 12 deletions lore-aws/src/dynamodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ const QUERY_ROWS: [f64; 10] = [
pub const METRICS_ACCUMULATION_OPERATION_LATENCY_METRIC_NAME: &str =
"accumulation_operation_duration";

/// Temporary environment variable to allow enabling/disabling query pagination.
/// TODO(jcohen): Remove this when we're confident in the pagination support.
static ENABLE_QUERY_PAGINATION: LazyLock<bool> =
LazyLock::new(|| match std::env::var("LORE_ENABLE_QUERY_PAGINATION") {
Ok(v) => v.eq_ignore_ascii_case("true"),
Err(_) => true, // Default to enabled if the env var isn't present
});

pub trait DynamoDbQuery {
fn index_name(&self) -> Option<String> {
Expand Down Expand Up @@ -652,11 +645,7 @@ impl DynamoDbImpl {
// rows.
// 3. *Unless* the query is also a count query (in which case we need to fetch
// until there's no more data to collect to ensure we get the correct count).
// TODO(jcohen): We should probably disallow the combination of `Select::Count`
// and a limit to avoid the degenerate case of fetching a full count one row at
// a time.
if *ENABLE_QUERY_PAGINATION
&& let Some(last_evaluated_key) = r.last_evaluated_key
if let Some(last_evaluated_key) = r.last_evaluated_key
&& !last_evaluated_key.is_empty()
&& (query.limit().is_none()
|| matches!(query.select(), Some(Select::Count))
Expand Down
Loading