Commit abf33ba
committed
[yugabyte#27202] YSQL: Fix analyze for large rows
Summary:
If multiple batched request are sent to multiple nodes in parallel, their results are combined into single response. This single response can exceed size limits.
There are two ways to fix it.
1. set the fetch size limit to ~ `rpc_max_message_size * max_buffer_size_to_rpc_limit_ratio / send_count`
2. modify the batching behaviour
#1 is much simpler, so we go with that approach.
If the request has no size limit (yb_fetch_size_limit = 0) or a size limit greater than the max allowed, set the size limit to `rpc_max_message_size * max_buffer_size_to_rpc_limit_ratio / send_count`.
Jira: DB-16688
Test Plan:
```lang=sql
CREATE TABLE tbl1(col0 TEXT) SPLIT INTO 10 TABLETS;
INSERT INTO tbl1 SELECT repeat('a', 30000) FROM generate_series(0, 30000);
ANALYZE tbl1; -- fails before this diff
```
```lang=sh
./yb_build.sh --cxx-test pg_tablet_split-test --gtest_filter PgManyTabletsSelect.AnalyzeTableWithLargeRows -n 20
```
Note that this test uses a separate test class because RPC_max_message_size is a non-runtime flag, and setting it at runtime can result in flaky failures as some sections of the code are aware of the new limit and other's aren't.
Reviewers: amartsinchyk
Reviewed By: amartsinchyk
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D444551 parent aa43df4 commit abf33ba
File tree
2 files changed
+62
-0
lines changed- src/yb/yql
- pggate
- pgwrapper
2 files changed
+62
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
375 | 378 | | |
376 | 379 | | |
377 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
378 | 401 | | |
379 | 402 | | |
380 | 403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
776 | 778 | | |
777 | 779 | | |
778 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
779 | 818 | | |
780 | 819 | | |
781 | 820 | | |
| |||
0 commit comments