← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1593719] Re: StaleDataError: DELETE statement on table 'standardattributes' expected to delete 1 row(s); 0 were matched

 

Reviewed:  https://review.openstack.org/331137
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=f3816cb8bd68f406d7f8c5b80fbd3352b493ca70
Submitter: Jenkins
Branch:    master

commit f3816cb8bd68f406d7f8c5b80fbd3352b493ca70
Author: Ihar Hrachyshka <ihrachys@xxxxxxxxxx>
Date:   Wed Jun 29 15:35:44 2016 +0200

    ml2: postpone exception logs to when retry mechanism fails to recover
    
    Since Ia2d911a6a90b1baba1d5cc36f7c625e156a2bc33, we use version_id_col
    SQLAlchemy feature to routinely bump revision numbers for resources.  By
    doing so, SQLAlchemy also enforces the expected number on any UPDATE and
    DELETE, which may not be valid when the transaction is actually applied.
    In that case, the library will raise StaleDataError:
    
    http://docs.sqlalchemy.org/en/latest/orm/exceptions.html#sqlalchemy.orm.exc.StaleDataError
    
    The exception is then logged by ml2 and bubbles up to API layer where
    retry mechanism will correctly catch it and issue another attempt.
    
    If API layer does not retry on exception, it already logs the error,
    including the traceback.
    
    In ml2, it's too early to decide if an exception is worth being logged.
    Plugin instead should just silently allow all unexpected exceptions to
    bubble up and be dealt by API layer.
    
    At the same time, there are some details that are known at the plugin
    level only, that are not easily deducible from the API request details.
    That's why we save details about the error on the exception object that
    bubbles up into API layer, where we are ready to decide if those details
    are worth being logged.
    
    Change-Id: I848df0aef5381e50dfb58e46d7a652113ac27a49
    Closes-Bug: #1593719


** Changed in: neutron
       Status: In Progress => Fix Released

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

Title:
  StaleDataError: DELETE statement on table 'standardattributes'
  expected to delete 1 row(s); 0 were matched

Status in neutron:
  Fix Released

Bug description:
  This error started to show up in neutron-server logs in gate after
  https://review.openstack.org/#/c/328185/5 landed. The reason is that
  using version_id_col makes UPDATE and DELETE filter by the revision
  number, and raise StaleDataError on mismatch. That's documented in:
  http://docs.sqlalchemy.org/en/latest/orm/exceptions.html#sqlalchemy.orm.exc.StaleDataError

  Once the exception is raised, it's correctly caught by retry
  mechanism. We should consider StateDataErrors a usual operation mode,
  and hence avoid logging the exceptions in ml2 plugin. Instead, we
  should bubble up exceptions to retry layer and allow it to determine
  if to log those exceptions.

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


References