You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/08/21 21:17:54 UTC

[GitHub] imsut opened a new pull request #3779: [AIRFLOW-2928] replace uuid1 with uuid4 for better randomness

imsut opened a new pull request #3779: [AIRFLOW-2928] replace uuid1 with uuid4 for better randomness
URL: https://github.com/apache/incubator-airflow/pull/3779
 
 
   ### Description
   
   some components in Airflow use the first 8 bytes of uuid.uuid1 to generate a unique job name. The first 8 bytes, however, seem to come from clock. so if this is called multiple times in a short time period, two ids will likely collide.
   uuid.uuid4 provides random values.
   
   ### Tests
   
   ```py
   Python 2.7.15 (default, Jun 17 2018, 12:46:58)
   [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import uuid
   >>> for i in range(10):
   ...   uuid.uuid1()
   ...
   UUID('e8bc9959-a586-11e8-ab8c-8c859010d0c2')
   UUID('e8c254e3-a586-11e8-ac39-8c859010d0c2')
   UUID('e8c2560f-a586-11e8-8251-8c859010d0c2')
   UUID('e8c256c2-a586-11e8-994a-8c859010d0c2')
   UUID('e8c25759-a586-11e8-9ba6-8c859010d0c2')
   UUID('e8c257e6-a586-11e8-a854-8c859010d0c2')
   UUID('e8c2587d-a586-11e8-89e9-8c859010d0c2')
   UUID('e8c2590a-a586-11e8-a825-8c859010d0c2')
   UUID('e8c25994-a586-11e8-9421-8c859010d0c2')
   UUID('e8c25a21-a586-11e8-83fd-8c859010d0c2')
   >>> for i in range(10):
   ...   uuid.uuid4()
   ...
   UUID('f1eba69f-18ea-467e-a414-b18d67f34a51')
   UUID('aaa4e18e-d4e6-42c9-905c-3cde714c2741')
   UUID('82f55c27-69ae-474b-ab9a-afcc7891587c')
   UUID('fab63643-ad33-4307-837b-68444fce7240')
   UUID('c4efca6c-3d1b-436c-8b09-e9b7f55ccefb')
   UUID('58de3a76-9d98-4427-8232-d6d7df2a1904')
   UUID('4f0a55e8-1357-4697-a345-e60891685b00')
   UUID('0fed47a3-07b6-423e-ae2e-d821c440cb63')
   UUID('144b2c55-a9bd-431d-b536-239fb2048a5e')
   UUID('d47fd8a0-48e9-4dcc-87f7-42c022c309a8')
   Attachments
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services