Database Journal Synchronization Thread for Data Loss Prevention
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Electronic devices using specific journaling methods and synchronization modes, such as Android systems in write ahead logging (WAL) mode, often fail to synchronize journal data with nonvolatile memory, leading to data loss during abrupt power-offs or restarts due to the inability to recover journal data from volatile memory.
Innovation Solution
An electronic device with a processor that detects transactions, identifies database and file system characteristics, and creates a thread to synchronize metadata and journal data with nonvolatile memory based on conditions related to data change or time, preventing data loss by ensuring synchronization occurs when necessary.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If periodic synchronization is not performed for journal data in WAL mode and normal synchronization mode, then device performance is improved, but data reliability deteriorates due to potential data loss during abrupt power-off
Solution Approach 1:
The system performs preliminary actions by creating a synchronization thread when specific conditions are met (journal mode is WAL and synchronization mode is normal). This thread proactively synchronizes journal data to non-volatile memory before potential data loss can occur, rather than waiting for periodic synchronization intervals. The condition checking and thread creation happen in advance to prevent the harmful effect of data loss while maintaining performance during normal operation.
2Reliability
If synchronization thread is created for all transactions, then data integrity is improved, but device complexity increases due to additional thread management overhead
Solution Approach 1:
The system applies local quality by creating synchronization threads selectively based on local conditions specific to each transaction context. The processor checks whether the journal mode is WAL and whether the synchronization mode is normal before creating a thread. This localized approach ensures that threads are created only where and when needed, rather than universally for all transactions, thereby maintaining data integrity for critical cases while avoiding unnecessary complexity in other scenarios.
Solution Approach 2:
The system changes parameters dynamically by evaluating the journal mode and synchronization mode parameters at runtime. Based on the combination of these parameters, the system decides whether to create a synchronization thread. This parameter-based decision-making allows the system to adapt its behavior to different operational contexts, creating threads only when the specific parameter combination (WAL mode + normal synchronization mode) indicates a risk of data loss.
3Speed
If journal data is stored only in volatile memory for performance, then writing speed is improved, but data loss risk increases during abrupt power-off or restart
Solution Approach 1:
The synchronization thread acts as an intermediary mechanism between the volatile memory journal data and the non-volatile memory database. When the thread is created under specific conditions, it mediates the transfer of journal data from volatile to non-volatile memory, ensuring that critical data is preserved even if power is lost. This intermediary approach allows the system to maintain the speed benefits of volatile memory while periodically ensuring data safety through the thread-mediated synchronization process.
Data Source
AI summary
An electronic device and a method for operating the electronic device are provided. The electronic device includes a first memory, a second memory configured to store therein journal data including an operation result of a transaction for data in the database and metadata, and at least processor configured to detect an occurrence of the transaction, identify characteristics of a database system to which the data corresponding to the transaction belongs and characteristics of a file system, determine whether to create a thread for synchronizing the metadata stored in the second memory with the first memory based on the characteristics of the file system and the characteristics of the database system, and synchronize the metadata with the first memory using the created thread corresponding to identifying that the transaction of the data satisfies a condition related to a degree of change of time of the data.


