Lopez David E-r9374c writes:
> Monty
>
> BTW, it's a thrill to hear from the CTO.
>
> The procedure for locking a table is more complex but will
> attempt to describe it further for you. Any of the 150 daemons
> can insert to the hash tables. The data in the row can be used
> by all 150 daemons. The primary key in hash table is the
> "id" field which is an auto-increment type. This "id" field
> is the hash value inserted in the main table as foreign key.
>
> When a daemon starts up, it reads the hash table with each
> entry a key-value pair. The value is the "id" field. During
> the course of logging info to the main table, it may find
> an entry that is not in it's local hash in RAM. When this
> occurs, it does a sql select on the hash. If a row is returned,
> it will insert the key-value pair into the it's hash and
> insert an entry into the main table.
>
> If no row is returned, then the following happens:
> 1) lock table ...
> 2) select ...
> 3) if no row is returned,
> 4) insert ...
> 5) use LAST_INSERT_ID() to get the value of the key
> 6) else get the key-value pair
> 7) unlock table
> 8) put key-value pair in RAM hash
> 9) insert row in main table (using new key-value pair)
>
> Since >99% of the time, the data hash table information is
> already stored in the daemon hash table on initial start up.
> We wanted to lock the table so two different daemons would
> not enter the same information in the hash tables. Extremely
> unlikely, but the boss is paranoid. Or is it more experienced.
>
> Hope that clears the insertion process on the hash tables. I'm
> glad that if a connection is lost in steps 2-6, mysql would
> automatically unlock the tables. That will satisfy the db
> specification nicely. The architecture for our db came
> from the optimization chapter in the manual. Thanks!
>
> David
>
Hi!
Still , locking a table is not necessary as MySQL server remembers
LAST_INSERT_ID() value, for each connection (thread) separately.
Simply, this value is not (only) remembered on per-table basis, but
also for each thread (connection) separately.
--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php