Disclosure of Invention
In view of the above, it is necessary to provide a data recovery method, a data recovery apparatus and a base station for solving the above technical problems.
In order to achieve the purpose, the embodiment of the invention adopts the following technical scheme:
in one aspect, an embodiment of the present invention provides a data recovery method, including the following steps:
starting a data management process; the data management process is a process for transferring interactive data among the processes;
backing up target data corresponding to a target process through the data management process; the target process is any one of the processes;
and if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data.
In one embodiment, the interaction data includes a database file, a database temporary table and a database permanent relationship table, and the target data includes a database temporary table.
In one embodiment, the method further comprises the steps of:
backing up the database file by the target process at regular time;
and if the database temporary table and/or the database permanent relation table corresponding to the database file are/is changed, backing up the changed database temporary table and/or the changed database permanent relation table.
In one embodiment, the method further comprises the steps of:
if the data management process is abnormal, after the data management process is recovered, synchronizing the database temporary table to the data management process through the target process.
In one embodiment, if the data management process detects that the target process is abnormal, the step of performing data recovery on the target process through the data management process according to the target data includes:
if the data management process detects that the target process is abnormal, deleting the database file in the target process through the data management process, and synchronizing the backed-up database file to the target process;
and synchronizing the backed-up database temporary table and the database permanent relation table to the target process through the data management process.
In one embodiment, the method further comprises the steps of:
and informing the target process to backup the database file through the data management process.
In one embodiment, the target data comprises a file data packet;
if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data, wherein the step comprises the following steps of:
if the data management process detects that the target process is abnormal, the data management process informs the target process to resume sending the rest file data packets according to the recently received file data packets;
and forwarding the rest of the file data packets through the data management process.
In one embodiment, the target data further comprises state parameter data;
if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data, and further comprising:
and if the data management process detects that the target process is abnormal, synchronously updating the state parameter data to the target process through the data management process.
In one embodiment, the target data further comprises functional data;
if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data, and further comprising:
and if the data management process detects that the target process is abnormal, synchronously updating the state parameter data and the functional data to the target process through the data management process.
In one embodiment, the method further comprises:
and if the data management process is abnormal, synchronously updating the state parameter data and/or the functional data to the data management process through the target process.
In another aspect, a data recovery apparatus is also provided, including:
the process starting module is used for starting a data management process; the data management process is a process for transferring interactive data among the processes;
the target backup module is used for backing up target data corresponding to the target process through the data management process; the target process is any one of the processes;
and the recovery module is used for recovering the data of the target process through the data management process according to the target data when the data management process detects that the target process is abnormal.
In another aspect, a base station is further provided, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the data recovery method when executing the computer program.
In still another aspect, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, performs the steps of the above-mentioned data recovery method.
One of the above technical solutions has the following advantages and beneficial effects:
according to the data recovery method, the independent data management processes are established and used for transferring the interactive data among the processes, and the target data in the interactive data are backed up. When the data management process detects that the target process is abnormal, the data management process can perform data recovery on the abnormal target process by using the backed-up target data so as to recover the state of the target process to a normal state before the abnormal time. Therefore, when abnormality occurs in the process of transmitting the interactive data by the target process, data recovery can be rapidly carried out, the stability of the base station can be improved, and the development and maintenance cost of software of the base station can be reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data recovery method provided by the application can be applied to data interaction between different base station systems and between base station interiors, as shown in fig. 1, such as an LTE base station or an LTE base station system. Taking the LTE base station as an example, in the base station, an independent data management process may be established to relay the interactive data to other processes, such as a data transmission process and a database service process, during the system operation process of the base station. The base station can transfer the interactive data transmitted by one or more target processes through the data management process and back up the target data in the interactive data transmitted by the target processes. Therefore, when the data management process detects that the target process is abnormal, so that the transmission of the interactive data is interrupted, and the data interaction with other processes or the correctness of data storage is influenced, the data management process can perform data recovery on the target process according to the backed-up target data, so that the abnormal target process can be quickly recovered to a normal state before the abnormal time.
Referring to fig. 2, in an embodiment, a data recovery method is provided, which is described by taking the data recovery method as an example for being applied to a base station, and includes the following steps S12 to S16:
s12, starting a data management process; the data management process is a process for transferring interactive data among the processes.
It can be understood that, during the system operation of the base station, an independent data management process may be started by the processor, and the data management process interacts with each process directly or indirectly, and serves as a pivot process of each process to relay interaction data between the processes.
S14, backing up the target data corresponding to the target process through the data management process; the target process is any one of the processes.
The target data may be used to recover the process state or the transmitted data, such as state parameter data, file data, or relationship table data, in the transmitted interactive data. The data management process performs interactive data transfer on one or more target processes interacted with the data management process, and simultaneously can back up target data in the interactive data.
Specifically, the base station can transfer the interactive data of the target process through the data management process in the operation process, back up the target data, and provide uniform management for the data transmission of each process. That is, the interactive data transmitted by each target process is forwarded to the corresponding receiving side process through the data management process. When the data management process transfers the interactive data, the target data in the interactive data can be backed up in real time or periodically, so as to be used for data recovery when the process is abnormal.
And S14, if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data. The exception may refer to various exception conditions that cause an abnormal interruption or error in transmitting the interactive data, such as a self-healing process, a recovery after a network interruption, a data damage or loss, and the like. The data recovery may be a process of recovering the interactive data transmitted by the target process to a state before the abnormal time, or a process of recovering the state parameters of the target process to a state before the abnormal time, or other processes of recovering the interactive data and keeping the interactive data complete, wherein the process of recovering the interactive data can enable the target process to normally transmit the interactive data again.
Specifically, in the base station, when the data management process receives a report of an abnormal target process in the relay target process, or actively detects that data transmission of the target process is abnormal (for example, interactive data transmitted by the target process is interrupted and lost and has errors), data recovery is performed on the abnormal target process according to the backed-up target data, for example, corresponding target data is imported, or interactive data on other processes related to the target data are synchronously updated to the abnormal target process after transmission is recovered, so that the data transmission state of the target process is recovered to a normal state before the abnormal time.
In the data recovery method, the target data in the interactive data is backed up by establishing an independent data management process for transferring the interactive data among the processes. When the data management process detects that the target process is abnormal, the data management process can perform data recovery on the abnormal target process by using the backed-up target data so as to recover the state of the target process to a normal state before the abnormal time. Therefore, when abnormality occurs in the process of transmitting the interactive data by the target process, data recovery can be rapidly carried out, the stability of the base station can be improved, and the development and maintenance cost of software of the base station can be reduced.
In one embodiment, the interaction data includes a database file, a database temporary table, and a database permanent relationship table. The target data includes a database temporary table.
It is understood that, for the data transmission scenario of the database in the base station, the target process described above may be, but is not limited to, a database service process. The interactive data may comprise a database file, a database temporary table and a database permanent relation table. Specifically, when the database service process transmits data of the database, for example, transmits a database file, the database service process may maintain a corresponding temporary data table and a permanent database relationship table. The data management process can backup the corresponding database temporary table when transferring the database file transmitted by the database service process, so as to provide the database temporary table required in the data recovery process of the database service process when the database service process is abnormal.
Referring to fig. 3 and 4, in an embodiment, the data recovery method further includes steps S13a and S13 b:
and S13a, backing up the database file regularly through the target process.
It can be understood that, for a data transmission scenario of a database in a base station, a target process (e.g., a database service process) may periodically backup a database file in a process of processing data of the database, except for completing normal operations of loading the database file, importing a parameter configuration file into or exporting the database, and the like. The backed-up database file may be stored in a non-volatile memory for later use, such as a FLASH memory in the base station. For example, the target process may periodically detect whether an exception has occurred to the data file, such as a corruption of the database file or other abnormal condition. If the database file is not abnormal when the detection period is over, the database file is backed up, so that the data management process can call the backed-up database file to perform data recovery on the target process when the target process is abnormal, for example, the database file is damaged, the database is deadlocked or self-healed, and the like. Fig. 4 is a schematic diagram of an optional abnormal recovery flow in a data transmission scenario of a database.
And S13b, if the database temporary table and/or the database permanent relation table corresponding to the database file are changed, backing up the changed database temporary table and/or the changed database permanent relation table.
It can be understood that the target process may immediately backup the changed database temporary table or database permanent relation table when the database temporary table stored in the database is changed or the database permanent relation table of the database is changed in the process of transmitting the data. The target process can also immediately backup the database temporary table and the database permanent relation table when the database temporary table and the database permanent relation table are changed. For example, the target process realizes that the changed database temporary table is immediately backed up to the configuration file of the corresponding volatile memory when the database temporary table is changed by registering the callback function of the database temporary table. The target process realizes that the database permanent relation table is changed by registering the callback function of the database permanent relation table, and immediately backups the changed database permanent relation table to a corresponding configuration file, such as a database configuration file on a FLASH memory.
In this way, through the above steps S13a and S13b, the data management process may backup the database temporary table in real time during the interaction with the target process, so that when an abnormality of the target process is detected, the backed-up database temporary table is provided to the target process, so that after the backup database file and the database permanent relationship table imported by the target process are obtained, the backed-up database temporary table completes data recovery.
Referring to fig. 5, in an embodiment, the data recovery method further includes step S17:
and S17, if the data management process is abnormal, after the data management process is recovered, synchronizing the database temporary table to the data management process through the target process.
Specifically, in the process of interacting the data management process with other target processes, if the data management process itself is abnormal, for example, the data management process separately starts a database file abnormality detection thread, and when it is detected that the transferred database file is deadlocked, self-healed, or damaged, after the data management process is recovered, the target stored with the database temporary table may import the database temporary table into the data management process, so that the data management process may recover to a normal state before the time when the abnormality occurs. After the data management process recovers the normal state, other interactive target processes can be informed to synchronously update the temporary table of the database, and the recovery and the accuracy of data transfer are ensured.
Referring to fig. 6, in an embodiment, the step S16 may specifically include the following steps S162 and S164:
s162, if the data management process detects that the target process is abnormal, deleting the database file in the target process through the data management process, and synchronizing the backed-up database file to the target process;
and S164, synchronizing the backed-up database temporary table and the database permanent relation table to a target process through the data management process.
Specifically, when the database management process detects that the database file transmitted by the target process is abnormally damaged, the data management process deletes the original database file in the target process, loads the backed-up database file to the target process, and completes the synchronous recovery of the database file. However, at this time, compared with the time of occurrence of the exception, the database file in the target process has a part of data that is not updated to the latest state, and the database temporary table and the database permanent relationship table are still in a lost state. Therefore, the data management process can continuously import the backed-up database temporary table and the database permanent relationship table to the target process so as to restore the database file of the target process to the normal state before the abnormal occurrence time, namely, the latest state. After that, other processes interacting with the target process can complete data synchronization through interaction with the target process, and normal data transmission and processing are recovered. When other processes interacting with the target process are abnormal, for example, self-healing occurs, when other processes after abnormal recovery are accessed to the target process, the target process can synchronize the recovered data to the other processes, so that the other processes can be quickly recovered to a normal state before the abnormal.
Through the steps S162 and S164, when the target process is abnormal, the data management process synchronizes the corresponding backup data, so as to quickly and reliably recover the data of the abnormal target process.
Referring to fig. 7, in an embodiment, the data recovery method may further include step S18:
and S18, notifying the target process to backup the database file through the data management process.
It will be appreciated that the stored backed-up database files are ready for use when the data management process synchronizes the backed-up database files to the target process. The data management process may notify the target process to perform the database file backup again while loading the backup database file to the target process, and backup the database file to the nonvolatile memory for standby. Thus, through the step S18, it is possible to ensure that there is an available backup database file at any time, and improve the reliability of the target process abnormal recovery, thereby improving the system stability of the base station.
Referring to FIG. 8, in one embodiment, the target data includes state parameter data. Step S16 may specifically include the following steps:
and if the data management process detects that the target process is abnormal, synchronously updating the state parameter data to the target process through the data management process. The state parameter data is a state class parameter after the target process completes function switching, for example, state parameter data such as a state in which configuration of each chip is completed, a state in which network configuration is completed, and a connection state of an S1 or X2 link is loaded in the LTE base station.
Specifically, after the target process completes function switching at a certain stage, the corresponding state parameter data may be synchronously sent to the data management process for backup. When the target process is abnormal, the data management process can synchronously update the backup state parameter data to the abnormal target process, so that the target process can be quickly recovered to a normal state before the abnormal time according to the received state parameter data. It will be appreciated that the same may be true for other target processes.
Through the specific process of the step S16, when the target process is abnormal, the data management process can synchronously update the backed-up state parameter data to the corresponding target process, so as to quickly recover the state parameter of the target process, and ensure that the target process can correctly transmit and process various interactive data.
Referring to FIG. 9, in one embodiment, the target data further includes a file data packet. Step S16 may specifically include the following steps:
if the data management process detects that the target process is abnormal, the data management process informs the target process to resume sending the rest file data packets according to the recently received file data packets; and recovering and forwarding the residual file data packets through the data management process.
The file data packet is a configuration file data packet transmitted between different processes, such as a log, a performance file or other configuration files. Specifically, in a scenario of transmission of non-database data in the base station, when the data management process transfers a file data packet, the file data packet received from a target process, such as process a, and a file data packet forwarded, such as a file data packet forwarded to process B, may be recorded. When the target process is abnormal, for example, when the target process is abnormally interrupted in transmitting the file data packet due to network instability or other reasons, the data management process may notify the target process of the file data packet that has been received recently when the transmission condition is recovered, for example, when the network is recovered within a set time, and the target process may continue to send the remaining file data packets to the data management process from the position of the interrupted file data packet. Further, the data management process may continue forwarding the remaining file packets from the file packet that was not successfully forwarded recently, such as to process B.
Thus, through the specific process of step S16, when the file data packet cannot be completely transmitted due to an abnormality occurring in the target process, the transmission state of the target process can be quickly synchronized by the data management process, so as to recover the normal transmission of the file data packet, and avoid the file data packet from being lost.
In one embodiment, the target data further comprises functional data. Step S16 may specifically include the following steps:
and if the data management process detects that the target process is abnormal, synchronously updating the state parameter data and the functional data to the target process through the data management process. The functional data is data that may affect the use of important functions of the process or cause other data transmission and processing problems when data is lost. It can be understood that the amount of data that can be stored in the memory of the data management process is relatively limited compared to the nonvolatile memory, and therefore, the data management process may only store target data required for data recovery, such as the above-mentioned functional data, file data packets, and state parameter data, and the other transferred files are only forwarded. When the target process is abnormal, for example, the target process is damaged by functional data, which results in some functions being unavailable, the data management process may synchronously update the backed-up functional data and the state parameter data to the target process, so that the target process performs recovery according to the received functional data and state parameter data.
Through the specific process of step S16, when an anomaly such as damage or loss of important functional data occurs in the target process, the recovery can be completed quickly and reliably through backup and synchronous update of the data management process, and the data recovery efficiency and system stability of the target process are improved.
In an embodiment, the data recovery method further includes the following steps:
and if the data management process is abnormal, synchronously updating the state parameter data and/or the functional data to the data management process through the target process.
It can be understood that, in the transmission scenario of non-database data in the base station, when the data management process is abnormal, for example, when the data management process is self-healing or data loss in relay occurs, the data management process may also perform data synchronization update with the target process in a normal state, so as to synchronize the state parameter data or the functional data on the target process, or synchronize the state parameter data and the functional data together to the data management process, so that the data management process is restored to a normal state, and ensure normal relay of various types of interactive data transmitted by the target process.
It should be understood that, although the respective steps in the flowcharts of fig. 2 to 3, and 5 to 7 are sequentially shown as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps of fig. 2-3, and 5-7 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least some of the sub-steps or stages of other steps.
Referring to FIG. 10, in one embodiment, a data recovery apparatus 100 is provided, which includes a process starting module 12, a target backup module 14, and a recovery module 16, wherein: the process starting module 12 is used for starting a data management process; the data management process is a process for transferring interactive data among the processes. The target backup module 12 is configured to backup target data corresponding to a target process through a data management process; the target process is any one of the processes. The recovery module 14 is configured to, when the data management process detects that the target process is abnormal, perform data recovery on the target process through the data management process according to the target data.
In the data recovery apparatus 100, after the process starting module 12 starts the data management process, the target backup module 14 transfers the interactive data transmitted by the target process, and backs up the target data therein. When the target process is abnormal, the recovery module 14 may perform data recovery on the abnormal target process by using the backed-up target data through the data management process, so as to recover the state of the target process to the normal state before the time of the abnormal target process. Therefore, when abnormality occurs in the process of transmitting the interactive data by the target process, data recovery can be rapidly carried out, the stability of the base station can be improved, and the development and maintenance cost of software of the base station can be reduced.
In one embodiment, the data recovery device 100 may further include a database timing backup module and a table data backup module. The database timing backup module is used for informing the target process of regularly backing up the database file. The table data backup module is used for backing up the changed database temporary table and/or database permanent relation table when the database temporary table and/or database permanent relation table corresponding to the database file is changed.
In one embodiment, the data recovery apparatus 100 may further include a first recovery module. The first recovery module is configured to synchronize the database temporary table to the forwarding backup module 12 through the target process when the forwarding backup module 12 is abnormal.
In one embodiment, the restore module 14 includes a database file restore module and a relational table restore module.
The database file recovery module is configured to notify the forwarding backup module 12 to delete the database file in the target process when the target process is abnormal, and synchronize the backed-up database file to the target process. The relation table recovery module is configured to notify the forwarding backup module 12 to synchronize the backed-up database temporary table and the database permanent relation table to the target process.
In one embodiment, the data recovery device 100 may further include a re-backup module. And the re-backup module is used for informing the target process of backing up the database file.
For specific limitations of the data recovery apparatus 100, reference may be made to the above limitations of the data recovery method, which are not described herein again. The various modules in the data recovery apparatus 100 described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a base station is provided, which may be an LTE base station or a base station system. The base station includes a processor, memory, network interface and database connected by a system bus, it being understood that the foregoing is illustrative of the main components, and not all. Wherein the processor of the base station is configured to provide computational and control capabilities. The memory of the base station comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the base station is used to store various transmission data. The network interface of the computer device is used for communicating with an external communication device through a network connection. The computer program is executed by a processor to implement a data recovery method.
In one embodiment, there is provided a base station comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program implementing the steps of: starting a data management process; the data management process is used for transferring interactive data among the processes; backing up target data corresponding to a target process by a data management process; the target process is any one of the processes; and if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data.
In one embodiment, the processor, when executing the computer program, may also implement the additional steps or sub-steps of the data recovery method in the above embodiments.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: starting a data management process; the data management process is a process for transferring interactive data among the processes: backing up target data corresponding to a target process through a data management process; the target process is any one of the processes; and if the data management process detects that the target process is abnormal, performing data recovery on the target process through the data management process according to the target data.
In one embodiment, the computer program, when executed by the processor, may also implement the additional steps or sub-steps of the data recovery method in the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the data recovery method according to the above embodiments may be implemented by a computer program, which is stored in a non-volatile computer readable storage medium and used for instructing related hardware, and when executed, the computer program may include the processes of the data recovery method according to the above embodiments. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.