Yelp / doloop

Task loop for keeping things updated
Other
10 stars 10 forks source link

check() and stats() shouldn't lock tables #22

Closed coyotemarin closed 12 years ago

coyotemarin commented 12 years ago

After having talked to our DBA, it seems like it's not great to grant read-only accounts the LOCK TABLES permission. At Yelp, we're currently working around this by using a read-write account to call stats(), which isn't really correct.

check() and stats() should instead implicitly get a read lock on the table by using a transaction.

Transactions aren't so important for check() (which runs a single query), but stats() fires off several queries, so we want to make sure to wrap it in a transaction, and implicitly turn off autocommit so that the table can't change between queries.