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.
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 callstats()
, which isn't really correct.check()
andstats()
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), butstats()
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.