您现在的位置是:课程教程文章
mysql InnoDB的崩溃恢复过程
2023-12-13 23:10课程教程文章 人已围观
1、redo log操作:保证已提交事务影响的最新数据刷到数据页里。
2、undo log操作:保证未提交事务影响的数据页回滚。
3、写缓冲(change buffer)合并。
4、purge操作。
InnoDB的一种垃圾收集机制,使用单独的后台线程周期性处理索引中标记删除的数据。
实例
/*LookforMLOG_CHECKPOINT.*/ recv_group_scan_log_recs(group,&contiguous_lsn,false); /*Thefirstscanshouldnothavestoredorappliedanyrecords.*/ ut_ad(recv_sys->n_addrs==0); ut_ad(!recv_sys->found_corrupt_fs); if(recv_sys->found_corrupt_log&&!srv_force_recovery){ log_mutex_exit(); return(DB_ERROR); } if(recv_sys->mlog_checkpoint_lsn==0){ if(!srv_read_only_mode &&group->scanned_lsn!=checkpoint_lsn){ ib::error()<<"Ignoringtheredologduetomissing" "MLOG_CHECKPOINTbetweenthecheckpoint" <<checkpoint_lsn<<"andtheend" <<group->scanned_lsn<<"."; if(srv_force_recovery<SRV_FORCE_NO_LOG_REDO){ log_mutex_exit(); return(DB_ERROR); } } group->scanned_lsn=checkpoint_lsn; rescan=false; }else{ contiguous_lsn=checkpoint_lsn; rescan=recv_group_scan_log_recs( group,&contiguous_lsn,false); if((recv_sys->found_corrupt_log&&!srv_force_recovery) ||recv_sys->found_corrupt_fs){ log_mutex_exit(); return(DB_ERROR); } } /*NOTE:wealwaysdoa'recovery'atstartup,butonlyif thereissomethingwrongwewillprintamessagetothe useraboutrecovery:*/ if(checkpoint_lsn!=flush_lsn){ if(checkpoint_lsn+SIZE_OF_MLOG_CHECKPOINT<flush_lsn){ ib::warn()<<"Areyousureyouareusingthe" "rightib_logfilestostartupthedatabase?" "Logsequencenumberintheib_logfilesis" <<checkpoint_lsn<<",lessthanthe" "logsequencenumberinthefirstsystem" "tablespacefileheader,"<<flush_lsn<<"."; } if(!recv_needed_recovery){ ib::info()<<"Thelogsequencenumber"<<flush_lsn <<"inthesystemtablespacedoesnotmatch" "thelogsequencenumber"<<checkpoint_lsn <<"intheib_logfiles!"; if(srv_read_only_mode){ ib::error()<<"Can'tinitiatedatabase" "recovery,runninginread-only-mode."; log_mutex_exit(); return(DB_READ_ONLY); } recv_init_crash_recovery(); } } log_sys->lsn=recv_sys->recovered_lsn; if(recv_needed_recovery){ err=recv_init_crash_recovery_spaces(); if(err!=DB_SUCCESS){ log_mutex_exit(); return(err); } if(rescan){ contiguous_lsn=checkpoint_lsn; recv_group_scan_log_recs(group,&contiguous_lsn,true); if((recv_sys->found_corrupt_log &&!srv_force_recovery) ||recv_sys->found_corrupt_fs){ log_mutex_exit(); return(DB_ERROR); } } }else{ ut_ad(!rescan||recv_sys->n_addrs==0); }
以上就是mysql InnoDB的崩溃恢复过程,希望对大家有所帮助。更多mysql学习指路:MySQL
推荐操作系统:windows7系统、mysql5.8、DELL G3电脑
课程教程:mysql InnoDB的崩溃恢复过程上一篇:css超链接是什么
下一篇:没有了