Skip to content

Fix: add soft limit for graph rag size - #13252

Merged
yingfeng merged 3 commits into
infiniflow:mainfrom
Magicbook1108:main
Mar 2, 2026
Merged

yingfeng merged 3 commits into
infiniflow:mainfrom
Magicbook1108:main

Conversation

@Magicbook1108

@Magicbook1108 Magicbook1108 commented Feb 27, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Fix: add soft limit for graph rag size #13258 Q2

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@Magicbook1108
Magicbook1108 marked this pull request as draft February 27, 2026 02:34
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 27, 2026
@Magicbook1108
Magicbook1108 marked this pull request as ready for review February 27, 2026 02:35
@Magicbook1108 Magicbook1108 added the ci Continue Integration label Feb 27, 2026
@dosubot dosubot Bot added the 🐞 bug Something isn't working, pull request that fix bug. label Feb 27, 2026
@Magicbook1108
Magicbook1108 marked this pull request as draft February 27, 2026 02:35
@Magicbook1108
Magicbook1108 marked this pull request as ready for review February 27, 2026 02:35
@codecov

codecov Bot commented Feb 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.18%. Comparing base (7e0dd90) to head (1e9cb11).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13252      +/-   ##
==========================================
- Coverage   49.89%   47.18%   -2.72%     
==========================================
  Files          44       44              
  Lines        9738     9740       +2     
  Branches      110      110              
==========================================
- Hits         4859     4596     -263     
- Misses       4871     5131     +260     
- Partials        8       13       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yuzhichang

Copy link
Copy Markdown
Member

LGTM. Please fix CI errors.

@shaoqing404

Copy link
Copy Markdown
Contributor

If you need to read in English, please use Google Translate in the top right corner

有一点点相关问题:
当前解决的问题是如果 max_count=10000,最后一次是 p=9984, limit=16,刚好 9984+16=10000,不会超限;
但本质逻辑是 chunk_list 的修复是限制单次循环不超过 max_count,但 max_count 本身可能就是 10000

但search 引发的其中一个问题是 offset+limit 超过ES 10000的限制(这个限制和max_count互斥了),在search中单次查询的page和size是分页数,offset = (page - 1)* size 没有做上限检查,如果 page=138, size=100,则 offset=13700, limit=100,总计 13800 超限

引发的报错是:

"""BadRequestError('search_phase_execution_exception', meta=ApiResponseMeta(status=400, http_version='1.1', headers={'X-elastic-product': 'Elasticsearch', 'content-type': 'application/vnd.elasticsearch+json;compatible-with=8', 'content-length': '1495'}, duration=0.006059885025024414, node=NodeConfig(scheme='http', host='localhost', port=9200, path_prefix='', headers={'user-agent': 'elasticsearch-py/8.19.3 (Python/3.12.12; elastic-transport/8.17.1)'}, connections_per_node=10, request_timeout=10.0, http_compress=False, verify_certs=False, ca_certs=None, client_cert=None, client_key=None, ssl_assert_hostname=None, ssl_assert_fingerprint=None, ssl_version=None, ssl_context=None, ssl_show_warn=True, _extras={})), body={'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'Result window is too large, from + size must be less than or equal to: [10000] but was [13800]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.'}], 'type': 'search_phase_execution_exception', 'reason': 'all shards failed', 'phase': 'query', 'grouped': True, 'failed_shards': [{'shard': 0, 'index': 'ragflow_c603c33a072a11f1af5651d505616f77', 'node': '2yezF4UYTfyVEF3qQ3OaCA', 'reason': {'type': 'illegal_argument_exception', 'reason': 'Result window is too large, from + size must be less than or equal to: [10000] but was [13800]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.'}}], 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'Result window is too large, from + size must be less than or equal to: [10000] but was [13800]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.', 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'Result window is too large, from + size must be less than or equal to: [10000] but was [13800]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.'}}}, 'status': 400})
"""

完整的解决方案请考虑:
1、调高 max_result_windows
2、改用 search_after
3、动态limit

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Feb 28, 2026
@Magicbook1108
Magicbook1108 marked this pull request as draft February 28, 2026 06:36
@Magicbook1108
Magicbook1108 marked this pull request as ready for review February 28, 2026 08:26
@yingfeng
yingfeng merged commit daec36e into infiniflow:main Mar 2, 2026
1 check passed
guptas6est pushed a commit to Nordix/ragflow that referenced this pull request Mar 5, 2026
### What problem does this PR solve?

Fix: add soft limit for graph rag size infiniflow#13258 Q2

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Yingfeng <[email protected]>
writinwaters pushed a commit to writinwaters/ragflow that referenced this pull request Apr 10, 2026
### What problem does this PR solve?

Fix: add soft limit for graph rag size infiniflow#13258 Q2

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Yingfeng <[email protected]>
SailedApple1991 pushed a commit to SailedApple1991/greenlaw-ragflow that referenced this pull request Apr 12, 2026
### What problem does this PR solve?

Fix: add soft limit for graph rag size infiniflow#13258 Q2

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Yingfeng <[email protected]>
JasleenKaurSethi pushed a commit to stackhpc/ragflow that referenced this pull request Apr 28, 2026
### What problem does this PR solve?

Fix: add soft limit for graph rag size infiniflow#13258 Q2

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Yingfeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants