Skip to content

Commit 8236594

Browse files
committed
Set explicit limit to FT.AGGREGATE query.
1 parent a5204f8 commit 8236594

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

nativelink-store/src/redis_utils/ft_aggregate.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ use tracing::error;
2323
use crate::redis_utils::aggregate_types::RedisCursorData;
2424
use crate::redis_utils::ft_cursor_read::ft_cursor_read;
2525

26+
/// Maximum rows `FT.AGGREGATE` may return in total (across all cursor reads).
27+
///
28+
/// RediSearch applies an implicit **`LIMIT 0 10`** when `LIMIT` is omitted, which capped
29+
/// [`crate::redis_store::RedisStore::search_by_index_prefix`] (and thus scheduler
30+
/// `get_queued_actions`) at 10 documents regardless of `WITHCURSOR` batch size.
31+
const FT_AGGREGATE_MAX_TOTAL_RESULTS: i64 = 2147483648;
32+
2633
#[derive(Debug)]
2734
pub(crate) struct FtAggregateCursor {
2835
pub count: u64,
@@ -60,6 +67,10 @@ where
6067
.arg("LOAD")
6168
.arg(options.load.len())
6269
.arg(&options.load)
70+
// Override RediSearch default LIMIT 0 10 (see `FT_AGGREGATE_MAX_TOTAL_RESULTS`).
71+
.arg("LIMIT")
72+
.arg(0_i64)
73+
.arg(FT_AGGREGATE_MAX_TOTAL_RESULTS)
6374
.arg("WITHCURSOR")
6475
.arg("COUNT")
6576
.arg(options.cursor.count)

0 commit comments

Comments
 (0)