Public bug reported:

When trying to delete a consumer with OS-OAUTH1 extension, Keystone
sends twice a same delete sql query.

After a quick glance, it appears to me that this bug concerns several
keystone objects, at least request_token and access_token (OS-OAUTH1)
and identity_provider (OS-FEDERATION)


Example logs from keystone:

    2014-05-28 13:02:33.424 7296 INFO sqlalchemy.engine.base.Engine [-] SELECT 
consumer.id AS consumer_id, consumer.description AS consumer_description, 
consumer.secret AS consumer_secret, consumer.extra AS consumer_extra 
    FROM consumer 
    WHERE consumer.id = %s
    2014-05-28 13:02:33.424 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
    2014-05-28 13:02:33.424 7296 DEBUG sqlalchemy.engine.base.Engine [-] Col 
('consumer_id', 'consumer_description', 'consumer_secret', 'consumer_extra') 
__init__ /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:274
    2014-05-28 13:02:33.425 7296 DEBUG sqlalchemy.engine.base.Engine [-] Row 
('0cd89a4e04eb4066a78bd9e8727baa24', None, 'b196d850e18c4ea984e37861b6789966', 
'{}') process_rows 
/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:771
    2014-05-28 13:02:33.425 7296 INFO sqlalchemy.engine.base.Engine [-] DELETE 
FROM consumer WHERE consumer.id = %s
    2014-05-28 13:02:33.425 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
    2014-05-28 13:02:33.426 7296 INFO sqlalchemy.engine.base.Engine [-] DELETE 
FROM consumer WHERE consumer.id = %s
    2014-05-28 13:02:33.426 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
    /usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py:116: 
SAWarning: DELETE statement on table 'consumer' expected to delete 1 row(s); 0 
were matched.  Please set confirm_deleted_rows=False within the mapper 
configuration to prevent this warning.
      cached_connections, mapper, table, delete)
    2014-05-28 13:02:33.427 7296 INFO sqlalchemy.engine.base.Engine [-] COMMIT
    2014-05-28 13:02:33.572 7296 INFO eventlet.wsgi.server [-] 127.0.0.1 - - 
[28/May/2014 13:02:33] "DELETE 
/v3/OS-OAUTH1/consumers/0cd89a4e04eb4066a78bd9e8727baa24 HTTP/1.1" 204 103 
0.167622


The problem seems to come from this code (almost identicaly on several places), 
where we can see the two delete actions:

        consumer_ref = self._get_consumer(session, consumer_id)
        q = session.query(Consumer)
        q = q.filter_by(id=consumer_id)
        q.delete(False)
        session.delete(consumer_ref)

** Affects: keystone
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1324076

Title:
  Duplicated DELETE queries on sql backend

Status in OpenStack Identity (Keystone):
  New

Bug description:
  When trying to delete a consumer with OS-OAUTH1 extension, Keystone
  sends twice a same delete sql query.

  After a quick glance, it appears to me that this bug concerns several
  keystone objects, at least request_token and access_token (OS-OAUTH1)
  and identity_provider (OS-FEDERATION)


  Example logs from keystone:

      2014-05-28 13:02:33.424 7296 INFO sqlalchemy.engine.base.Engine [-] 
SELECT consumer.id AS consumer_id, consumer.description AS 
consumer_description, consumer.secret AS consumer_secret, consumer.extra AS 
consumer_extra 
      FROM consumer 
      WHERE consumer.id = %s
      2014-05-28 13:02:33.424 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
      2014-05-28 13:02:33.424 7296 DEBUG sqlalchemy.engine.base.Engine [-] Col 
('consumer_id', 'consumer_description', 'consumer_secret', 'consumer_extra') 
__init__ /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:274
      2014-05-28 13:02:33.425 7296 DEBUG sqlalchemy.engine.base.Engine [-] Row 
('0cd89a4e04eb4066a78bd9e8727baa24', None, 'b196d850e18c4ea984e37861b6789966', 
'{}') process_rows 
/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:771
      2014-05-28 13:02:33.425 7296 INFO sqlalchemy.engine.base.Engine [-] 
DELETE FROM consumer WHERE consumer.id = %s
      2014-05-28 13:02:33.425 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
      2014-05-28 13:02:33.426 7296 INFO sqlalchemy.engine.base.Engine [-] 
DELETE FROM consumer WHERE consumer.id = %s
      2014-05-28 13:02:33.426 7296 INFO sqlalchemy.engine.base.Engine [-] 
('0cd89a4e04eb4066a78bd9e8727baa24',)
      /usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py:116: 
SAWarning: DELETE statement on table 'consumer' expected to delete 1 row(s); 0 
were matched.  Please set confirm_deleted_rows=False within the mapper 
configuration to prevent this warning.
        cached_connections, mapper, table, delete)
      2014-05-28 13:02:33.427 7296 INFO sqlalchemy.engine.base.Engine [-] COMMIT
      2014-05-28 13:02:33.572 7296 INFO eventlet.wsgi.server [-] 127.0.0.1 - - 
[28/May/2014 13:02:33] "DELETE 
/v3/OS-OAUTH1/consumers/0cd89a4e04eb4066a78bd9e8727baa24 HTTP/1.1" 204 103 
0.167622

  
  The problem seems to come from this code (almost identicaly on several 
places), where we can see the two delete actions:

          consumer_ref = self._get_consumer(session, consumer_id)
          q = session.query(Consumer)
          q = q.filter_by(id=consumer_id)
          q.delete(False)
          session.delete(consumer_ref)

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1324076/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to