← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1619299] Re: some backends round timestamp up instead of truncate

 

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

commit cd80ae6e42e31d6c5dd6f7a296d0ae0d3a3e4ae0
Author: Kevin Benton <kevin@xxxxxxxxxx>
Date:   Sun Aug 28 06:52:52 2016 -0700

    Truncate microseconds before DB insertion
    
    During the development of patch [1], it became apparent
    that the DB was rounding the microseconds part of a datetime
    object. This caused inconsistencies between what would be
    stored in the DB and what was returned to the user via the
    API because the API uses strftime.
    
    For an example, see the INSERT statement on L1-L2 and then
    the subsequent retrieval of the same record on L43 of [2].
    The microseconds were rounded up even though the mysql docs
    say they will be truncated.
    
    In order to ensure consistency across SQL drivers, backends,
    and our API, this patch adds a TruncatedDateTime object which
    truncates off the microseconds before they go into the database.
    
    1. I78b00516e31ce83376d37f57299b2229b6fb8fcf
    2. http://paste.openstack.org/show/565116/
    
    Closes-Bug: #1619299
    Change-Id: I47d5ad5a5cdc0cb0d61f0642616cccc8f341ed62


** 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/1619299

Title:
  some backends round timestamp up instead of truncate

Status in neutron:
  Fix Released

Bug description:
  Behavior observed in the gate is that microseconds on datetime object
  for created_at/updated_at are being used to round up the second
  instead of truncate it.

  2016-08-31 09:16:20.652 14411 INFO sqlalchemy.engine.base.Engine [req-c9350354-e963-4a2e-b1cb-71444094111c tempest-SecGroupIPv6Test-1503726360 -] INSERT INTO standardattributes (created_at, updated_at, resource_type, description, revision_number) VALUES (%(created_at)s, %(updated_at)s, %(resource_type)s, %(description)s, %(revision_number)s)
  2016-08-31 09:16:20.652 14411 INFO sqlalchemy.engine.base.Engine [req-c9350354-e963-4a2e-b1cb-71444094111c tempest-SecGroupIPv6Test-1503726360 -] {'revision_number': 1, 'created_at': datetime.datetime(2016, 8, 31, 9, 16, 20, 650708), 'description': '', 'resource_type': 'securitygrouprules', 'updated_at': datetime.datetime(2016, 8, 31, 9, 16, 20, 650708)}

  2016-08-31 09:16:20.700 14411 DEBUG sqlalchemy.engine.base.Engine [req-9033b306-113f-45ad-a7db-3e2f79124b37 tempest-SecGroupIPv6Test-1503726360 -] Col (u'securitygrouprules_project_id', u'securitygrouprules_id', u'securitygrouprules_security_group_id', u'securitygrouprules_remote_group_id', u'securitygrouprules_direction', u'securitygrouprules_ethertype', u'securitygrouprules_protocol', u'securitygrouprules_port_range_min', u'securitygrouprules_port_range_max', u'securitygrouprules_remote_ip_prefix', u'securitygrouprules_standard_attr_id', u'standardattributes_1_created_at', u'standardattributes_1_updated_at', u'standardattributes_1_id', u'standardattributes_1_resource_type', u'standardattributes_1_description', u'standardattributes_1_revision_number', u'tags_1_standard_attr_id', u'tags_1_tag') _init_metadata /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:529
  2016-08-31 09:16:20.701 14411 DEBUG sqlalchemy.engine.base.Engine [req-9033b306-113f-45ad-a7db-3e2f79124b37 tempest-SecGroupIPv6Test-1503726360 -] Row (u'0252352f1fb84f59a2c0db9e2cb21515', u'd6f8b7b8-4bcb-4876-96e2-343fbb3202d6', u'02fb88e6-4fe6-4cda-b9bf-96a41fe91e5f', None, u'ingress', u'IPv6', u'udp', None, None, None, 2520, datetime.datetime(2016, 8, 31, 9, 16, 21), datetime.datetime(2016, 8, 31, 9, 16, 21), 2520, u'securitygrouprules', u'', 1, None, None) process_rows /usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py:939
  2016-08-31 09:16:20.704 14411 INFO neutron.wsgi [req-9033b306-113f-45ad-a7db-3e2f79124b37 tempest-SecGroupIPv6Test-1503726360 -] 127.0.0.1 - - [31/Aug/2016 09:16:20] "GET /v2.0/security-group-rules/d6f8b7b8-4bcb-4876-96e2-343fbb3202d6 HTTP/1.1" 200 646 0.014147

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


References