Data processing method, electronic equipment and vehicle
By creating temporary and backup databases when the database is opened, copying the original data, and performing data operations on the temporary database, the risk of data loss when directly processing the database is solved, and data security and recoverability are achieved.
Patent Information
- Application Number
- CN202510061608.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-15
AI Technical Summary
When directly performing data processing operations on the open database, if the database is subject to hardware failure, software errors, malicious attacks, or needs to be restored to historical state, the risk of data loss is prone to occur.
When the database configuration file is detected to be correctly configured, a first temporary database and a first backup database are created, and the original data stored in the first persistent database is copied to these databases. Then, data operations are performed directly on the first temporary database. If you encounter a risk of data loss, you can use the first persistent database or the first backup database for data recovery.
By creating temporary and backup databases, the risk of data loss when directly processing data on persistent databases is avoided, ensuring data security and recoverability.
Smart Images

Figure CN119917488A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, electronic equipment and a vehicle. Background Art
[0002] In traditional computer software data storage technology, many manufacturers basically use mainstream commercial or open source databases, such as MySQL, SQLite, Oracle, DB2, etc. After a user opens a database, he can directly perform data processing operations on the database.
[0003] However, if data processing operations are performed directly on an open database, there is a risk of data loss if the database is affected by hardware failure, software error, malicious attack, or if the database needs to be restored to a historical state. Summary of the invention
[0004] In view of the above, the embodiments of the present application provide a data processing method, an electronic device and a vehicle, which can solve the problem of directly performing data processing operations on an open database in the related technology. If the database is subject to hardware failure, software error, malicious attack, or needs to be restored to a historical state, the risk of data loss may easily occur.
[0005] An embodiment of the present application provides a data processing method, the method comprising: in response to a database opening instruction, detecting whether a database configuration file of a first persistent database is configured correctly, wherein the first persistent database is a database that permanently stores data; when it is detected that the database configuration file is configured correctly, 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 includes the first original data and first operation data, the first operation data is data obtained after data processing is performed on the first original data, and the first backup database is used to restore the first temporary database to a historical state.
[0006] Compared with the related art, the embodiments of the present application have at least the following advantages: When it is detected that the database configuration file is correctly configured, it indicates that the first persistent database can be connected, and the first original data of the first persistent database is copied to the first temporary database and the first backup database, and then data operations are directly performed on the first temporary database. If the first temporary database is subject to hardware failure, software error or malicious attack, the first persistent database can be used to restore the data of the first temporary database, avoiding the risk of losing the first original data of the first temporary database. At the same time, the first backup database can also be used to restore the first temporary database to a historical state, avoiding the risk of directly performing data processing operations on the first persistent database. If the first persistent database needs to be restored to a certain historical state, there is a risk of losing the first original data due to a failure during the data restoration process.
[0007] In some possible implementations, in response to a data recovery instruction, the data in the first backup database overwrites the data in the first temporary database.
[0008] In some possible implementations, the data recovery instruction includes a database recovery instruction; 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.
[0009] In some possible implementations, the data recovery instruction includes a data element recovery instruction; overwriting the data in the first temporary database with the data in the first backup database includes: detecting whether there is a backup data element in the first backup database, wherein the backup data element matches the data element to be recovered in the first temporary database; in the case of detecting that the backup data element exists in the first backup database, copying the backup data element to the first temporary database; and deleting the data element to be recovered in the first temporary database.
[0010] 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.
[0011] In some possible implementations, the data persistence instruction includes a database persistence instruction; the persistence processing of the first temporary database to obtain a second persistent database includes: creating the second persistent database; copying all data of the first temporary database to the second persistent database, and deleting the first persistent database.
[0012] In some possible implementations, the data persistence instruction includes a data element persistence instruction; the persistence processing of the first temporary database to obtain the second persistent database includes: detecting 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; in the case of detecting that the persistent data element exists 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.
[0013] In some possible implementations, the method further includes: in response to a database closing instruction, deleting the first temporary database and the first backup database, and closing the second persistent database.
[0014] In some possible implementations, after closing the second persistent database, the method further includes: again responding to a database open instruction, copying 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 data processing is performed on the second original data.
[0015] 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.
[0016] 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; using the fourth temporary database as the new third temporary database.
[0017] 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 there is a reset data element in the database configuration file, wherein the reset data element matches the data element to be reset in the third temporary database; in a case where it is detected that the reset data element exists 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.
[0018] The second aspect of the present application discloses an electronic device, which includes a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the electronic device executes the data processing method as described above.
[0019] A third aspect of the present application discloses a vehicle, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the data processing method as described above.
[0020] It can be understood that 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 that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a flowchart of a data processing method according to an embodiment of the present application.
[0022] Figure 2 It is a flowchart of a database recovery operation according to an embodiment of the present application.
[0023] Figure 3 It is a flowchart of a data element recovery operation according to an embodiment of the present application.
[0024] Figure 4 It is a flowchart of a database reset operation according to an embodiment of the present application.
[0025] Figure 5 It is a flowchart of a data element recovery operation according to an embodiment of the present application.
[0026] Figure 6 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0029] It should be further noted that, in this article, the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0030] In this application, "at least one" means one or more, and "more" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
[0031] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0032] Please refer to Figure 1 , which is a flow chart of a data processing method provided in an embodiment of the present application. The data processing method is applied to a data processing system, wherein the data processing system can be deployed in a device terminal, and the device terminal can be a laptop or a server, etc., and the present application does not limit this.
[0033] The data processing method comprises the following steps: Step 101: In response to a database opening instruction, detect whether a database configuration file of a first persistent database is configured correctly.
[0034] 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, and the persistent storage medium may include a hard disk.
[0035] In this embodiment, the database configuration file is a file for storing 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, user name, password, etc. It can also contain other configuration options, such as the database character set, connection pool size, log level, etc.
[0036] 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 the database is the initial data.
[0037] The database in this embodiment may include a MySQL database, a SQLite database, an Oracle database, and a DB2 database. In other embodiments, the database may also be other types of database management systems, which is not limited in this application.
[0038] By detecting whether the database configuration file of the first persistent database is correctly configured, it can be determined whether the data processing system can correctly connect to the first persistent database.
[0039] Step 102: When it is detected that the database configuration file is correctly configured, a first temporary database and a first backup database are created, and the first original data stored in the first persistent database is copied to the first temporary database and the first backup database.
[0040] In some embodiments, the first temporary database includes first original data and first operation data, and the first operation data is data obtained after data processing of the first original data. For example, the first operation data may be data added to the first temporary database by a user 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 of 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.
[0041] In some embodiments, when it is detected that the database configuration file is configured correctly, it indicates that the data processing system can normally connect to the first persistent database. It is detected whether there is an old first backup database and an old first temporary database. When it is detected that there is no old first backup database and an old first temporary database, 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.
[0042] When it is detected that there is an old first backup database and an old first temporary database, the old first backup database and the old first temporary database need to be deleted first, and 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.
[0043] First, check the database configuration file to avoid errors in the database configuration file, which may cause the database to be unusable. When it is determined that the database configuration file is correctly configured, check whether there is a first backup database and a temporary database left over from the historical period in the data processing system. If there is an old first backup database and an old temporary database left over from the historical period in the data processing system, delete the old first backup database and the old temporary database to avoid the old first backup database and the old temporary database from interfering with subsequent data operations. Finally, the data of the first persistent database can be copied to obtain the first backup database and the first temporary database.
[0044] It should be noted that, when the database configuration file is correctly configured, the first original data stored in the first persistent database is copied to the newly created first backup database and the newly created first temporary database. In the subsequent data process, if data operations such as adding, deleting, modifying, and checking data are required, only the data in the first temporary database is operated, and the data operation is not performed on the first backup database, so that when the data in the first temporary database needs to be restored to the data state of the first temporary database when the database is 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.
[0045] In this embodiment, the first backup database may also be stored in a persistent storage medium, and the first temporary database may be stored in a memory of a device deployed by the data processing system.
[0046] Step 103: In response to the data recovery instruction, the data in the first backup database overwrites the data in the first temporary database.
[0047] Specifically, the data recovery instruction includes a database recovery instruction and a data element recovery instruction. When the data recovery instruction is a database recovery instruction, in response to the database recovery instruction, all the data in the first backup database are overwritten with 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 data element recovery instruction, some data elements in the first backup database are overwritten with some data elements in the first temporary database (referred to as a data element recovery operation).
[0048] In this embodiment, the specific processes of the database recovery operation and the data element recovery operation are described in detail below and will not be repeated here.
[0049] Step 104: In response to the data persistence instruction, perform persistence processing on the first temporary database to obtain a second persistent database.
[0050] In some embodiments, the data persistence instruction includes a database persistence instruction and a data element persistence instruction. When the data persistence instruction is a database persistence instruction, all data in the first temporary database are 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, some data elements in the first temporary database are persistently stored to obtain a second persistent database (referred to as a data element persistence operation).
[0051] The following are the specific steps for database persistence operations and data element persistence operations: (1) The steps of database persistence operation include: creating a second persistent database, copying all data of the first temporary database to the second persistent database, and deleting the first persistent database.
[0052] (2) The step of persisting the data element includes: detecting whether the persistent data element exists in the second temporary database. If the persistent data element exists 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. The first persistent database after the deletion operation is performed is used as the second persistent database.
[0053] In this embodiment, the persistent data element matches 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 detected whether there is a data element matching data element 1 in the first temporary database. At this time, the data element matching data element 1 in the first temporary database is a persistent data element.
[0054] Step 105: In response to the database closing instruction, the first temporary database and the first backup database are deleted, and the second persistent database is closed.
[0055] In this embodiment, in response to the database closing instruction, according to the persistence requirement, it is confirmed whether it is necessary to persist the data in the first temporary database when closing the database. If it is necessary to persist the data in the first temporary database when closing the database, the data in the first temporary database is overwritten to the second persistent database to store the data persistently. Then, the first temporary database and the first backup database are deleted, and the second persistent database is closed. If it is not necessary to directly delete the first temporary database and the first backup database when closing the database, and close the second persistent database.
[0056] Step 106: In response to the database opening instruction again, copy the second original data stored in the second persistent database to the third temporary database.
[0057] In some embodiments, the third temporary database includes second original data and second operation data, and the second operation data is data obtained by processing the second original data.
[0058] Step 107: In response to the data reset instruction, configure a third temporary database according to the database configuration file.
[0059] Specifically, the data reset instruction includes a database reset instruction and a data element reset instruction. Wherein, when the data reset instruction is a database reset instruction, in response to the database reset instruction, all data in the third temporary database are configured according to the database configuration file, that is, the data in the third temporary database are initial data (referred to as a database reset operation); when the data reset instruction is a data element reset instruction, in response to the data element reset instruction, part of the data in the third temporary database is configured according to the database configuration file, that is, part of the data in the third temporary database is the same as part of the data in the initial data (referred to as a data element reset operation).
[0060] The processes of database reset operation and data element reset operation will be described in detail below. To avoid repetition, they will not be described here again.
[0061] In this embodiment, the database recovery operation and the data element recovery operation are collectively referred to as the data recovery operation, the database reset operation and the data element reset operation are collectively referred to as the data reset operation, and the database persistence operation and the data element persistence operation are collectively referred to as the data persistence operation.
[0062] It should be noted that during the data processing process, according to the data processing requirements, the user can select one or more of the database recovery operation, data element recovery operation, database reset operation, data element reset operation, database persistence operation and data element persistence operation. And the order in which the user operates one or more of the database recovery operation, data element recovery operation, database reset operation, data element reset operation, database persistence operation and data element persistence operation is not limited.
[0063] In order to better understand the content of this embodiment, the recovery, reset and persistence of a database are taken as an example to illustrate it: During the data processing process, the user needs to operate the database in the data processing system. In response to the database opening instruction, the data processing system first detects whether the database configuration file of the first persistent data is configured correctly. When it is detected that the database configuration file is configured correctly, a first temporary database and a first backup database are created, and the first original data stored in the first persistent database are copied to the first temporary database and the first backup database. At this time, the data in the first persistent database, the first temporary database, and the first backup database are all the same.
[0064] The user operates the first temporary database and performs add, delete, modify and query operations on some data in the first temporary database. For example, the user adds some data to the first temporary database. At this time, 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).
[0065] After the user performs add, delete, modify and query operations on some data in the first temporary database, the user finds that the data obtained after the add, delete, modify and query operations are wrong and needs to perform a database recovery operation. All the data in the first backup database can be overwritten with the first temporary database (at this time, the data in the first persistent database, the first temporary database and the first backup database are all the same).
[0066] Then, after the user continues to perform add, delete, modify and query operations on the first temporary data, the user needs to perform a database persistence operation to persist the first temporary database to obtain a 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).
[0067] Then, after the user performs add, delete, modify and query operations on some of the data in the first temporary database, the user finds that the data obtained after the add, delete, modify and query operations are wrong and needs to perform database recovery operations again. All the data in the first backup database overwrites the first temporary database (at this time, the second persistent database is different from the first temporary database, and the data in the first temporary database is the same as the first backup database).
[0068] If the user finishes the data processing operation, the data processing system responds to the database closing instruction and closes the connection between the data processing system and each database. At the same time, the first temporary database and the first backup database are deleted to release the disk storage space of the data processing system.
[0069] The data processing system again responds to the database opening instruction and copies the second original data stored in the second persistent database to the third temporary database and the second backup database.
[0070] After the user performs addition, deletion, modification and query operations on some data in the third temporary database, the user finds that the data obtained after the addition, deletion, modification and query operations are wrong, and needs to restore all the 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 instruction. At this time, in response to the database reset instruction, all the 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 data in the second backup database).
[0071] Compared with the related art, the embodiments of the present application have at least the following advantages: After responding to the data opening instruction, first, check whether the database configuration file is configured normally to ensure that the database can be connected and used normally. Then, the first original data of the first persistent database is copied to the first backup database and the first temporary database, so that the first temporary database can be subjected to data operations such as addition, deletion, modification, and query, data recovery, and data reset, thereby avoiding the risk of data loss caused by directly performing data processing operations on the opened database (i.e., the first persistent database) in the related art if the database is subjected to hardware failure, software error, or malicious attack. When it is necessary to perform data recovery operations on the first temporary database, the data of the first backup database can be directly overwritten to the first temporary database. When it is necessary to perform data reset operations on the first temporary database, the first temporary database can be configured according to the database configuration file. In this way, the requirements of data recovery operations and data reset operations can be met during the data processing process. At the same time, if the user needs data persistence operations, the data in the first temporary database is persistently stored so that the data of the first temporary database in response to the data persistence instruction can be directly obtained when the database is opened next time. In this way, during the data processing process, if there is a need for data recovery, data reset, and data persistence, the data processing method can be called directly, avoiding the time-consuming and inefficient problems that occur when users redesign the corresponding operation process.
[0072] Please refer to Figure 2 , is a flowchart of the steps of the database recovery operation provided in the embodiment of the present application. The specific contents of the database recovery operation are as follows: Step 201: Create a second temporary database.
[0073] As described above, the data recovery instruction includes a database recovery instruction and a data element recovery instruction. It is necessary to detect whether the data recovery instruction is a database recovery instruction or a data element recovery instruction. When it is detected that the data recovery instruction is a database recovery instruction, it indicates that a data recovery operation needs to be performed on the database to create a second temporary database.
[0074] Step 202: Overwrite all the data in the second temporary database with all the data in the first backup database, and delete the first temporary database.
[0075] Step 203: Use the second temporary database as a new first temporary database.
[0076] Compared with the related art, this embodiment has at least the following advantages: On the one hand, when various data processing is performed on the first temporary database during the data processing process, the first temporary database can be restored to be consistent with the data of the first backup database at any time according to the current business scenario and logical needs, thereby discarding the data of a series of data modification and change operations on the first temporary database since responding to the database opening instruction. On the other hand, first create a second temporary database, copy the data in the first backup database to the second temporary database, and then delete the first temporary data, and use the second temporary database as the new first temporary database, which can avoid abnormal situations in the data copying process and cause data inconsistency, thereby ensuring data integrity. At the same time, it simplifies data management, avoids data conflicts, and improves data import efficiency.
[0077] Please refer to Figure 3 , is a flowchart of the steps of the data element recovery operation provided in the embodiment of the present application. The specific contents of the data element recovery operation are as follows: Step 301: Detect whether there is a backup data element in the first backup database.
[0078] In this embodiment, it is detected whether the data recovery instruction is a database recovery instruction or a data element recovery instruction. When it is detected that the data recovery instruction is a data element recovery instruction, it indicates that a data recovery operation needs to be performed on some data elements of the database.
[0079] In some embodiments, the backup data element matches the data element to be restored 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 detected whether there is a data element matching data element 1 in the first backup database. At this time, the data element matching data element 1 in the first backup database is the backup data element.
[0080] In this embodiment, if the first backup database does not exist, or the backup data element in the first backup database does not exist, there is no need to perform a data element recovery operation.
[0081] Step 302: When it is detected that the backup data element exists in the first backup database, the backup data element is copied to the first temporary database.
[0082] In this embodiment, when it is detected that there is a backup data element 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 recorded as tmp. The backup data element is copied to the first temporary database as a new data element.
[0083] Step 303: Delete the data elements to be restored in the first temporary database.
[0084] In this embodiment, tmp in the first temporary database is deleted.
[0085] Compared with the related art, this embodiment has at least the following advantages: On the one hand, when various data processing is performed on the first temporary database during the data processing process, according to 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 of the first backup database at any time, thereby discarding the data of a series of data modification and change operations performed on the first temporary database since responding to the database opening instruction. On the other hand, the data elements to be restored in the first temporary database are first renamed, and after the backup data elements are copied to the first temporary database as new data elements, the renamed data elements are deleted, which can avoid the occurrence of abnormal situations in the data copying process that lead to data inconsistency, thereby ensuring the integrity of the data. At the same time, data management is simplified, data conflicts are avoided, and data import efficiency is improved.
[0086] Please refer to Figure 4 , is a flowchart of the steps of the database reset operation provided in the embodiment of the present application. The specific contents of the database reset operation are as follows: Step 401: Create a fourth temporary database.
[0087] In this embodiment, it is detected whether the data reset instruction is a database reset instruction or a data element reset instruction. When it is detected that the data reset instruction is a database reset instruction, it indicates that a data reset operation needs to be performed on the database, and then it is detected whether the database configuration file exists to ensure that the subsequent data reset steps are smoothly performed. When it is detected that the database configuration file exists, a new temporary database is created based on the database configuration file, and the new temporary database is the fourth temporary database.
[0088] Step 402: configure a fourth temporary database based on the database configuration file, and delete the third temporary database.
[0089] In this embodiment, the data in the fourth temporary database is initial data.
[0090] Step 403: Use the fourth temporary database as a new third temporary database.
[0091] Compared with the related art, this embodiment has at least the following advantages: On the one hand, when various data processing is performed on the first temporary database during the data processing process, the database can be reset to the second data state at any time according to the current business scenario and logical needs, thereby discarding the data of a series of data modification and change operations performed since the database was operated. On the other hand, first create a second temporary database, configure the second temporary database based on the database configuration file, and then delete the first temporary data, and use the second temporary database as the new first temporary database, which can avoid abnormal situations in the data copy process and cause data inconsistency, thereby ensuring data integrity. At the same time, it simplifies data management, avoids data conflicts, and improves data import efficiency.
[0092] Please refer to Figure 5 , is a flowchart of the steps of the data element reset operation provided in the embodiment of the present application. The specific contents of the data element reset operation are as follows: Step 501: Check whether there is a reset data element in the database configuration file.
[0093] In this embodiment, it is detected whether the data reset instruction is a database reset instruction or a data element reset instruction. When it is detected that the data reset instruction is a data element reset instruction, it indicates that a data reset operation needs to be performed on some data elements of the database.
[0094] In this embodiment, the reset data element matches 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 data reset operation is required for data element 1, it is detected whether there is a data element matching data element 1 in the database configuration file. At this time, the data element matching data element 1 in the database configuration file is the reset data element.
[0095] Step 502: When it is detected that a reset data element exists in the database configuration file, the reset data element is copied to a third temporary database.
[0096] Step 503: Delete the data elements to be reset in the third temporary database.
[0097] Compared with the related art, this embodiment has at least the following advantages: On the one hand, when various data processing is performed on the data elements of the first temporary database during the data processing process, according to the current business scenario and logical needs, some data elements in the database can be reset to the second data state at any time, thereby discarding the data of a series of data element modifications and changes performed since the database was operated. On the other hand, after the reset data elements are copied to the first temporary database as new data elements, the data elements to be reset are deleted, which can avoid abnormal situations in the data copying process and cause data inconsistency, thereby ensuring data integrity. At the same time, data management is simplified, data conflicts are avoided, and data import efficiency is improved.
[0098] Please refer to Figure 6 , is a schematic diagram of the hardware structure of the electronic device 1000 provided in the embodiment of the present 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, and the above instructions can be used to implement the above data processing method in the electronic device 1000.
[0099] It is understandable that the structure shown 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 shown, or combine or separate some components, or arrange the components differently.
[0100] The processor 1001 may include one or more processing units, for example, the processor 1001 may include an application processor (AP), a modem, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0101] The processor 1001 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 1001 is a cache memory. The memory may store instructions or data that the processor 1001 has just used or circulated. If the processor 1001 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 1001, and thus improves the efficiency of the system.
[0102] In some embodiments, the processor 1001 may include one or more interfaces. The interface 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.
[0103] In some embodiments, processor 1001 is used to execute acceleration schemes such as single instruction multiple data (SIMD) and very long instruction word (VLIW).
[0104] In some embodiments, memory 1002 may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0105] This embodiment also provides a vehicle in which computer instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the data processing method in the above-mentioned embodiment.
[0106] Among them, the electronic equipment and vehicle provided in this embodiment are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0107] In practical applications, the above functions can be distributed 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.
[0108] In several embodiments provided in the present application, the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0109] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
[0110] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0111] If the integrated unit is implemented in the form of 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0112] The above description is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: In response to the database opening instruction, detecting whether a database configuration file of a first persistent database is configured correctly, wherein the first persistent database is a database that permanently stores data; When it is detected that the database configuration file is configured correctly, a first temporary database and a first backup database are created, and the first original data stored in the first persistent database are copied 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 is data obtained after data processing is performed on the first original data, and the first backup database is used to restore the first temporary database to a historical state.
2. The data processing method according to claim 1, characterized in that: The method further comprises: In response to the data recovery instruction, 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 instruction includes a database recovery instruction; and overwriting the data in the first temporary database with the data in the first backup database includes: Create 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; The second temporary database is used as the new first temporary database.
4. The data processing method according to claim 2, characterized in that: The data recovery instruction includes a data element recovery instruction; and overwriting the data in the first temporary database with the data in the first backup database includes: detecting 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; In case of detecting that the backup data element exists in the first backup database, copying the backup data element to the first temporary database; The data elements to be restored in the first temporary database are deleted.
5. The data processing method according to claim 1, characterized in that: The method further comprises: In response to the data persistence instruction, persistence processing is performed on the first temporary database to obtain a second persistent database.
6. The data processing method according to claim 5, characterized in that: The data persistence instruction includes a database persistence instruction; the performing persistence processing on the first temporary database to obtain a second persistent database includes: Creating the second persistent database; All data in the first temporary database are copied to the second persistent database, and the first persistent database is deleted.
7. The data processing method according to claim 5, characterized in that: The data persistence instruction includes a data element persistence instruction; the first temporary database is subjected to persistence processing to obtain a second persistent database, including: Detecting 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; In case of detecting that the persistent data element exists 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; The first persistent database after the deletion operation is performed is used as the second persistent database.
8. The data processing method according to claim 5, characterized in that: The method further comprises: In response to a database closing instruction, the first temporary database and the first backup database are deleted, and the second persistent database is closed.
9. The data processing method according to claim 8, characterized in that: After closing the second persistent database, the method further includes: In response to the database open instruction 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 second operation data, and the second operation data is data obtained after data processing on the second original data.
10. The data processing method according to claim 9, 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 instruction, the third temporary database is configured according to the database configuration file.
11. The data processing method according to claim 10, characterized in that: The data reset instruction includes a database reset instruction; and configuring the third temporary database according to the database configuration file includes: Create a fourth temporary database; configuring the fourth temporary database based on the database configuration file, and deleting the third temporary database; The fourth temporary database is used as the new third temporary database.
12. The data processing method according to claim 10, characterized in that: The data reset instruction includes a data element reset instruction; the configuring the third temporary database according to the database configuration file includes: detecting whether there is a reset data element in the database configuration file, wherein the reset data element matches the data element to be reset in the third temporary database; In case of detecting that the reset data element exists in the database configuration file, copying the reset data element to the third temporary database; The data elements to be reset in the third temporary database are deleted.
13. An electronic device, characterized in that: The electronic device comprises a processor and a memory, the memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the data processing method according to any one of claims 1 to 12.
14. A vehicle, characterized in that: The vehicle comprises computer instructions, which, when executed on an electronic device, cause the electronic device to perform the data processing method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Update and reduction method and system of honeypot database
CN105488389A
IMS restoration support for temporary GRUU
CN106688216A
Data processing method and device applied to database and computer storage medium
CN116010335A
Internal memory database encryption method, database system and electronic equipment
CN116150792A
Data processing method, persistent storage system, vehicle and computer storage medium
CN118012834A