[Zope] mysql auto_increment adding numbers on its own

Martijn Pieters mj@zope.com
Tue, 2 Oct 2001 23:22:41 -0400


On Tue, Oct 02, 2001 at 10:25:50PM -0400, Ron Bickers wrote:
> It's the last two entries that have the same timestamp as two empty records
> in the MySQL database.  There are no conflict log entires in the stupid log.
> The 'Session END' entry above has the same timestamp as the successfully
> stored and e-mailed order.  The only thing the 'sendOrder' python script
> does after invalidate() is RESPONSE.redirect to another page.  It seems that
> if it made it that far, a simple RESPONSE.redirect wouldn't cause any
> conflicts.  Does this make sense?
> 
> Is there a more reliable way to produce a sequence of numbers with less
> (zero?) risk of skipping or duplicate numbers?

I am not sure what your session log actually tells me; are you saying you
are creating the MySQL autoinc number at the beginning of a series of
requests and responses with a client? Or only when the order is finalized?

As for unique, sequential numbering; try a transactional database. Current
versions of MySQL can do transactions as well, but for reliability I'd
personally opt for PostgreSQL; orders should be stored as securely as
possible, automically, etc. And PostgreSQL may even be faster than MySQL for
you in your application; MySQL no longer can claim being the fastest.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@zope.com
| Zope Corporation   http://www.zope.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------