Data processing method, electronic device, and vehicle

By creating temporary and backup databases when the database is correctly configured, the risk of data loss during database operations is mitigated, and the reliability and efficiency of data recovery and restoration are achieved.

CN119917488BActive Publication Date: 2026-03-24ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, directly performing data processing operations on an opened database is prone to data loss due to hardware failure, software errors, malicious attacks, or restoration to a historical state.

Method used

If the database configuration file is found to be configured correctly, a temporary database and a backup database are created. The original data is copied to the temporary database and the backup database. When necessary, the backup database is used for data recovery or restoration, avoiding direct operations on the persistent database.

Benefits of technology

It effectively avoids the risk of data loss due to hardware failure, software error or malicious attack, and ensures data integrity during data restoration, simplifies data management and improves the efficiency and reliability of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917488B_ABST
    Figure CN119917488B_ABST
Patent Text Reader

Abstract

The application provides a data processing method, an electronic device and a vehicle. The method comprises the following steps: in response to a database opening instruction, detecting whether a database configuration file of a first persistent database is correctly configured, wherein the first persistent database is a database for permanently storing data; in the case that it is detected that the database configuration file is correctly configured, creating a first temporary database and a first backup database, and copying first original data stored in the first persistent database to the first temporary database and the first backup database, wherein the first temporary database comprises the first original data and first operation data, the first operation data is data obtained after the first original data is processed, and the first backup database is used for restoring the first temporary database to a historical state. The application can solve the problem that data loss risk is prone to occur when a data processing operation is directly performed on an opened database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a data processing method, electronic device, and vehicle. Background Technology

[0002] In traditional computer software data storage technologies, most vendors primarily use mainstream commercial or open-source databases, such as MySQL, SQLite, Oracle, and DB2. Once a user opens a database, they can directly perform data processing operations on that database.

[0003] However, directly performing data processing operations on an opened database can easily lead to data loss if the database is subject to hardware failure, software errors, malicious attacks, or if it needs to be restored to a historical state. Summary of the Invention

[0004] In view of the above, embodiments of this application provide a data processing method, electronic device, and vehicle that can solve the problem that in related technologies, if data processing operations are performed directly on an opened database, and the database is subject to hardware failure, software error, malicious attack, or needs to be restored to a certain historical state, there is a risk of data loss.

[0005] This application provides a data processing method, the method comprising: responding to a database open command, detecting whether the database configuration file of a first persistent database is configured correctly, wherein the first persistent database is a database for permanently storing data; if the database configuration file is detected to be configured correctly, creating a first temporary database and a first backup database, copying first original data stored in the first persistent database to the first temporary database and the first backup database, wherein the first temporary database includes the first original data and first operation data, the first operation data being data obtained after processing the first original data, and the first backup database being used to restore the first temporary database to a historical state.

[0006] Compared with related technologies, the embodiments of this application have at least the following advantages:

[0007] If the database configuration file is found to be correctly configured, it indicates that a connection to the first persistent database can be established. The initial original data from the first persistent database is copied to the first temporary database and the first backup database. Data operations can then be performed directly on the first temporary database. If the first temporary database suffers from hardware failure, software errors, or malicious attacks, the first persistent database can be used to recover the data, avoiding the risk of losing the initial original data. Simultaneously, the first backup database can be used to restore the first temporary database to a historical state, avoiding the risk of losing the initial original data if a failure occurs during the data restoration process when directly processing data on the first persistent database.

[0008] In some possible implementations, in response to a data recovery command, the data in the first backup database is overwritten with the data in the first temporary database.

[0009] In some possible implementations, the data recovery instruction includes a database recovery instruction; the step of overwriting the data in the first temporary database with the data in the first backup database includes: creating a second temporary database; overwriting all the data in the second temporary database with all the data in the first backup database, and deleting the first temporary database; and using the second temporary database as the new first temporary database.

[0010] In some possible implementations, the data recovery instruction includes a data element recovery instruction; the step of overwriting the data in the first temporary database with the data in the first backup database includes: detecting whether a backup data element exists in the first backup database, wherein the backup data element matches the data element to be recovered in the first temporary database; if the backup data element is detected to exist in the first backup database, copying the backup data element to the first temporary database; and deleting the data element to be recovered from the first temporary database.

[0011] In some possible implementations, the method further includes: in response to a data persistence instruction, performing persistence processing on the first temporary database to obtain a second persistent database.

