US 12,242,505 B1
Recovering from interruptions in database replication streams
Ramesh Shankar, Redmond, WA (US); Raman Mittal, Kirkland, WA (US); Minsoo Oh, Seattle, WA (US); and Andrew Willis Callahan, Seattle, WA (US)
Assigned to Amazon Technologies, Inc., Seattle, WA (US)
Filed by Amazon Technologies, Inc., Seattle, WA (US)
Filed on Mar. 31, 2023, as Appl. No. 18/194,568.
Int. Cl. G06F 16/27 (2019.01)
CPC G06F 16/27 (2019.01) 20 Claims
OG exemplary drawing
 
1. A system, comprising:
at least one processor; and
a memory, storing program instructions that when executed by the at least one processor, cause the at least one processor to implement a secondary instance of a distributed database system, wherein the secondary instance of the distributed database system provides read-only access to a database, and wherein the secondary instance is configured to:
detect one or more missing log records in an ordered replication stream of log records that describe updates to the database and are generated by a primary instance of the distributed database system that provides read-write access to the database;
for a log record received in the ordered replication stream of log records that occurs after the one or more missing log records:
identify a portion of an in-memory data structured updated by the log record and maintained in a memory at the secondary instance;
compare a sequence number recorded for the portion of the in-memory data structure that corresponds to a last update of the portion of the in-memory data structure as received at the secondary instance with a corresponding sequence number in the log record that identifies the last update corresponding to the portion of the in-memory data structure caused by the primary instance;
determine that the comparison of the sequence number recorded for the portion of the in-memory data structure and the sequence number in the log record indicate that the portion of the in-memory data structure is invalid; and
make the portion of the in-memory data structure in the memory unavailable for performing requests to the database.