Calculate timestamps within DB, not client

Bug #1787345 reported by Yikun Jiang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.db
In Progress
Wishlist
Yikun Jiang

Bug Description

Calculating the timestamp in the clients can lead to problems because network latency is variable, clients experience slightly different clock drift.

SQLAlchemy allows us to do this by passing func.now() which tells the DB to calculate the timestamp itself

So, in order to make the updated_at and created_at more accurate, we should calculate the timestamp in db.[1]

[1] https://github.com/openstack/oslo.db/blob/3ef34da/oslo_db/sqlalchemy/models.py#L138-L139
[2] https://stackoverflow.com/questions/12154129/how-can-i-automatically-populate-sqlalchemy-database-fields-flask-sqlalchemy
[3] https://stackoverflow.com/questions/13370317/sqlalchemy-default-datetime
[4] http://docs.sqlalchemy.org/en/latest/core/defaults.html#client-invoked-sql-expressions

Changed in oslo.db:
assignee: nobody → Yikun Jiang (yikunkero)
status: New → In Progress
Ben Nemec (bnemec)
Changed in oslo.db:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on oslo.db (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.opendev.org/592304

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.