[0012] In some possible implementations, the data persistence instructions include database persistence instructions; the process of persisting the first temporary database to obtain a second persistent database includes: creating the second persistent database; copying all data from the first temporary database to the second persistent database; and deleting the first persistent database.

[0013] In some possible implementations, the data persistence instructions include data element persistence instructions; the process of persisting the first temporary database to obtain a second persistent database includes: detecting whether a persistent data element exists in the first temporary database, wherein the persistent data element matches the data element to be persisted in the first persistent database; if the persistent data element is detected to exist in the first temporary database, copying the persistent data element to the first persistent database; deleting the data element to be persisted in the first persistent database; and using the first persistent database after the deletion operation as the second persistent database.

[0014] In some possible implementations, the method further includes: in response to a database shutdown command, deleting the first temporary database and the first backup database, and shutting down the second persistent database.

[0015] In some possible implementations, after closing the second persistent database, the method further includes: responding again to a database open command to copy the second original data stored in the second persistent database to a third temporary database, wherein the third temporary database includes the second original data and second operation data, and the second operation data is data obtained after processing the second original data.

[0016] In some possible implementations, after copying the second original data stored in the second persistent database to the third temporary database, the method further includes: configuring the third temporary database according to the database configuration file in response to a data reset instruction.

[0017] In some possible implementations, the data reset instruction includes a database reset instruction; configuring the third temporary database according to the database configuration file includes: creating a fourth temporary database; configuring the fourth temporary database based on the database configuration file, and deleting the third temporary database; and using the fourth temporary database as the new third temporary database.

[0018] In some possible implementations, the data reset instruction includes a data element reset instruction; configuring the third temporary database according to the database configuration file includes: detecting whether a reset data element exists in the database configuration file, wherein the reset data element matches the data element to be reset in the third temporary database; if the reset data element is detected in the database configuration file, copying the reset data element to the third temporary database; and deleting the data element to be reset in the third temporary database.

[0019] A second aspect of this application discloses an electronic device, which includes a processor and a memory. The memory is used to store instructions, and the processor is used to invoke the instructions in the memory to cause the electronic device to perform the data processing method described above.

[0020] A third aspect of this application discloses a vehicle that includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the data processing method described above.

[0021] Understandably, the electronic device of the second aspect and the vehicle of the third aspect provided above correspond to the method of the first aspect. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here. Attached Figure Description

[0022] Figure 1 This is a schematic flowchart of a data processing method according to an embodiment of this application.

[0023] Figure 2 This is a schematic flowchart of a database recovery operation according to an embodiment of this application.

[0024] Figure 3 This is a schematic flowchart of a data element recovery operation according to an embodiment of this application.

[0025] Figure 4 This is a schematic flowchart of a database reset operation according to an embodiment of this application.

[0026] Figure 5 This is a schematic flowchart of a data element recovery operation according to an embodiment of this application.

[0027] Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0028] To better understand the above-mentioned objectives, features, and advantages of this application, the application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. Many specific details are set forth in the following description to provide a thorough understanding of this application; the described embodiments are only a part of the embodiments of this application, and not all of them.

[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.

[0030] It should be further noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0031] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural.

[0032] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0033] Please refer to Figure 1 This is a flowchart illustrating the data processing method provided in an embodiment of this application. The data processing method is applied to a data processing system, which can be deployed on a device terminal, such as a laptop or a server, etc., and this application does not limit this.

[0034] The data processing method includes the following steps:

[0035] Step 101: In response to the database open command, check whether the database configuration file of the first persistent database is configured correctly.

[0036] In some embodiments, the first persistent database is a database that permanently stores data. For example, the first original data stored in the first persistent database may be permanently stored in a persistent storage medium, which may include a hard disk.

[0037] In this embodiment, the database configuration file is a file used to store database connection information and other related configurations. The database system can correctly read and parse the information in the database configuration file. The database configuration file contains the parameters required to connect to the database, such as the database address, port number, username, password, etc. It may also contain other configuration options, such as the database character set, connection pool size, log level, etc.

[0038] In this embodiment, the database configuration file also includes initial data. After a database is configured based on the database configuration file, the data in that database is the initial data.

[0039] The database in this embodiment may include a MySQL database, an SQLite database, an Oracle database, and a DB2 database. In other embodiments, the database may also be other types of database management systems, and this application is not limited to these.

