1987WEB视界-分享互联网热点话题和事件

您现在的位置是:首页 > WEB开发 > 正文

WEB开发

mysql InnoDB的崩溃恢复过程

1987web2024-03-25WEB开发29

364

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:wealwaysdoarecoveryatstartup,butonlyifthereissomethingwrongwewillprintamessagetotheuseraboutrecovery:*/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()<<"Cantinitiatedatabase""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

声明:本站所有文章,如无特殊说明或标注,均为爬虫抓取以及网友投稿,版权归原作者所有。