pgsql: When using the OSSP UUID library, cache its uuid_t state object.
| От | Tom Lane |
|---|---|
| Тема | pgsql: When using the OSSP UUID library, cache its uuid_t state object. |
| Дата | |
| Msg-id | E1Wq4UT-00007R-6S@gemulon.postgresql.org обсуждение исходный текст |
| Список | pgsql-committers |
When using the OSSP UUID library, cache its uuid_t state object. The original coding in contrib/uuid-ossp created and destroyed a uuid_t object (or, in some cases, even two of them) each time it was called. This is not the intended usage: you're supposed to keep the uuid_t object around so that the library can cache its state across uses. (Other UUID libraries seem to keep equivalent state behind-the-scenes in static variables, but OSSP chose differently.) Aside from being quite inefficient, creating a new uuid_t loses knowledge of the previously generated UUID, which in theory could result in duplicate V1-style UUIDs being created on sufficiently fast machines. On at least some platforms, creating a new uuid_t also draws some entropy from /dev/urandom, leaving less for the rest of the system. This seems sufficiently unpleasant to justify back-patching this change. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/3606754da9928de4669df7a29d9500d7da5693b9 Modified Files -------------- contrib/uuid-ossp/uuid-ossp.c | 74 ++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 30 deletions(-)
В списке pgsql-committers по дате отправления: