Patent attributes
Systems and methods are disclosed to implement an automatic recovery technique for a detected corruption of stored data in a database system. In embodiments, the database system implements a physical replication process that replicates the contents of a primary volume to a mirror volume, with a specified mirror lag. The database system also stores a log of updates that it has received. The database system is configured to detect an error caused by a recent write operation received during the mirror lag. Upon detection, physical replication to the mirror volume is stopped, and a logical replication is performed where write operations logged during the mirror lag are replayed on the mirror volume. The mirror volume is then promoted to replace the primary volume in the database system. Advantageously, the disclosed recovery technique can be performed very quickly, and with zero loss of client requests received before initiation of the recovery.