Conversation
|
I'm not clear that set_size will work. When the pool is initialised, it uses the size to pre-populate the queue with the right number of workers: Lines 132 to 139 in 8c28a49 What will happen if we change the size (up or down) without changing the number of workers? Unless it is obvious, some sort of test is required. |
ffd51af to
a2fe397
Compare
This changeset introduces three new functions: * `poolboy:set_pool_size/2,3` and `poolboy:get_pool_size/1`, which can be used to resize a running poolboy process dynamically; * `poolboy:status_ext/1`, which in addition to the items returned by `status/1`, also reports the values of `size` and `latched_size`. The new size is assigned to a new state record field, `latched_size`. If it is greater than the current size, new checkouts will succeed even in a `full` state, until the actual size, incremented per checkout, grows and matches the latched_size. If `latched_size` is smaller than current size, no immediate action is taken on those currently checked-out workers which are now in excess of the latched size. Instead, as they are checked in, they are dismissed until the actual size decreases to match latched size. The `set_pool_size/3` variant also allows to set the value of max_overflow. One limitation is that after setting a new size, the state of the poolboy process (as returned by `poolboy:status` or `status_ext`), may not reflect the actual state of the pooloy fsm wrt its ability to accept new checkouts. This condition is temporary and the status will resume normal reporting once `size` converges with `latched_size`. This changeset is needed for tiot/openriak-3.4/tictacaae-and-nextgenrepl-cli-commands branches in riak_kv and riak_core. pool dynamic resize for overflow = 0 pool dynamic resize for overflow > 0, too wip towards more comprehensive tests wip reasonably good wip spurious wip need to tweak asserts in test wip finalizing more extensive test, with fixes resulting therefrom address possible case of pool stop returning too early before pool start
e111539 to
7c28495
Compare
|
Now this is done with proper amount of attention, and a more meaningful test. More details in the squashed commit description above. |
|
No longer part of TicTacAAE set of PRs (OpenRiak/riak_kv#31, OpenRiak/riak#13) because the changes in this PR (required to enable the three poolsize-changing CLI commands) are touching parts that are too critical and best left alone, for the minor convenience of having an option to tweak worker poolsizes. So closing. |
This PR provides functions to get and set the size of core node worker pools, intended to be used by callbacks (implemented in OpenRiak/kv_index_tictactree#4) of riak admin tictacaae commands. See this discussion and eventually OpenRiak/riak#13.