Applying the dining philosophers problem to innodb, and the use of select for update:
1) a table with 100,000 forks, represented by an innodb table with its single primary key (the fork)
2) the grab of forks is a select for update that specifies some random list of between 2 and 20 primary keys in this table, and the "grab" is exactly one select for update on this random fork list relative to the 100,000 different primary keys. By the way, the order of the lists of keys in the select statement is random.
3) there are many more than 5 thinkers, say up to 50 "simultaneous" transactions grabbing intersecting forks
4) the think time is updating other columns for the rows of the primary keys in step 2. The think time is never too long.
Question: with innodb, is deadlock or starvation due to unfairness possible at all in the above scenario? Are there any things to watch out for? (isolation level read committed.)
Purpose: use this table and the primary keys of the locking rows to represent dependencies for complex update scenarios, so that before doing a sequence of updates to various related tables (tables in consistent order) and rows within, I determine the set of dependencies that equate to the set of primary keys of step 1, and then lock those dependencies with select for update at the outset of the transaction. (Of course, after the select for update, I requery the dependencies to make sure they did not change.)