|
26 | 26 | *
|
27 | 27 | * B) I/O is necessary, but fadvise is undesirable because the access is
|
28 | 28 | * sequential, or impossible because direct I/O is enabled or the system
|
29 |
| - * doesn't support advice. There is no benefit in looking ahead more than |
30 |
| - * io_combine_limit, because in this case only goal is larger read system |
| 29 | + * doesn't support fadvise. There is no benefit in looking ahead more than |
| 30 | + * io_combine_limit, because in this case the only goal is larger read system |
31 | 31 | * calls. Looking further ahead would pin many buffers and perform
|
32 | 32 | * speculative work looking ahead for no benefit.
|
33 | 33 | *
|
34 |
| - * C) I/O is necesssary, it appears random, and this system supports fadvise. |
| 34 | + * C) I/O is necessary, it appears random, and this system supports fadvise. |
35 | 35 | * We'll look further ahead in order to reach the configured level of I/O
|
36 | 36 | * concurrency.
|
37 | 37 | *
|
@@ -418,7 +418,7 @@ read_stream_begin_relation(int flags,
|
418 | 418 | ReadStream *stream;
|
419 | 419 | size_t size;
|
420 | 420 | int16 queue_size;
|
421 |
| - int16 max_ios; |
| 421 | + int max_ios; |
422 | 422 | int strategy_pin_limit;
|
423 | 423 | uint32 max_pinned_buffers;
|
424 | 424 | Oid tablespace_id;
|
@@ -447,6 +447,8 @@ read_stream_begin_relation(int flags,
|
447 | 447 | max_ios = get_tablespace_maintenance_io_concurrency(tablespace_id);
|
448 | 448 | else
|
449 | 449 | max_ios = get_tablespace_io_concurrency(tablespace_id);
|
| 450 | + |
| 451 | + /* Cap to INT16_MAX to avoid overflowing below */ |
450 | 452 | max_ios = Min(max_ios, PG_INT16_MAX);
|
451 | 453 |
|
452 | 454 | /*
|
|
0 commit comments