ha_innobase::external_lock(...)
{...
if (lock_type != F_UNLCK) {
/* MySQL is setting a new table lock */
...
if (trx->isolation_level == TRX_ISO_SERIALIZABLE //序列化隔离级别
&& m_prebuilt->select_lock_type == LOCK_NONE
&& thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { //且在一个显式事务块内部
/* To get serializable execution, we let InnoDB conceptually add 'LOCK IN SHARE MODE' to all SELECTs
which otherwise would have been consistent reads. An exception is consistent reads in the AUTOCOMMIT=1 mode:
we know that they are read-only transactions, and they can be serialized also if performed as consistent reads. */
m_prebuilt->select_lock_type = LOCK_S; //加读锁,即 'LOCK IN SHARE MODE'
m_prebuilt->stored_select_lock_type = LOCK_S;
} //否则,不加锁(这一点也很重要)
...
} else {
TrxInInnoDB::end_stmt(trx);
DEBUG_SYNC_C("ha_innobase_end_statement");
}
...}
ha_innobase::store_lock(
...
/* Check for FLUSH TABLES ... WITH READ LOCK */
if (trx->isolation_level == TRX_ISO_SERIALIZABLE) {
m_prebuilt->select_lock_type = LOCK_S;
m_prebuilt->stored_select_lock_type = LOCK_S;
} else {
m_prebuilt->select_lock_type = LOCK_NONE;
m_prebuilt->stored_select_lock_type = LOCK_NONE;
}
...
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有