flush_expired_tokens API fails when more than 200k tokens in the token table
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
In Progress
|
Low
|
Sam Leong |
Bug Description
When there are over 200k tokens need to be flushed, it results the following error in mysql error.log -
2016-07-29 02:00:18 40452 [Warning] WSREP: transaction size limit (1073741824) exceeded: 1073774592
2016-07-29 02:00:19 40452 [ERROR] WSREP: rbr write fail, data_len: 0, 2
In the current code, it triggers a series of DELETE for a batch of 1000 tokens until all the expired tokens are deleted. However, all the DELETE transactions are not yet committed until the method exits.
For big size of transactions like that, we definitely cannot reply on the auto-commit in the end. Instead, explicit commit should be triggered for every single transaction.
The following is the error in keystone.log -
289518 27060 (keystone): 2016-07-29 01:15:25,397 CRITICAL log logging_excepthook OperationalError: (_mysql_
1289519 Traceback (most recent call last):
1289520 File "/opt/stack/
1289521 sys.exit(main())
1289522 File "/opt/stack/
1289523 cli.main(
1289524 File "/opt/stack/
1289525 CONF.command.
1289526 File "/opt/stack/
1289527 token_manager.
1289528 File "/opt/stack/
1289529 LOG.info(_LI('Total expired tokens removed: %d'), total_removed)
1289530 File "/usr/lib/
1289531 self.gen.next()
1289532 File "/opt/stack/
1289533 yield resource
1289534 File "/usr/lib/
1289535 self.gen.next()
1289536 File "/opt/stack/
1289537 self._end_
1289538 File "/opt/stack/
1289539 session.commit()
1289540 File "/opt/stack/
1289541 self.transactio
1289542 File "/opt/stack/
1289543 t[1].commit()
1289544 File "/opt/stack/
1289545 self._do_commit()
1289546 File "/opt/stack/
1289547 self.connection
1289548 File "/opt/stack/
1289549 self._handle_
1289550 File "/opt/stack/
1289551 util.raise_
1289552 File "/opt/stack/
1289553 reraise(
1289554 File "/opt/stack/
1289555 self.engine.
1289556 File "/opt/stack/
1289557 dbapi_connectio
1289558 OperationalError: (_mysql_
Fix proposed to branch: master /review. openstack. org/351428
Review: https:/