MongoDriver->getETag()
can return the same etag for two different timestamps if they are within ~500 milliseconds
#131
Labels
The following method, computes an ETag for a document based on its
_UPDATED_TS
:In principle, saving a change to a document, should result in a different value being computed for the Etag because the
_UPDATED_TS
will have changed. However this is not always the case. Based on the algorithm above, if the document is updated twice within ~500 milliseconds the same ETag is computed (floor
rounds a number).To demonstrate this I have created a branch (https://github.com/talis/tripod-php/tree/spike_etag_bug) with some unit tests that are failing because of this.
All of the above tests fail: https://travis-ci.org/talis/tripod-php/builds/463727103 consistently on PHP 7, 5.6 and 5.5. If I use a sleep duration greater than 500 milliseconds it fails intermittently, and at a second it always seems to work.
The text was updated successfully, but these errors were encountered: