Pooga/Idjit on identical wavelengths

Started by dr

dr

Pooga wrote:
Hey what gives? My message gets posted twice and Idjit gets the author credit on one of them??

Well, I discovered the problem… as per normal, mopstly by accident. And let me just say, wow. Here's the scoop. Every message is assigned a unique id, which is based on a value pulled from the database. The system pulls the last unique value from the DB, adds one to it and then writes the new value back to the database. So, what happened was that Pooga and Idjit both clicked the "Save Message" button at the exact same time and thus both fetched the exact same value as their messages unique id.

So, we found a very obscure bug, per se, and well, now I have to fix it. If you people would just stop using the site, then you wouldn't keep finding bugs. :)
-dr

Footnotes: (for the database gurus or people interested) 1. You may be wondering why I don't use a sequence or something similar. In order to maintain database independence, I have avoided the use of sequences, triggers, and stored procedures. 2. I can tell the database to lock the unique id table, so that only one "person" can access the table at any time but that makes it slower, and isn't really worth the extra hassle for the database especially since the chance of two people clicking at the exact same time is very remote... at least that's what I thought. :)

Pooga

Actually, that is interesting.

I mean, how far apart could these clicks have occurred? A half second, a micro-second, or do you really mean at EXACTLY the same time? Still, what are the odds?

If you people would just stop using the site, then you wouldn't keep finding bugs.

But then you wouldn't keep learning things that you could apply to your business. See? We're providing you with an education, and paying you to learn! Gee… kinda sounds like the militia!

This topic has been locked by a moderator.