Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YSQL][#417] Adding TServer GFlag to Dictate the Cache Value for Sequ…
…ences Summary: The logic for setting sequence cache size has changed to allow values to be set using the cache flag passed in from TServer Gflag. Originally only cache option passed in from the sequence query was used to set the cache size eg. `CREATE SEQUENCE s1 CACHE 10`. With this change, maximum value will be chosen between the cache flag and cache option only if the maximum value is less than or equal to the total number of elements there exists in the sequence `abs((sequence max - sequence min) / sequence increment by)`. If the calculated cache size exceeds the total elements available, total elements will be used as cache size. The default cache flag is currently set to 100. In order to turn off the cache flag, the flag should be set to 0. This will fall back to the original behaviour where only cache option is used to determine the cache size. Note when cache flag value is reset by restarting the cluster, previously created sequences will continue to use its initial cache size until the end of its life time. New cache size will only apply to new sequences created in the restarted cluster. ALTER SEQUENCE dynamically changes the cache size when the size of total elements changes. This feature is to support serial pseudo-type and reduce RPC calls when generating values by allowing higher cache size to be configured at TServer level. Eg. ``` ./bin/yb-ctl create "ysql_sequence_cache_minval=1000" CREATE SEQUENCE s1; ``` The sequence s1 above will use cache size of 1000. Test Plan: - Added separate sequence test with the gflag - Tested existing regression tests related to sequences by turning off the gflag Reviewers: mihnea, hector Reviewed By: hector Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D9521
- Loading branch information