Updated openstack/openstack
Project: openstack/keystone  76090ec1fcd882be439f28fb8a77165e16893939

Add pluggable range functions for token flush

This patch refactors the flush tokens functionality to have a pluggable
expiration range strategy that can be customized based on database
backend.  The batch size method has been replaced with a method that
will return an appropriate iterator for choosing expiration ranges.

This patch also allows MySQL to use the batch flush functionality to
alleviate problems with Galera replication and large write sets.  Galera
has a modest size limit (1GB) on how large write sets can grow and this
can be reached fairly easily if you run expiration infrequently, or just
have a high token issue rate.

This also changes the mechanism to do batch flushes to a more portable
mechanism that does not require subquery support w/LIMIT.  MySQL does
not support DELETE with a subquery that uses LIMIT.

The batch expiration strategy will return a timestamp each time it's
called.  The flush function will then delete all expired tokens up to
that timestamp.  It is possible that this will delete somewhat more than
the `batch_size` number of rows, but it is expected that it will
typically be close to that number, and will effectively chunk the work
into roughly equal size batches.

Closes-Bug: 1188378
Change-Id: I2df68a35691e001083f41f43e9c325bd687f7ec8