[Zope] mysql auto_increment adding numbers on its own

Ron Bickers rbickers-dated-1002685551.427c7f@logicetc.com
Tue, 2 Oct 2001 23:45:51 -0400


> -----Original Message-----
> From: Martijn Pieters [mailto:mj@zope.com]

> 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?

I included the entire session from start to finish, but probably the only
important part is the last 4 entries.  There is a single Python Script
'sendOrder' that does the following, in this order, when a user selects the
final "send order" link.

  1) get the next order number from MySQL.
  2) encrypt the order based on session (cart) information.
  3) e-mail the encrypted order.
  4) store the encrypted order in the record created by #1 above.
  5) "invalidate" (end) the session.
  6) redirect to a "thank you" page.

The log shows that at least through #5 happened, apparently without any
problems.  The last two log entries (and their corresponding empty records
in the MySQL database) seem to indicate that 'sendOrder' ran again, which
initiated a new session since the previous had been invalidated.  I'm not
sure what all this means, but it looks bizarre.

> 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.

Interesting you should say that.  Has PostgreSQL done something in the last
6 months or so to increase its speed?  Every time I give it a try, my simple
queries used for browsing and searching products prove many times slower
than MySQL.  It might mean 4 seconds instead of 1, but 4 seconds in Web time
is a lot.  100% of my queries (except this order storage) are read only.

Maybe I'll try setting up a transaction capable table just for this portion.
However, I can't see why the transaction would have been rolled back since
it appears to have made it to the end on the first try.

_______________________

Ron Bickers
Logic Etc, Inc.