fix: recovery when cross timeline and has shutdown wal

This commit is contained in:
wangyao 2023-06-07 02:38:13 +00:00 committed by Gitee
commit 5021eb0509
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,7 @@ static void getWalFunc(gpointer data, gpointer user_data) {
//elem->status = STARTSTATUS;
int r;
//clock_t start = clock();
r = batchRead((uint8_t *) elem->data, ThisTimeLineID, elem->startLsn, elem->endLsn, walStoreToLocal);
r = batchRead((uint8_t *) elem->data, ThisTimeLineID2>ThisTimeLineID?ThisTimeLineID2:ThisTimeLineID, elem->startLsn, elem->endLsn, walStoreToLocal);
//clock_t end = clock();
//printf("====LSN %X/%X==pid %d==len %d===time %u\n",LSN_FORMAT_ARGS(elem->startLsn),pthread_self(),r,end-start);
elem->dataLen = r;

View File

@ -224,6 +224,7 @@ CheckpointStatsData CheckpointStats;
* WAL timeline for the database system.
*/
TimeLineID ThisTimeLineID = 0;
TimeLineID ThisTimeLineID2 = 0;
/*
* Are we doing recovery from XLOG?
@ -15072,7 +15073,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
tli, curFileTLI);
}
curFileTLI = tli;
ThisTimeLineID = tli;
ThisTimeLineID2 = tli;
RequestXLogStreaming(tli, ptr, PrimaryConnInfo,
PrimarySlotName,
wal_receiver_create_temp_slot);

View File

@ -31,6 +31,7 @@
extern int sync_method;
extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */
extern PGDLLIMPORT TimeLineID ThisTimeLineID2;
extern bool startup_shutdown_requested;
/*