[0040] Checking whether the database configuration file of the first persistent database is configured correctly can determine whether the data processing system can correctly connect to the first persistent database.

[0041] Step 102: If the database configuration file is found to be configured correctly, create a first temporary database and a first backup database, and copy the first original data stored in the first persistent database to the first temporary database and the first backup database.

[0042] In some embodiments, the first temporary database includes first original data and first operation data, wherein the first operation data is data obtained after processing the first original data. For example, the first operation data may be data added by the user to the first temporary database based on the first original data. The first backup database is used to restore the first temporary database to a historical state. The specific steps for restoring the first temporary database to a historical state using the first backup database are described in detail later and will not be repeated here to avoid repetition.

[0043] In some embodiments, if the database configuration file is detected to be configured correctly, it indicates that the data processing system can connect to the first persistent database normally. The system checks whether an old first backup database and an old first temporary database exist. If the old first backup database and the old first temporary database do not exist, a new first backup database and a new first temporary database are created, and the data in the first persistent database is copied to the new first backup database and the new first temporary database.

[0044] If an old first backup database and an old first temporary database are detected, the old first backup database and the old first temporary database must be deleted first. Then, a new first backup database and a new first temporary database are created, and the data in the first persistent database is copied to the new first backup database and the new first temporary database.

[0045] First, the database configuration file is checked to avoid errors that could render the database unusable. If the configuration file is confirmed to be correct, the system is checked for legacy backup and temporary databases. If such old backups or temporary databases exist, they are deleted to prevent them from interfering with subsequent data operations. Finally, data is copied from the first persistent database to obtain the first backup and first temporary databases.

[0046] It should be noted that, assuming the database configuration file is configured correctly, the original data stored in the first persistent database is copied to the newly created first backup database and the new first temporary database. In subsequent data processing, if data operations such as adding, deleting, modifying, or querying are required, only the data in the first temporary database is manipulated, without affecting the first backup database. This ensures that if it is necessary to restore the data in the first temporary database to its original state when the database was opened, the data in the first backup database can be directly copied to the first temporary database. The specific steps are described in detail below and will not be repeated here.

[0047] In this embodiment, the first backup database can also be stored in a persistent storage medium, and the first temporary database can be stored in the memory of the device on which the data processing system is deployed.

[0048] Step 103: In response to the data recovery command, overwrite the data in the first temporary database with the data in the first backup database.

[0049] Specifically, data recovery instructions include database recovery instructions and data element recovery instructions. When the data recovery instruction is a database recovery instruction, in response to the instruction, all data in the first backup database is overwritten in the first temporary database (referred to as a database recovery operation). When the data recovery instruction is a data element recovery instruction, in response to the instruction, some data elements in the first backup database are overwritten in the first temporary database (referred to as a data element recovery operation).

[0050] In this embodiment, the specific processes of database recovery operations and data element recovery operations are described in detail below and will not be repeated here.

[0051] Step 104: In response to the data persistence command, persist the first temporary database to obtain the second persistent database.

[0052] In some embodiments, data persistence instructions include database persistence instructions and data element persistence instructions. Specifically, when the data persistence instruction is a database persistence instruction, all data in the first temporary database is persistently stored to obtain a second persistent database (referred to as a database persistence operation). When the data persistence instruction is a data element persistence instruction, a portion of the data elements in the first temporary database are persistently stored to obtain a second persistent database (referred to as a data element persistence operation).

[0053] The following are the specific steps for database persistence operations and data element persistence operations:

[0054] (1) The steps of database persistence operation include: creating a second persistent database, copying all data from the first temporary database to the second persistent database, and deleting the first persistent database.

[0055] (2) The steps of the data element persistence operation include: checking whether there is a persistent data element in the second temporary database. If a persistent data element is detected in the first temporary database, copy the persistent data element to the first persistent database. Delete the data element to be persisted in the first persistent database. Use the first persistent database after the deletion operation as the second persistent database.

[0056] In this embodiment, the persistent data element is matched with the data element to be persisted in the first temporary database. For example, the first temporary database includes data element 1, data element 2, and data element 3. If data element 1 needs to be persistently stored, it is checked whether there is a data element in the first temporary database that matches data element 1. In this case, the data element in the first temporary database that matches data element 1 is the persistent data element.

[0057] Step 105: In response to the database shutdown command, delete the first temporary database and the first backup database, and shut down the second persistent database.

