Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit500b617

Browse files
committed
Fix bug allowing io_combine_limit > io_max_combine_combine limit
10f6646 intended to limit the value of io_combine_limit to the minimum ofio_combine_limit and io_max_combine_limit. To avoid issues with interdependentGUCs, it introduced io_combine_limit_guc and set io_combine_limit in assignhooks. That plan was thwarted by guc_tables.c accidentally still referencingio_combine_limit, instead of io_combine_limit_guc. That lead to the GUCmachinery overriding the work done in the assign hooks, potentially leavingio_combine_limit with a too high value.The consequence of this bug was that when running with io_combine_limit >io_combine_limit_guc the AIO machinery would not have reserved large enoughiovec and IO data arrays, with one IO's arrays overlapping with another IO's,leading to total confusion.To make such a problem easier to detect in the future, add assertions topgaio_io_set_handle_data_* checking the length is smaller thanio_max_combine_limit (not just PG_IOV_MAX).It'd be nice to have a few tests for this, but it's not entirely obvious howto do so portably.As remarked upon by Tom, the GUC assignment hooks really shouldn't set theunderlying variable, that's the job of the GUC machinery. Change that as well.Discussion:https://postgr.es/m/c5jyqnuwrpigd35qe7xdypxsisdjrdba5iw63mhcse4mzjogxo@qdjpv22z763f
1 parent0d9114b commit500b617

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎src/backend/commands/variable.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,14 +1163,12 @@ assign_maintenance_io_concurrency(int newval, void *extra)
11631163
void
11641164
assign_io_max_combine_limit(intnewval,void*extra)
11651165
{
1166-
io_max_combine_limit=newval;
1167-
io_combine_limit=Min(io_max_combine_limit,io_combine_limit_guc);
1166+
io_combine_limit=Min(newval,io_combine_limit_guc);
11681167
}
11691168
void
11701169
assign_io_combine_limit(intnewval,void*extra)
11711170
{
1172-
io_combine_limit_guc=newval;
1173-
io_combine_limit=Min(io_max_combine_limit,io_combine_limit_guc);
1171+
io_combine_limit=Min(io_max_combine_limit,newval);
11741172
}
11751173

11761174
/*

‎src/backend/storage/aio/aio_callback.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pgaio_io_set_handle_data_64(PgAioHandle *ioh, uint64 *data, uint8 len)
124124
Assert(ioh->state==PGAIO_HS_HANDED_OUT);
125125
Assert(ioh->handle_data_len==0);
126126
Assert(len <=PG_IOV_MAX);
127+
Assert(len <=io_max_combine_limit);
127128

128129
for (inti=0;i<len;i++)
129130
pgaio_ctl->handle_data[ioh->iovec_off+i]=data[i];
@@ -141,6 +142,7 @@ pgaio_io_set_handle_data_32(PgAioHandle *ioh, uint32 *data, uint8 len)
141142
Assert(ioh->state==PGAIO_HS_HANDED_OUT);
142143
Assert(ioh->handle_data_len==0);
143144
Assert(len <=PG_IOV_MAX);
145+
Assert(len <=io_max_combine_limit);
144146

145147
for (inti=0;i<len;i++)
146148
pgaio_ctl->handle_data[ioh->iovec_off+i]=data[i];

‎src/backend/utils/misc/guc_tables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3287,7 +3287,7 @@ struct config_int ConfigureNamesInt[] =
32873287
NULL,
32883288
GUC_UNIT_BLOCKS
32893289
},
3290-
&io_combine_limit,
3290+
&io_combine_limit_guc,
32913291
DEFAULT_IO_COMBINE_LIMIT,
32923292
1,MAX_IO_COMBINE_LIMIT,
32933293
NULL,assign_io_combine_limit,NULL

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp