We have an always on with 2 servers, lets call them Node1 and Node2. We run differential backups everyday except Mondays and run full backup every Monday using Ola Hallengren jobs. And log backups every hour. Backup preferences for always on is set to "primary" and backups are not copy only.
I read a lot about LSN of logs but didn't find anything related to full backups.
Say for 1 year everything went fine and all backups are on Node1. Then all of a sudden there is a failover on a day that is not Monday (diff backup). Will Node2 differential backup be from the last known Node1 full backup or will it be something else (since the beginning of the year for example)?.
Is there a query I can see the latest LSN on the secondary replica and confirm it is as the one in the primary replica?
Thank you
A little exposition will help you answer not only this question, but related ones as well.
SQL Server determines what needs to go into a differential backup by keeping track of what pages have changed in a special page called a differential change map. This link has a pretty good explanation of what's going on there. But the idea is that when a full backup happens, that data structure gets zeroed out. Note - one (maybe the only?) difference between copy_only and non-copy_only full backups is that the copy_only backup doesn't clear the change map. As/when data changes after a full backup, the differential change map is also apprised of this change. Then, when a differential backup is initiated, it can go to that page to see what data needs to be included in the backup.
Since the change map is a data page (just like your user tables are), it's part of the database in the availability group. Failovers should have no effect on your ability to perform a differential backup. So long as the new replica is up to date, a differential backup should work just fine.
Another related question that you can now answer with this knowledge is: "if I restore a full backup onto another server (say a test server), will I be able to take a differential backup afterwards? if so, what will it contain?"