[0058] In this embodiment, in response to a database shutdown command, based on persistence requirements, it is determined whether the data in the first temporary database needs to be persisted when the database is shut down. If it is necessary to persist the data in the first temporary database when shutting down the database, the data in the first temporary database is overwritten into the second persistent database for persistent storage. Then, the first temporary database and the first backup database are deleted, and the second persistent database is shut down. If it is not necessary to persist the data when shutting down the database, the first temporary database and the first backup database are simply deleted, and the second persistent database is shut down.

[0059] Step 106: Respond again to the database open command and copy the second original data stored in the second persistent database to the third temporary database.

[0060] In some embodiments, the third temporary database includes second raw data and second operational data, wherein the second operational data is data obtained after processing the second raw data.

[0061] Step 107: In response to the data reset command, configure the third temporary database according to the database configuration file.

[0062] Specifically, data reset instructions include database reset instructions and data element reset instructions. When the data reset instruction is a database reset instruction, in response to the database reset instruction, all data in the third temporary database is configured according to the database configuration file; that is, the data in the third temporary database is the initial data (this is called a database reset operation). When the data reset instruction is a data element reset instruction, in response to the data element reset instruction, some data in the third temporary database is configured according to the database configuration file; that is, some data in the third temporary database is the same as some data in the initial data (this is called a data element reset operation).

[0063] The process of database reset operation and data element reset operation will be described in detail below. To avoid repetition, it will not be repeated here.

[0064] In this embodiment, database recovery operations and data element recovery operations are collectively referred to as data recovery operations, database reset operations and data element reset operations are collectively referred to as data reset operations, and database persistence operations and data element persistence operations are collectively referred to as data persistence operations.

[0065] It should be noted that during data processing, users can choose one or more of the following operations, depending on their data processing needs: database recovery, data element recovery, database reset, data element reset, database persistence, and data element persistence. Furthermore, there is no restriction on the order in which users perform these operations.

[0066] To better understand the content of this embodiment, we will take the recovery, reset, and persistence of a database as an example for illustration:

[0067] During data processing, users need to operate the database within the data processing system. In response to a database open command, the system first checks if the database configuration file for the first persistent data is configured correctly. If the configuration file is correct, it creates a first temporary database and a first backup database, and copies the original data stored in the first persistent database to both the first temporary and first backup databases. At this point, the data in the first persistent database, the first temporary database, and the first backup database are identical.

[0068] A user operates on the first temporary database, performing CRUD (Create, Read, Update, Delete) operations on a portion of the data within it. For example, the user adds some data to the first temporary database. At this point, the data in the first temporary database is different from the data in the first persistent database and the first backup database (the data in the first persistent database and the first backup database are the same).

[0069] After a user performs CRUD operations on some data in the first temporary database, the user discovers that the data obtained after these operations is incorrect and a database recovery operation is required. This can be achieved by overwriting the first temporary database with all data from the first backup database (at this point, the data in the first persistent database, the first temporary database, and the first backup database are identical).

[0070] Then, after the user continues to perform CRUD operations on the first temporary data, the user needs to perform a database persistence operation to persist the first temporary database and obtain the second persistent database (at this time, the data in the second persistent database is different from the data in the first backup database, and the data in the second persistent database is the same as the data in the first temporary database).

[0071] Next, after the user performed CRUD operations on some data in the first temporary database, the user discovered that the data obtained after these operations was incorrect, requiring another database recovery operation. The first temporary database was overwritten with all data from the first backup database (at this point, the second persistent database is different from the first temporary database, while the data in the first temporary database is the same as in the first backup database).

[0072] When a user finishes processing data, the data processing system responds to a database shutdown command by closing the connection between the data processing system and each database. Simultaneously, it deletes the first temporary database and the first backup database to free up disk storage space for the data processing system.

[0073] The data processing system responds again to the database open command, copying the second original data stored in the second persistent database to the third temporary database and the second backup database.

[0074] After a user performs CRUD operations on a portion of the data in the third temporary database, the user discovers that the resulting data is incorrect and needs to restore all data in the third temporary database to be consistent with the data in the persistent database configured according to the database configuration file when the data processing system first responds to the database open command. At this point, in response to the database reset command, all data in the third temporary database is configured according to the database configuration file (at this time, the data in the third temporary database is different from the data in the second persistent database and the second backup database).

