溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

PostgreSQL啟動(dòng)恢復(fù)期間,恢復(fù)到的時(shí)間線的確定

發(fā)布時(shí)間:2020-07-18 11:56:03 來源:網(wǎng)絡(luò) 閱讀:1269 作者:yzs的專欄 欄目:數(shù)據(jù)庫

1、啟動(dòng)恢復(fù)時(shí),確定恢復(fù)到的時(shí)間線recoveryTargetTLI

1)歸檔恢復(fù)點(diǎn)比checkpoint中記錄的時(shí)間線大,那么選擇歸檔恢復(fù)點(diǎn)作為目標(biāo)時(shí)間線

2)否則,checkpoint記錄中的時(shí)間線作為目標(biāo)時(shí)間線

StartupXLOG->
	if (ControlFile->minRecoveryPointTLI >
		ControlFile->checkPointCopy.ThisTimeLineID)
		recoveryTargetTLI = ControlFile->minRecoveryPointTLI;
	else
		recoveryTargetTLI = ControlFile->checkPointCopy.ThisTimeLineID;
	...

2、接著從recovery.conf文件中讀取

1)若設(shè)置了recovery_target_timeline值,并且設(shè)為latest,那么history列表最大的時(shí)間線即為目標(biāo)時(shí)間線

2)否則是recovery.conf文件中設(shè)置的時(shí)間線值

3)若沒有設(shè)置recovery_target_timeline值,則目標(biāo)時(shí)間線為第一步中的值

StartupXLOG->readRecoveryCommandFile()->
	for (item = head; item; item = item->next){
		if (strcmp(item->name, "restore_command") == 0){
			...
		}else if ...
		else if(strcmp(item->name, "recovery_target_timeline") == 0){
			rtliGiven = true;
			if (strcmp(item->value, "latest") == 0)
				rtli = 0;
			else
				rtli = (TimeLineID) strtoul(item->value, NULL, 0);
		}else if...
	}
	if (rtliGiven){
		if (rtli){
			recoveryTargetTLI = rtli;
			recoveryTargetIsLatest = false;
		}else{
			/* We start the "latest" search from pg_control's timeline */
			recoveryTargetTLI = findNewestTimeLine(recoveryTargetTLI);
			recoveryTargetIsLatest = true;
		}
	}


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI