is there possibility btree_redo with XLOG_BTREE_DELETE info done between standby_redo and the end of backup? I have PostgreSQL 9.3.14 which have some patches to use and easy to happen. //checkpoint [26005-59251d35.6595-712522] 2017-05-24 05:42:22.343 GMT < > DEBUG: 00000: recovery snapshots are now enabled [26005-59251d35.6595-712523] 2017-05-24 05:42:22.343 GMT < > CONTEXT: xlog redo running xacts: nextXid 3269723 latestCompletedXid 3269721 oldestRunningXid 3269722; 1 xacts: 3269722 void ProcArrayApplyRecoveryInfo(RunningTransactions running) { ...... standbyState = STANDBY_SNAPSHOT_READY; / //the standbyState is changed to STANDBY_SNAPSHOT_READY/ ...... } static void CheckRecoveryConsistency(void) { ...... ///but the reachedConsistency is not set true because below condition is not true./ if (!reachedConsistency && !ControlFile->backupEndRequired && minRecoveryPoint <= lastReplayedEndRecPtr && XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) { /* * Check to see if the XLOG sequence contained any unresolved * references to uninitialized pages. */ XLogCheckInvalidPages(); reachedConsistency = true; ereport(LOG, (errmsg("consistent recovery state reached at %X/%X", (uint32) (lastReplayedEndRecPtr >> 32), (uint32) lastReplayedEndRecPtr))); } ...... } //inconsistent detected in btree_xlog_delete_get_latestRemovedXid() [26005-59251d35.6595-726087] 2017-05-24 05:42:22.513 GMT < > WARNING: 01000: btree_xlog_delete_get_latestRemovedXid: cannot operate with inconsistent data [26005-59251d35.6595-726088] 2017-05-24 05:42:22.513 GMT < > CONTEXT: xlog redo delete: index 1663/16385/11693; iblk 110, heap 1663/16385/11691; static void btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record) { ...... / //InHotStandby is true/ if (InHotStandby) / //#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING)/ { TransactionId latestRemovedXid = btree_xlog_delete_get_latestRemovedXid(xlrec); ResolveRecoveryConflictWithSnapshot(latestRemovedXid, xlrec->node); } ...... } static TransactionId btree_xlog_delete_get_latestRemovedXid(xl_btree_delete *xlrec) { ...... ///PANIC happened *(I changed the PANIC to WARNING in the log to see further steps.)*/ if (!reachedConsistency) *elog(PANIC, "btree_xlog_delete_get_latestRemovedXid: cannot operate with inconsistent data");* ...... } //backup end [26005-59251d35.6595-801986] 2017-05-24 05:42:28.564 GMT < > DEBUG: 00000: end of backup reached [26005-59251d35.6595-801987] 2017-05-24 05:42:28.564 GMT < > CONTEXT: xlog redo backup end: 191/AB1F50E8 static void CheckRecoveryConsistency(void) { ...... ///This time the reachedConsistency is set true because below condition becomes to true./ if (!reachedConsistency && !ControlFile->backupEndRequired && minRecoveryPoint <= lastReplayedEndRecPtr && XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) { /* * Check to see if the XLOG sequence contained any unresolved * references to uninitialized pages. */ XLogCheckInvalidPages(); reachedConsistency = true; ereport(LOG, (errmsg("consistent recovery state reached at %X/%X", (uint32) (lastReplayedEndRecPtr >> 32), (uint32) lastReplayedEndRecPtr))); } ...... } I'm not sure if this scenario with original PostgreSQL code(9.3.14) would happen while standby server start up in recovery mode(meanwhile huge data updating in master server) in real world. I'm not sure if the problem is because original PostgreSQL code or because our patches. So need to give comments from PostgreSQL original code point of view to analyze the possibility. Thanks! -- View this message in context: http://www.postgresql-archive.org/Is-there-possibility-btree-redo-with-XLOG-BTREE-DELETE-done-between-standby-redo-and-the-end-of-backp-tp5963011.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general