[0075] Compared with related technologies, the embodiments of this application have at least the following advantages:

[0076] Upon responding to a data open command, the system first checks if the database configuration file is configured correctly to ensure a proper connection and database usage. Then, it copies the initial data from the first persistent database to the first backup database and the first temporary database. This allows for CRUD operations, data recovery, and data reset on the first temporary database, avoiding the risk of data loss due to hardware failure, software errors, or malicious attacks if data processing is performed directly on the opened database (i.e., the first persistent database) as in related technologies. When data recovery is required on the first temporary database, the data from the first backup database is simply overwritten. When data reset is required, the first temporary database is configured according to the database configuration file. This ensures that data recovery and reset operations are supported during data processing. Furthermore, if data persistence is required, the data in the first temporary database is persistently stored so that the data from the first temporary database at the time of the data persistence command can be retrieved the next time the database is opened. In this way, if there is a need for data recovery, data reset, and data persistence during the data processing process, the data processing method can be called directly, avoiding the problems of long processing time and low efficiency that users would encounter when redesigning the corresponding operation process.

[0077] Please refer to Figure 2 This is a flowchart illustrating the steps of a database recovery operation provided in this embodiment. The specific details of the database recovery operation are as follows:

[0078] Step 201: Create a second temporary database.

[0079] As mentioned above, data recovery commands include database recovery commands and data element recovery commands. It is necessary to detect whether the data recovery command is a database recovery command or a data element recovery command. If the data recovery command is detected as a database recovery command, it indicates that a data recovery operation is required on the database, and a second temporary database is created.

[0080] Step 202: Overwrite all data in the second temporary database with all data from the first backup database, and delete the first temporary database.

[0081] Step 203: Use the second temporary database as the new first temporary database.

[0082] Compared with related technologies, this embodiment has at least the following advantages:

[0083] On the one hand, during data processing, when performing various data processing operations on the first temporary database, it can be restored to consistency with the first backup database at any time according to the current business scenario and logical needs. This discards data from any modifications or changes made to the first temporary database after responding to the database open command. On the other hand, by first creating a second temporary database, copying the data from the first backup database to the second temporary database, and then deleting the first temporary database and using the second temporary database as the new first temporary database, data inconsistencies caused by abnormal situations during the data copying process can be avoided, ensuring data integrity. Simultaneously, this simplifies data management, avoids data conflicts, and improves data import efficiency.

[0084] Please refer to Figure 3 This is a flowchart illustrating the steps of a data element recovery operation provided in an embodiment of this application. The specific details of the data element recovery operation are as follows:

[0085] Step 301: Check if backup data elements exist in the first backup database.

[0086] In this embodiment, the system detects whether the data recovery instruction is a database recovery instruction or a data element recovery instruction. If the data recovery instruction is detected to be a data element recovery instruction, it indicates that a data recovery operation needs to be performed on a portion of the database's data elements.

[0087] In some embodiments, the backup data element is matched with the data element to be recovered in the first temporary database. For example, the first temporary database includes data element 1, data element 2, and data element 3. If a data recovery operation is required for data element 1, it is checked whether there is a data element in the first backup database that matches data element 1. In this case, the data element in the first backup database that matches data element 1 is the backup data element.

[0088] In this embodiment, if the first backup database does not exist, or if the backup data elements in the first backup database do not exist, there is no need to perform a data element recovery operation.

[0089] Step 302: If a backup data element is detected in the first backup database, copy the backup data element to the first temporary database.

[0090] In this embodiment, if a backup data element is detected in the first backup database, the data element to be restored in the first temporary database is renamed. For example, the renamed data element to be restored in the first temporary database is denoted as tmp. The backup data element is then copied to the first temporary database as a new data element.

[0091] Step 303: Delete the data elements to be recovered in the first temporary database.

[0092] In this embodiment, tmp is deleted from the first temporary database.

[0093] Compared with related technologies, this embodiment has at least the following advantages:

[0094] On the one hand, during data processing, when performing various data processing operations on the first temporary database, based on the current business scenario and logical needs, some data elements in the first temporary database can be restored to be consistent with the backup data elements in the first backup database at any time. This discards data from any data modifications and changes performed on the first temporary database in response to the database open command. On the other hand, renaming the data elements to be restored in the first temporary database, copying the backup data elements to the first temporary database as new data elements, and then deleting the renamed data elements can avoid data inconsistencies caused by abnormal situations during the data copying process, ensuring data integrity. Simultaneously, it simplifies data management, avoids data conflicts, and improves data import efficiency.

