Database Log Replay Concurrency via Page Segmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional log replay methods in database systems are slow, leading to prolonged downtime when a primary server fails, as they require sequential replay of transaction logs and synchronization between threads, which limits the speed at which secondary servers can take over and provide data services.

Innovation Solution

The method involves using multiple threads to replay transaction commit logs and page operation logs independently, where all page operation logs for a page are replayed by a single thread, allowing for concurrent processing and reducing the need for synchronization, and reading logs from a buffer instead of data memory to enhance speed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If multiple threads are used to replay logs concurrently, then log replay speed is improved, but thread synchronization complexity increases

Engineering Contradiction:
Improvelog replay speedVSAvoidthread synchronization complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent divides log replay into two independent segments: transaction commit log replay (single thread) and page operation log replay (multiple threads). This segmentation allows the page operation logs to be replayed in parallel without requiring synchronization with the transaction commit log replay process, thus improving log replay speed while avoiding thread synchronization complexity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary mechanism where page operation logs are processed independently through multiple threads without needing to synchronize with the main transaction commit log replay thread. This intermediary approach allows concurrent processing while maintaining data consistency, resolving the contradiction between speed and synchronization complexity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Device complexity

If all page operation logs for a page are replayed by a single thread, then synchronization requirements are reduced, but thread utilization efficiency may decrease

Engineering Contradiction:
Improvesynchronization requirementsVSAvoidthread utilization efficiency
Core Design Contradiction:
Device complexityVSProductivity

Solution Approach 1:

The patent segments page operation logs by page, assigning all logs for a specific page to a single thread. This segmentation reduces synchronization requirements while maintaining parallelism across different pages, effectively balancing thread utilization efficiency and synchronization complexity.

Inventive Principle:
Principle #1Segmentation

3Productivity

If logs are read from data memory, then data accuracy is ensured, but input/output operations increase reducing speed

Engineering Contradiction:
Improvelog reading speedVSAvoiddata accuracy
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent performs preliminary action by pre-reading and buffering log data before the replay process. Logs are read from data memory in advance and stored in a buffer, reducing I/O operations during replay while ensuring data accuracy is maintained through the use of committed and durable log data.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12093241B2Method for replaying log on data node, data node, and system
Publication Date: 2024.09.17 HUAWEI TECH CO LTD
  • US12093241B2 patent drawing
  • US12093241B2 patent drawing
  • US12093241B2 patent drawing

AI summary

A method for replaying a log on a data node, a data node, and a database system are described. The method is used to improve a log replay speed, and includes: the data node obtaining a plurality of logs, wherein the plurality of logs includes at least one transaction commit log and at least one page operation log; and a first thread of a plurality of threads replaying the at least one page operation log, and a same second thread replaying all page operation logs including an operation on a same page. As such, log replay progress does not need to be synchronized between threads. A process in which the first thread replays the transaction commit log is independent of a process in which at least one second thread replays the at least one page operation log.