Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method, a system and computer equipment for power failure protection of cache data, wherein the system comprises a database construction module, a data monitoring module, a central control module and a power supply detection module, the database construction module, the data monitoring module and the power supply detection module are connected with a central controller, and the method comprises the following steps:
the database construction module is used for constructing a cache data power-down protection database through a database construction program;
the data monitoring module is used for monitoring the data to be protected in real time through the monitoring device;
the central control module is used for coordinating and controlling the normal operation of each module of the cache data power failure protection system through a single chip microcomputer and/or a central processing unit;
and the power supply detection module is used for detecting the power supply conditions of the system power supply and the power supply module in real time through the power supply detection circuit.
Further, the system for power-down protection of the cache data further comprises a power supply module, a data cache module, a power-down protection control module, a medium storage module and an update display module which are connected with the central controller, wherein:
the power supply module is used for supplying continuous power to the cache data power failure protection system through a standby power supply when the system power supply is in an abnormal power failure condition;
the data cache module is used for storing dirty data which is stored in a memory and is not written into a disk under the condition of normal operation of the system through a data cache medium, and storing protection data after the power failure protection recovery process;
the power failure protection control module is used for controlling the power failure protection behavior of the cache data power failure protection system through a control program;
the medium storage module is used for storing the protection data read by the data cache module through a cache data power-down protection database of the nonvolatile storage medium;
and the updating display module is used for updating and displaying the data of each module of the cache data power failure protection system in real time through a display.
Further, the real-time detection of the system power supply and the power supply condition of the power supply module through the power supply detection circuit comprises:
acquiring a sampling value of the output voltage of the alternating current power supply;
calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
judging whether the voltage effective value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
The invention also provides a method for power-down protection of the cache data, which comprises any one of the above systems for power-down protection of the cache data, and comprises the following steps:
the power supply detection circuit is used for detecting the power supply conditions of the system power supply and the power supply module in real time through the power supply detection module;
when the abnormal power failure condition of the system power supply is detected, the standby power supply is used for supplying power to the cache data power failure protection system continuously through the power supply module;
storing dirty data which is stored in a memory and is not written into a disk under the condition of normal operation of the system by using a data cache medium through a data cache module, and storing protection data after a power failure protection recovery process;
controlling the power-fail protection behavior of the cache data power-fail protection system by using a control program through a power-fail protection control module;
the medium storage module utilizes a cache data power-down protection database of the nonvolatile storage medium to store the protection data read by the data cache module;
and updating and displaying the data of each module of the cache data power failure protection system in real time by using a display through an updating and displaying module.
Further, the real-time detection of the system power supply and the power supply condition of the power supply module through the power supply detection circuit comprises:
acquiring a sampling value of the output voltage of the alternating current power supply;
calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
judging whether the voltage effective value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
Further, the data caching module utilizes the data caching medium to store dirty data which is stored in a memory and is not written into a disk under the normal operation condition of the system, and after the power failure protection recovery process, the protection data is stored, wherein the process specifically comprises the following steps:
when the power supply detection module detects an abnormal power supply signal, the power failure protection control module informs the central controller to complete the current necessary writing process;
cutting off all power supply information in the whole system, and activating a power supply module to supply power to a data cache module, a power failure protection control module and a nonvolatile storage medium;
after the storage system is started and the application of the to-be-detected protection data is completed, the storage system writes the new protection data into the data cache module.
Further, the power failure protection behavior of the cache data power failure protection system is controlled by the power failure protection control module through a control program, and the method comprises the following steps:
when detecting that the power supply module starts to supply power to the protected system, the central processing module sets the memory to be in a read-only mode, sets power-fail protection starting flag positions in controller memory disks of the protected system and the system for caching data power-fail protection to be a first specified value, stores data in all virtual memory disks in the controller memory disks of the two systems into corresponding flash memories, and sets power-fail protection finishing flag positions to be a second specified value;
when the system power supply is recovered, the central processing unit starts the system and detects the power failure protection starting zone bit and the power failure protection finishing zone bit of the memory disks of the two controllers;
when the central processing unit detects that the power failure protection starting zone bits of the two controller memory disks are currently set to a first designated value and the power failure protection finishing zone bit is set to a second designated value, it is determined that abnormal power failure occurs to the two controller memory disks before starting.
Further, data only interacts between the data cache module and the non-volatile storage medium.
The invention also provides computer equipment for the power-down protection of the cache data, which comprises a processor and a memory, wherein the memory stores an operation program of any one of the methods for the power-down protection of the cache data, and the program can be realized by the operation of the processor.
The system for power failure protection of the cache data provided by the invention does not depend on some special platforms, can be separated from a storage system self-forming module, is convenient to increase and delete, is flexible in product configuration, has low requirement on hardware of the storage system, and is less in implementation difficulty; the power supply module has smaller capacity, only needs to supply power to parts such as nonvolatile storage media such as a memory and a flash card, and the like, and has lower power supply requirement than the common BBU mode. Meanwhile, the alternating voltage sampling detection is carried out on the alternating current power supply through the power supply detection module by the microcontroller, and whether the power failure fault occurs or not is judged according to the calculated voltage effective value, so that the detection result is accurate, the real-time performance is strong, the delay time is short, and the power failure fault warning can be timely carried out, so that the normal operation of equipment is ensured.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
As shown in fig. 1, the system for power down protection of cached data provided in this embodiment includes: the system comprises a database construction module 1, adata monitoring module 2, a central control module 3, a powersupply detection module 4, apower supply module 5, a data cache module 6, a power failure protection control module 7, amedium storage module 8 and anupdate display module 9.
The database construction module 1 is connected with the central control module 3 and used for constructing a cache data power-down protection database through a database construction program;
thedata monitoring module 2 is connected with the central control module 3 and is used for monitoring data to be protected in real time through a monitoring device;
the central control module 3 is connected with the database construction module 1, thedata monitoring module 2, the powersupply detection module 4, thepower supply module 5, the data cache module 6, the power-down protection control module 7, themedium storage module 8 and theupdate display module 9, and is used for coordinating and controlling the normal operation of each module of the cache data power-down protection system through a single chip microcomputer and/or a central processing unit;
the powersupply detection module 4 is connected with the central control module 3 and is used for detecting the power supply conditions of the system power supply and the power supply module in real time through the power supply detection circuit;
thepower supply module 5 is connected with the central control module 3 and used for supplying continuous power to the cache data power failure protection system through a standby power supply when the system power supply is in an abnormal power failure condition;
the data cache module 6 is connected with the central control module 3 and used for storing dirty data which are stored in a memory and are not written into a disk under the condition that the system normally operates through a data cache medium and storing protection data after the power failure protection recovery process;
the power-fail protection control module 7 is connected with the central control module 3 and is used for controlling the power-fail protection behavior of the cache data power-fail protection system through a control program;
themedium storage module 8 is connected with the central control module 3 and used for storing the protection data read by the data cache module through a cache data power-down protection database of the nonvolatile storage medium;
and the updatingdisplay module 9 is connected with the central control module 3 and used for updating and displaying the data of each module of the cache data power failure protection system in real time through a display.
Example 2
The specific steps of the method for power-down protection of cache data provided in this embodiment, as shown in fig. 2, include the following steps:
s101, constructing a cache data power failure protection database by using a database construction program through a database construction module; monitoring data to be protected in real time by using a monitoring device through a data monitoring module;
s102, a central control module utilizes a single chip microcomputer and/or a central processing unit to coordinate and control the normal operation of each module of the cache data power failure protection system;
s103, detecting the power supply conditions of the system power supply and the power supply module in real time by using a power supply detection circuit through a power supply detection module;
s104, when the system power supply is in an abnormal power failure condition, a standby power supply is used for supplying power to the cache data power failure protection system continuously through a power supply module;
s105, storing dirty data which is stored in a memory and is not written into a disk under the normal operation condition of the system by using a data cache medium through a data cache module, and storing protection data after a power failure protection recovery process;
s106, controlling the power-down protection behavior of the cache data power-down protection system by using a control program through a power-down protection control module;
s107, storing the protection data read by the data cache module by the media storage module by utilizing a cache data power-down protection database of the nonvolatile storage medium;
and S108, updating and displaying the data of each module of the cache data power failure protection system in real time by using a display through an updating and displaying module.
Example 3
The embodiment provides a specific process for detecting the power conditions of the system power supply and the power supply module in real time by using the power detection circuit through the power detection module, as shown in fig. 3, including the following steps:
s201, acquiring a sampling value of the output voltage of the alternating current power supply;
s202, calculating a voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
s203, judging whether the voltage effective value is smaller than a preset threshold value; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
The sampling value for acquiring the output voltage of the alternating current power supply provided by the embodiment of the invention comprises the following steps:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
The method for calculating the effective voltage value of the output voltage according to the sampling value of each sampling point in an alternating current period, provided by the embodiment of the invention, comprises the following steps:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle, calculating the effective voltage value of the output voltage in the alternating current period; the number of the whole-cycle sampling points is the ratio of the ADC sampling frequency of the microcontroller to the alternating current frequency of the alternating current power supply.
Wherein, the calculating the effective voltage value of the output voltage in the present ac cycle includes:
calculating the effective voltage value of the output voltage in the alternating current period according to a preset formula; wherein the preset formula is as follows:
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
Example 4
In this embodiment, the data caching module stores dirty data that resides in the memory and is not written into the disk under normal operation of the system using the data caching medium, and stores the protection data after the power failure protection recovery process, as shown in fig. 4, the method specifically includes the following steps:
s301, when the power supply detection module detects an abnormal power supply signal, the power failure protection control module informs the central control module to complete the current necessary writing process;
s302, cutting off all power supply information in the whole system, and activating a power supply module to supply power to a data cache module, a power failure protection control module and a nonvolatile storage medium;
and S303, after the storage system is started and the application of the to-be-detected protection data is completed, the storage system writes the new protection data into the data cache module.
In the power failure protection process provided by the embodiment of the invention, data only interacts between the data cache module and the nonvolatile storage medium, and does not involve the participation of other parts such as a CPU, a south bridge and a north bridge.
Example 5
In this embodiment, the power fail safeguard behavior of the cache data power fail safeguard system is controlled by the power fail safeguard control module using a control program, as shown in fig. 5, specifically including:
s401, when detecting that a power supply module starts to supply power to a system, a central processing unit sets a memory to be in a read-only mode, sets power-fail protection starting flag positions in memory disks of two controllers to be a first specified value, stores data in all virtual memory disks in the memory disks of the two controllers into corresponding flash memories, and sets a power-fail protection finishing flag position to be a second specified value;
s402, when the power supply of the system is recovered, the central processing unit starts the system and detects the power failure protection starting zone bit and the power failure protection finishing zone bit of the memory disks of the two controllers;
s403, when the central processing unit detects that the power failure protection start flag bits of the two controller memory disks are currently set to a first specified value, and the power failure protection completion flag bits are set to a second specified value, determining that abnormal power failure occurs in both the two controller memory disks before the two controller memory disks are started.
Each controller memory disk provided in the embodiments of the present invention includes a preset number of virtual memory disks.
The invention also provides computer equipment for the power-down protection of the cache data, which comprises a processor and a memory, wherein any method for operating the power-down protection of the cache data is stored in the memory, and the method can be realized by the operation of the processor.
It is another object of the present invention to provide a computer program product stored on a computer readable medium, comprising a computer readable program for providing a user input interface for applying said system for power down protection of cached data when executed on an electronic device.
It is another object of the present invention to provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to apply the system for power down protection of cached data.
Another objective of the present invention is to provide an information data processing terminal, where the information data processing terminal is used to implement the system for power down protection of cache data.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When used in whole or in part, can be implemented in a computer program product that includes one or more computer instructions. When loaded or executed on a computer, cause the flow or functions according to embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.)). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.