[0095] Please refer to Figure 4 This is a flowchart illustrating the steps of a database reset operation provided in this embodiment. The specific details of the database reset operation are as follows:

[0096] Step 401: Create the fourth temporary database.

[0097] In this embodiment, the system detects whether the data reset instruction is a database reset instruction or a data element reset instruction. If the data reset instruction is detected as a database reset instruction, it indicates that a data reset operation needs to be performed on the database. The system then checks whether a database configuration file exists to ensure the smooth execution of subsequent data reset steps. If a database configuration file exists, a new temporary database is created based on the database configuration file; this new temporary database is the fourth temporary database.

[0098] Step 402: Configure the fourth temporary database based on the database configuration file, and delete the third temporary database.

[0099] In this embodiment, the data in the fourth temporary database is the initial data.

[0100] Step 403: Use the fourth temporary database as the new third temporary database.

[0101] Compared with related technologies, this embodiment has at least the following advantages:

[0102] On the one hand, during data processing, when performing various data processing operations on the first temporary database, the database can be reset to the second temporary database state at any time according to the current business scenario and logical needs, thereby discarding data from any data modifications and changes performed since the database was first accessed. On the other hand, by first creating the second temporary database, configuring it based on the database configuration file, and then deleting the first temporary database and using the second temporary database as the new first temporary database, data inconsistencies caused by abnormal situations during data copying can be avoided, ensuring data integrity. Simultaneously, this simplifies data management, avoids data conflicts, and improves data import efficiency.

[0103] Please refer to Figure 5 This is a flowchart illustrating the steps of a data element reset operation provided in this embodiment. The specific details of the data element reset operation are as follows:

[0104] Step 501: Check if there is a reset data element in the database configuration file.

[0105] In this embodiment, the system detects whether the data reset instruction is a database reset instruction or a data element reset instruction. If the data reset instruction is detected to be a data element reset instruction, it indicates that a data reset operation needs to be performed on some data elements in the database.

[0106] In this embodiment, the reset data element is matched with the data element to be reset in the third temporary database. For example, the third temporary database includes data element 1, data element 2, and data element 3. If a data reset operation needs to be performed on data element 1, the database configuration file is checked to see if there is a data element in the database configuration file that matches data element 1. In this case, the data element in the database configuration file that matches data element 1 is the reset data element.

[0107] Step 502: If a reset data element is detected in the database configuration file, copy the reset data element to the third temporary database.

[0108] Step 503: Delete the data elements in the third temporary database that are waiting to be reset.

[0109] Compared with related technologies, this embodiment has at least the following advantages:

[0110] On the one hand, during data processing, when performing various data processing operations on data elements in the first temporary database, some data elements in the database can be reset to the second data state at any time according to the current business scenario and logical needs, thereby discarding data from a series of modifications and changes to data elements since the database was accessed. On the other hand, by first copying the reset data elements to the first temporary database as new data elements, and then deleting the data elements to be reset, data inconsistencies caused by abnormal situations during the data copying process can be avoided, ensuring data integrity. Simultaneously, this simplifies data management, avoids data conflicts, and improves data import efficiency.

[0111] Please refer to Figure 6 This is a schematic diagram of the hardware structure of the electronic device 1000 provided in an embodiment of this application. Figure 6 As shown, the electronic device 1000 may include a processor 1001 and a memory 1002. The memory 1002 is used to store one or more computer programs 1003. The one or more computer programs 1003 are configured to be executed by the processor 1001. The one or more computer programs 1003 include instructions that can be used to implement the data processing method described above in the electronic device 1000.

[0112] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 1000. In other embodiments, the electronic device 1000 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements.

[0113] Processor 1001 may include one or more processing units, such as: application processor (AP), modem, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0114] The processor 1001 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 1001 is a cache memory. This memory can store instructions or data that the processor 1001 has just used or that are used repeatedly. If the processor 1001 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 1001, and thus improves the efficiency of the system.

[0115] In some embodiments, the processor 1001 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a USB interface, etc.

[0116] In some embodiments, the processor 1001 is used to execute acceleration schemes such as Single Instruction Multiple Data (SIMD) and Very Long Instruction Word (VLIW).

