Deadlock on quota_usages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Vish Ishaya | ||
Havana |
Fix Released
|
Undecided
|
Unassigned | ||
Icehouse |
Fix Released
|
High
|
Vish Ishaya |
Bug Description
We are getting deadlocks for concurrent quota reservations that we did not see in grizzly:
see https:/
The deadlock handling needs to be fixed as per above, but we shouldn't be deadlocking, here. It seems this is due to bad indexes in the database:
mysql> show index from quota_usages;
+------
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------
| quota_usages | 0 | PRIMARY | 1 | id | A | 8 | NULL | NULL | | BTREE | | |
| quota_usages | 1 | ix_quota_
| quota_usages | 1 | ix_quota_
| quota_usages | 1 | ix_quota_
+------
4 rows in set (0.01 sec)
mysql> explain select * from quota_usages where project_id='foo' and user_id='bar' and deleted=0;
+----+-
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-
| 1 | SIMPLE | quota_usages | ref | ix_quota_
+----+-
1 row in set (0.00 sec)
We should have an index on project_id/deleted and project_
summary: |
- Deadlock on quota_usages due to misisng index + Deadlock on quota_usages |
tags: | added: icehouse-backport-potential |
Changed in nova: | |
milestone: | none → juno-1 |
status: | Fix Committed → Fix Released |
tags: |
added: havana-backport-potentialal icehouse-backport-potenti removed: icehouse-backport-potential |
tags: |
added: havana-backport-potential icehouse-backport-potential removed: havana-backport-potentialal icehouse-backport-potenti |
Changed in nova: | |
milestone: | juno-1 → 2014.2 |
alternatively we could clean up the _get_user_quotas and _get_project_quotas to be a single query:
https:/ /github. com/openstack/ nova/blob/ 0e080bdcdbf4428 6f2e01a45463784 42580dbce5/ nova/db/ sqlalchemy/ api.py# L3033