# US 2020/0401488 A1 · Asynchronous Garbage Collection In Database Redo Log Replay

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2020/0401488 A1
- Document ID: US20200401488A1
- Status: Published application
- Kind: A1
- Application number: 17/008,380
- Filed: 2020-08-31
- Published: 2020-12-24
- Earliest claimed: 2017-02-17
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Thorsten Glebe; Werner Thesing; Christoph Roterring
- Web page: https://patentgrep.com/patent/US20200401488A1

## CPC

- G06F 11/1469: {Backup restoration techniques}
- G06F 11/1471: involving logging of persistent data for recovery
- G06F 11/2038: {with a single idle spare processing component}
- G06F 11/2094: {Redundant storage or storage space (G06F11/2056 takes precedence)}
- G06F 11/2097: {maintaining the standby controller/processing unit updated (initialisation or re-synchronisation thereof G06F11/1658 and subgroups)}
- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F 2212/1041: Resource optimization
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/702: Conservative garbage collection
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Recovery of a database system by taking the database system offline is initiated. Thereafter, recovery operations specified by a redo log of the database system are replayed. A cleanup log is generated that identifies cleanup operations occurring during the replay of the recovery operations for garbage collection. Concurrent with the startup of the database, garbage collection of the cleanup operations as specified in the database savepoint is initiated. In addition, concurrent with the replay of the recovery operations, garbage collection of the cleanup operations specified by the cleanup log is initiated. The database system is later brought online after all of the recovery operations are replayed.

## Claims

### Claim 1

A system comprising:
at least one data processor; and
memory storing instructions which, when executed by the at least one data processor, result in operations comprising:
initiating recovery of a database system by taking the database system offline;
replaying recovery operations specified by a redo log of the database system;
generating a cleanup log identifying cleanup operations occurring during the replay of the recovery operations for garbage collection;
initiating, concurrent with the startup of the database, garbage collection of the cleanup operations as specified in a last database savepoint;
initiating, concurrent with the replay of the recovery operations and the garbage collection specified by the database savepoint, garbage collection of the cleanup operations specified by the cleanup log; and
bringing the database system online after all of the recovery operations are replayed.

### Claim 2 (depends on 1)

The system of claim 1, wherein the cleanup log is passed to a history manager after it is generated and the history manager subsequently initiates the garbage collection of the cleanup operations specified by the cleanup log.

### Claim 3 (depends on 1)

The system of claim 1, wherein the garbage collection of the cleanup operations continues subsequent to the database system being brought online.

### Claim 4 (depends on 1)

The system of claim 1, wherein the replay operations are executed by recovery threads and the cleanup operations are executed by garbage collection threads.

### Claim 5 (depends on 4)

The system of claim 4, wherein the database comprises a plurality of programmable processor cores and the threads are striped such that each core executes a maximum of one recovery thread and one garbage collection thread.

### Claim 6 (depends on 5)

The system of claim 5, wherein at least one core prioritizes execution of the corresponding recovery thread over the corresponding garbage collection thread.

### Claim 7 (depends on 1)

The system of claim 1 further comprising: the database system, and wherein the database system comprises an in-memory database storing data in main memory.

### Claim 8

A system comprising:
at least one data processor; and
memory storing instructions which, when executed by the at least one data processor, result in operations comprising:
initiating replication of a primary database system by having an associated secondary database system mirroring data stored in the primary database system and sending a most recent savepoint of the primary database system to the secondary database system;
replaying, by the secondary database system, recovery operations specified by a redo log of the primary database system and sent to the secondary database system;
initiating, concurrent to subsequent recovery operations, garbage collection of cleanup operations which are part of the savepoint sent from the primary database system;
generating, by the secondary database system, a cleanup log identifying cleanup operations occurring during the replay of the recovery operations for garbage collection;
initiating, by the secondary database system concurrent with the replay of the recovery operations and the garbage collection specified by the database savepoint, garbage collection of the cleanup operations; and
redirecting readonly transactions for execution by the primary database system to the secondary database system which are able to block the asynchronous garbage collection in the secondary database system to get a stable view of data replicated on the secondary database system as required by certain transaction isolation levels.

### Claim 9 (depends on 8)

The system of claim 8, wherein the cleanup log is passed to a history manager after it is generated and the history manager subsequently initiates the garbage collection of the cleanup operations specified by the cleanup log.

### Claim 10 (depends on 8)

The system of claim 8, wherein the operations further comprise:
determining whether garbage collection can be initiated based on a snapshot timestamp of an oldest reader of the primary database system relative to a commit timestamp of a transaction that generated the cleanup log.

### Claim 11 (depends on 10)

The system of claim 10, wherein the garbage collection is initiated if the commit timestamp of the cleanup log is older than the snapshot timestamp of the oldest reader.

### Claim 12 (depends on 10)

The system of claim 10, wherein the operations further comprise:
delaying initiation of the garbage collection of the cleanup operations if the commit timestamp of the cleanup log is more recent than the snapshot timestamp of the oldest reader.

### Claim 13 (depends on 8)

The system of claim 8, wherein the garbage collection of the cleanup operations continues subsequent to the primary database system being brought online.

### Claim 14 (depends on 8)

The system of claim 8, wherein the garbage collection of the cleanup operations continues subsequent to the secondary database system executing the redirected transactions.

### Claim 15 (depends on 8)

The system of claim 8, wherein the replay operations are executed by recovery threads and the cleanup operations are executed by garbage collection threads.

### Claim 16 (depends on 15)

The system of claim 15, wherein at least one of the primary database system or the secondary database system comprises a plurality of programmable processor cores and the threads are striped such that each core executes a maximum of one recovery thread and one garbage collection thread.

### Claim 17 (depends on 16)

The system of claim 16, wherein at least one core prioritizes execution of the corresponding recovery thread over the corresponding garbage collection thread.

### Claim 18 (depends on 8)

The system of claim 8, wherein at least one of the primary database system or the secondary database system comprises an in-memory database storing data in main memory.

### Claim 19

A system comprising:
means for initiating recovery of a database system by taking the database system offline;
means for replaying recovery operations specified by a redo log of the database system;
means for generating a cleanup log identifying cleanup operations occurring during the replay of the recovery operations for garbage collection;
means for initiating, concurrent with the startup of the database, garbage collection of the cleanup operations as specified in a last database savepoint;
means for initiating, concurrent with the replay of the recovery operations and the garbage collection specified by the database savepoint, garbage collection of the cleanup operations specified by the cleanup log; and
means for bringing the database system online after all of the recovery operations are replayed.

### Claim 20 (depends on 19)

The system of claim 19, wherein the cleanup operations as specified in a last database savepoint are processed sequentially and the cleanup operations specified by the cleanup log are processed in parallel