[0117] In some embodiments, memory 1002 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0118] This embodiment also provides a vehicle that stores computer instructions. When these instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the data processing method described in the above embodiment.

[0119] In this embodiment, the electronic device and vehicle are used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0120] In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0121] In the several embodiments provided in this application, the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are illustrative. For instance, the division of modules or units is a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0122] The unit described as a separate component may or may not be physically separate. The component shown as a unit can be one physical unit or multiple physical units, that is, it can be located in one place or distributed in multiple different places. Some or all of the units can be selected to achieve the purpose of the solution in this embodiment according to actual needs.

[0123] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0124] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0125] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.

Claims

1. A data processing method, characterized in that, The method includes: In response to a database open command, the system checks whether the database configuration file of the first persistent database is configured correctly, wherein the first persistent database is a database that permanently stores data. If the database configuration file is found to be configured correctly, a first temporary database and a first backup database are created. The first original data stored in the first persistent database is copied to the first temporary database and the first backup database. The first temporary database includes the first original data and first operation data. The first operation data is the data obtained after processing the first original data. The first backup database is used to restore the first temporary database to a historical state. In response to the data persistence command, the first temporary database is persisted to obtain the second persistent database.

2. The data processing method according to claim 1, characterized in that, The method further includes: In response to a data recovery command, the data in the first backup database is overwritten with the data in the first temporary database.

3. The data processing method according to claim 2, characterized in that, The data recovery instructions include database recovery instructions; overwriting the data in the first temporary database with data from the first backup database includes: Create a second temporary database; Overwrite all data in the second temporary database with all data from the first backup database, and delete the first temporary database; Use the second temporary database as the new first temporary database.

4. The data processing method according to claim 2, characterized in that, The data recovery instructions include data element recovery instructions; the step of overwriting the data in the first temporary database with data from the first backup database includes: Detect whether there is a backup data element in the first backup database, wherein the backup data element matches the data element to be restored in the first temporary database; If the backup data element is detected to exist in the first backup database, the backup data element is copied to the first temporary database; Delete the data element to be recovered from the first temporary database.

5. The data processing method according to claim 1, characterized in that, The data persistence instructions include database persistence instructions; the process of persisting the first temporary database to obtain the second persistent database includes: Create the second persistent database; Copy all data from the first temporary database to the second persistent database, and delete the first persistent database.

6. The data processing method according to claim 1, characterized in that, The data persistence instructions include data element persistence instructions; the process of persisting the first temporary database to obtain the second persistent database includes: Detect whether there is a persistent data element in the first temporary database, wherein the persistent data element matches the data element to be persisted in the first persistent database; If the persistent data element is detected to exist in the first temporary database, the persistent data element is copied to the first persistent database; Delete the data element to be persisted in the first persistent database; The first persistent database after the deletion operation is performed will be used as the second persistent database.

7. The data processing method according to claim 1, characterized in that, The method further includes: In response to the database shutdown command, the first temporary database and the first backup database are deleted, and the second persistent database is shut down.

8. The data processing method according to claim 7, characterized in that, After closing the second persistent database, the method further includes: In response to the database open command again, the second original data stored in the second persistent database is copied to the third temporary database, wherein the third temporary database includes the second original data and the second operation data, and the second operation data is the data obtained after data processing of the second original data.

9. The data processing method according to claim 8, characterized in that, After copying the second original data stored in the second persistent database to the third temporary database, the method further includes: In response to the data reset command, the third temporary database is configured according to the database configuration file.

10. The data processing method according to claim 9, characterized in that, The data reset instruction includes a database reset instruction; configuring the third temporary database according to the database configuration file includes: Create a fourth temporary database; Configure the fourth temporary database based on the database configuration file, and delete the third temporary database; The fourth temporary database is used as the new third temporary database.

11. The data processing method according to claim 9, characterized in that, The data reset instruction includes a data element reset instruction; configuring the third temporary database according to the database configuration file includes: Detect whether a reset data element exists in the database configuration file, wherein the reset data element matches the data element to be reset in the third temporary database; If the reset data element is detected in the database configuration file, the reset data element is copied to the third temporary database; Delete the data element to be reset in the third temporary database.

12. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store instructions, and the processor being used to invoke the instructions in the memory to cause the electronic device to perform the data processing method as described in any one of claims 1 to 11.

13. A vehicle, characterized in that, The vehicle includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the data processing method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Data processing method and device applied to database and computer storage medium

    CN116010335A