技术领域Technical Field
本申请实施例涉及数据处理领域,具体而言,涉及一种数据恢复的方法及存储介质、电子设备、程序产品。The embodiments of the present application relate to the field of data processing, and specifically, to a data recovery method and storage medium, electronic device, and program product.
背景技术Background Art
当磁盘阵列(Redundant Array of Independent Disks,简称为RAID)卡发生异常掉电时,RAID卡的供电切换为备用供电模块(例如,超级电容)供电,备用供电模块可提供有限时间的供电。在备用供电模块供电时,RAID卡缓存中的数据在备用供电模块的供电支持下将备份到非易失性存储介质中,在RAID卡下次正常上电后会把上次异常断电备份到非易失性存储介质中的缓存数据再恢复到缓存中,然后将缓存中的数据存储到磁盘中。When a Redundant Array of Independent Disks (RAID) card loses power abnormally, the power supply of the RAID card is switched to the backup power supply module (for example, a super capacitor), which can provide power for a limited time. When the backup power supply module is supplying power, the data in the cache of the RAID card will be backed up to the non-volatile storage medium with the power supply support of the backup power supply module. When the RAID card is powered on normally next time, the cache data backed up to the non-volatile storage medium during the last abnormal power failure will be restored to the cache, and then the data in the cache will be stored in the disk.
但目前相关技术中的RAID卡的缓存一般为动态随机存取存储器(Dynamic RandomAccess Memory,简称为DRAM),非易失性存储介质为固态硬盘(Solid State Drive,简称为SSD),数据备份时间较长,对备用供电模块的供电能力要求较高,需使用大容量备用供电模块,成本较高。当备用供电模块供电能力出现衰减、不满足RAID卡的供电需求后就需要更换备用供电模块,从而存在数据恢复和数据备份的效率比较低的问题。However, the cache of RAID cards in the current related technologies is generally a dynamic random access memory (DRAM), and the non-volatile storage medium is a solid state drive (SSD). The data backup time is long, and the power supply capacity of the backup power supply module is high. A large-capacity backup power supply module is required, which is expensive. When the power supply capacity of the backup power supply module decays and does not meet the power supply requirements of the RAID card, the backup power supply module needs to be replaced, resulting in a relatively low efficiency of data recovery and data backup.
发明内容Summary of the invention
本申请实施例提供了一种数据恢复的方法及存储介质、电子设备、程序产品,以至少解决相关技术中使用RAID卡进行数据备份时,数据恢复和数据备份效率低的问题。The embodiments of the present application provide a data recovery method and storage medium, electronic device, and program product to at least solve the problem of low efficiency of data recovery and data backup when using a RAID card for data backup in the related art.
根据本申请的一个实施例,提供了一种数据恢复的方法,应用于备份控制装置,上述备份控制装置与RAID卡连接,上述RAID卡与备用供电模块连接,且上述RAID卡中包括N个备份缓存单元,上述备用供电模块是用于给上述RAID卡供电的模块,上述N是大于1的正整数,上述方法包括:在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据,其中,上述目标数据是缓存设备中缓存的数据,上述缓存设备部署在上述RAID卡中;将N个上述子数据分别缓存至N个上述备份缓存单元中;在确定上述RAID卡恢复供电、且上述缓存设备中缓存的上述目标数据出现异常的情况下,将N个上述备份缓存单元中缓存的N个上述子数据恢复至上述缓存设备中。According to an embodiment of the present application, a method for data recovery is provided, which is applied to a backup control device, wherein the backup control device is connected to a RAID card, the RAID card is connected to a backup power supply module, and the RAID card includes N backup cache units, the backup power supply module is a module for supplying power to the RAID card, and N is a positive integer greater than 1. The method includes: when it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, dividing target data into N sub-data, wherein the target data is data cached in a cache device, and the cache device is deployed in the RAID card; caching the N sub-data into the N backup cache units respectively; when it is determined that the RAID card is powered on again and an abnormality occurs to the target data cached in the cache device, restoring the N sub-data cached in the N backup cache units to the cache device.
在一个示例性实施例中,上述备份控制装置中还包括供电监测服务,在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据之前,上述方法包括:获取上述供电监测服务对上述RAID卡的第一监测结果,其中,上述供电监测服务用于监测上述RAID卡的供电情况,上述第一监测结果中包括上述RAID卡的第一供电状态;在从上述第一监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电。In an exemplary embodiment, the backup control device also includes a power supply monitoring service. When it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, before dividing the target data into N sub-data, the method includes: obtaining a first monitoring result of the power supply monitoring service on the RAID card, wherein the power supply monitoring service is used to monitor the power supply status of the RAID card, and the first monitoring result includes a first power supply status of the RAID card; when it is determined from the first monitoring result that the RAID card is in a power-off state, controlling the backup power supply module to supply power to the RAID card.
在一个示例性实施例中,上述备份控制装置中还包括电量检测服务,上述电量检测服务与上述供电监测服务连接,在从上述监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电,包括:在从上述监测结果中确定上述RAID卡处于上述断电状态的情况下,获取上述电量检测服务的检测结果,并将上述检测结果记录在上述备用供电模块的电量表中,其中,上述电量检测服务用于检测上述备用供电模块的电量状态,上述检测结果包括上述备用供电模块的电量信息;在从上述检测结果中确定上述备用供电模块的电量大于第一预设电量的情况下,上述供电监测服务向供电切换服务发送第一切换指令,其中,上述供电切换服务部署在上述备份控制装置中;上述供电切换服务响应上述第一切换指令,导通上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块通过上述供电电路给上述RAID卡供电。In an exemplary embodiment, the backup control device further includes a power detection service, which is connected to the power supply monitoring service. When it is determined from the monitoring results that the RAID card is in the power-off state, the backup power supply module is controlled to supply power to the RAID card, including: when it is determined from the monitoring results that the RAID card is in the power-off state, the detection result of the power detection service is obtained, and the detection result is recorded in the power meter of the backup power supply module, wherein the power detection service is used to detect the power state of the backup power supply module, and the detection result includes the power information of the backup power supply module; when it is determined from the detection results that the power of the backup power supply module is greater than a first preset power, the power supply monitoring service sends a first switching instruction to the power supply switching service, wherein the power supply switching service is deployed in the backup control device; the power supply switching service responds to the first switching instruction to turn on the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module supplies power to the RAID card through the power supply circuit.
在一个示例性实施例中,在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据,包括:获取上述目标数据的起始物理地址,并按照上述目标数据的起始物理地址从上述缓存设备中读取上述目标数据;基于上述N个备份缓存单元的数量将上述目标数据划分为N个上述子数据,并将N个上述子数据的起始物理地址均存储在上述缓存设备中的数据地址表中。In an exemplary embodiment, when it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, the target data is divided into N sub-data, including: obtaining the starting physical address of the target data, and reading the target data from the cache device according to the starting physical address of the target data; dividing the target data into N sub-data based on the number of the N backup cache units, and storing the starting physical addresses of the N sub-data in the data address table in the cache device.
在一个示例性实施例中,将N个上述子数据分别缓存至N个上述备份缓存单元中,包括:在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中;在确定上述备用供电模块的电量恢复至大于第二预设电量的情况下,将N-1个上述子数据分别缓存至N个上述备份缓存单元中,以使每个上述备份缓存单元中均缓存有完整的上述目标数据,其中,N-1个上述子数据是N个上述子数据中除已经缓存到N个上述备份缓存单元中的子数据之外的其他子数据。In an exemplary embodiment, the N sub-data are cached in the N backup cache units respectively, including: when it is determined that the power of the backup power supply module is less than the second preset power, the N sub-data are cached in the N backup cache units respectively; when it is determined that the power of the backup power supply module is restored to be greater than the second preset power, the N-1 sub-data are cached in the N backup cache units respectively, so that each backup cache unit caches the complete target data, wherein the N-1 sub-data are other sub-data among the N sub-data except the sub-data that have been cached in the N backup cache units.
在一个示例性实施例中,每个上述备份缓存单元中均包括多个缓存分区,在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中,包括:分别获取N个上述子数据的起始物理地址;按照上述起始物理地址并通过第一数据传输总线分别将N个上述子数据传输至第一数据缓冲区;通过第二数据传输总线将上述第一数据缓冲区中缓存的N个上述子数据分别传输至N个上述备份缓存单元中的第一缓存分区中,其中,上述第一缓存分区是多个上述缓存分区中的任一缓存分区。In an exemplary embodiment, each of the above-mentioned backup cache units includes multiple cache partitions. When it is determined that the power of the above-mentioned backup power supply module is less than the second preset power, the N sub-data are cached in the N above-mentioned backup cache units respectively, including: respectively obtaining the starting physical addresses of the N above-mentioned sub-data; respectively transmitting the N above-mentioned sub-data to the first data buffer according to the above-mentioned starting physical addresses and through the first data transmission bus; respectively transmitting the N above-mentioned sub-data cached in the above-mentioned first data buffer to the first cache partitions in the N above-mentioned backup cache units through the second data transmission bus, wherein the above-mentioned first cache partition is any cache partition among the multiple above-mentioned cache partitions.
在一个示例性实施例中,在确定上述备用供电模块的电量恢复至大于第二预设电量的情况下,将N-1个上述子数据分别缓存至N个上述备份缓存单元中,以使每个上述备份缓存单元中均缓存有完整的上述目标数据,包括:通过第二数据传输总线将第一数据缓冲区中缓存的N-1个上述子数据分别传输至N个上述备份缓存单元中的第一缓存分区中。In an exemplary embodiment, when it is determined that the power level of the backup power supply module has recovered to be greater than the second preset power level, the N-1 sub-data are cached in the N backup cache units respectively, so that each of the backup cache units has cached the complete target data, including: transmitting the N-1 sub-data cached in the first data buffer to the first cache partition in the N backup cache units respectively through the second data transmission bus.
在一个示例性实施例中,上述备份控制装置中还包括供电监测服务,在确定上述RAID卡恢复供电、且上述缓存设备中缓存的上述目标数据出现异常的情况下,将N个上述备份缓存单元中缓存的N个上述子数据恢复至上述缓存设备中,包括:获取上述供电监测服务对上述RAID卡的第二监测结果,其中,上述第二监测结果中包括上述RAID卡的第二供电状态;在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,检测上述缓存设备中缓存的上述目标数据的数据状态;在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常的情况下,从N个上述备份缓存单元中读取备份的N个上述子数据;将N个上述备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the backup control device further includes a power supply monitoring service, and when it is determined that the power supply of the RAID card is restored and the target data cached in the cache device is abnormal, the N sub-data cached in the N backup cache units are restored to the cache device, including: obtaining a second monitoring result of the RAID card by the power supply monitoring service, wherein the second monitoring result includes a second power supply state of the RAID card; when it is determined from the second monitoring result that the RAID card is in a state where the power supply has been restored, detecting a data state of the target data cached in the cache device; when it is determined from the data state that the target data cached in the cache device is abnormal, reading the backed-up N sub-data from the N backup cache units; and transmitting the N sub-data cached in the N backup cache units to the cache device to restore the target data in the cache device.
在一个示例性实施例中,获取上述供电监测服务对上述RAID卡的第二监测结果之后,上述方法包括:在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,上述供电监测服务向供电切换服务发送第一断开指令,其中,上述供电切换服务部署在上述备份控制装置中;上述供电切换服务响应上述第一断开指令,以断开上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块停止给上述RAID卡供电。In an exemplary embodiment, after obtaining the second monitoring result of the power supply monitoring service on the RAID card, the method includes: when it is determined from the second monitoring result that the RAID card is in a state where power supply has been restored, the power supply monitoring service sends a first disconnection instruction to the power supply switching service, wherein the power supply switching service is deployed in the backup control device; the power supply switching service responds to the first disconnection instruction to disconnect the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module stops supplying power to the RAID card.
在一个示例性实施例中,将N个上述备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据,包括:通过第三数据传输总线将从第一备份缓存单元中读取的N个上述子数据传输至第二数据缓冲区,其中,所述第一备份缓存单元是N个所述备份缓存单元中的任一备份缓存单元;通过第四数据传输总线将上述第二数据缓冲区中的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the N sub-data cached in the N backup cache units are transferred to the cache device to restore the target data in the cache device, including: transferring the N sub-data read from the first backup cache unit to the second data buffer via a third data transfer bus, wherein the first backup cache unit is any one of the N backup cache units; transferring the N sub-data in the second data buffer to the cache device via a fourth data transfer bus to restore the target data in the cache device.
在一个示例性实施例中,每个上述备份缓存单元中均包括多个缓存分区,通过第三数据传输总线将从上述第一备份缓存单元中读取的N个上述子数据传输至第二数据缓冲区,包括:从第一缓存分区中读取N个上述子数据,其中,所述第一缓存分区中的N个所述子数据是所述第一备份缓存单元传输的子数据;通过第三数据传输总线将从上述第一缓存分区中读取的N个上述子数据中传输至上述第二数据缓冲区。In an exemplary embodiment, each of the above-mentioned backup cache units includes multiple cache partitions, and the N above-mentioned sub-data read from the above-mentioned first backup cache unit are transmitted to the second data buffer through the third data transmission bus, including: reading the N above-mentioned sub-data from the first cache partition, wherein the N above-mentioned sub-data in the first cache partition are the sub-data transmitted by the first backup cache unit; and transmitting the N above-mentioned sub-data read from the above-mentioned first cache partition to the above-mentioned second data buffer through the third data transmission bus.
在一个示例性实施例中,在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常的情况下,从第一备份缓存单元中读取备份的N个上述子数据之前,上述方法还包括:在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常,且上述第一备份缓存单元出现异常时,检测第二备份缓存单元中是否已缓存N个上述子数据,其中,上述第二备份缓存单元是N个上述备份缓存单元中处于正常状态的任一备份缓存单元;在确定上述第二备份缓存单元中已缓存N个上述子数据的情况下,从第二备份缓存单元中读取备份的N个上述子数据;将上述第二备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, when it is determined from the data state that the target data cached in the cache device is abnormal, before reading the backed-up N sub-data from the first backup cache unit, the method further includes: when it is determined from the data state that the target data cached in the cache device is abnormal and the first backup cache unit is abnormal, detecting whether the N sub-data have been cached in the second backup cache unit, wherein the second backup cache unit is any backup cache unit in the N backup cache units that is in a normal state; when it is determined that the N sub-data have been cached in the second backup cache unit, reading the backed-up N sub-data from the second backup cache unit; and transferring the N sub-data cached in the second backup cache unit to the cache device to restore the target data in the cache device.
根据本申请的又一个实施例,还提供了一种计算机可读存储介质,上述计算机可读存储介质中存储有计算机程序,其中,上述计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
根据本申请的又一个实施例,还提供了一种电子设备,包括存储器和处理器,上述存储器中存储有计算机程序,上述处理器被设置为运行上述计算机程序以执行上述任一项方法实施例中的步骤。According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
根据本申请的又一个实施例,还提供了一种计算机程序产品,包括计算机程序,上述计算机程序被处理器执行时实现上述任一项方法实施例中的步骤。According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
通过本申请,在备份控制装置确定RAID卡断电且备用供电模块给RAID卡供电后,通过将待备份数据划分为多个子数据,并将多个子数据分别缓存至RAID卡中的多个备份缓存单元中,可以实现在备用供电模块的供电电量一定的情况下,快速的在多个备份缓存单元中缓存完整的目标数据。使得在缓存设备中缓存的目标数据出现异常的情况下,可以在RAID卡恢复供电后快速的将多个备份缓存单元中缓存的完整的目标数据恢复到缓存设备中。因此,可以解决相关技术中使用RAID卡进行数据备份时数据备份时间长,数据恢复和数据备份效率低的问题,达到提高数据恢复和数据备份效率的效果。Through the present application, after the backup control device determines that the RAID card is powered off and the backup power supply module supplies power to the RAID card, by dividing the data to be backed up into multiple sub-data, and caching the multiple sub-data into multiple backup cache units in the RAID card respectively, it is possible to quickly cache the complete target data in multiple backup cache units when the power supply of the backup power supply module is constant. When an abnormality occurs to the target data cached in the cache device, the complete target data cached in the multiple backup cache units can be quickly restored to the cache device after the RAID card resumes power. Therefore, the problems of long data backup time, low data recovery and data backup efficiency when using a RAID card for data backup in the related art can be solved, thereby achieving the effect of improving data recovery and data backup efficiency.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是根据本申请实施例的一种数据恢复的方法的硬件环境示意图;FIG1 is a schematic diagram of a hardware environment of a data recovery method according to an embodiment of the present application;
图2是根据本申请实施例的一种数据恢复的方法的流程图;FIG2 is a flow chart of a method for data recovery according to an embodiment of the present application;
图3是根据本申请实施例的一种缓存目标数据的示意图;FIG3 is a schematic diagram of caching target data according to an embodiment of the present application;
图4是根据本申请实施例的一种备份缓存单元分区示意图;FIG4 is a schematic diagram of a partition of a backup cache unit according to an embodiment of the present application;
图5是根据本申请实施例的一种RAID卡备电硬件框图;FIG5 is a hardware block diagram of a RAID card backup power supply according to an embodiment of the present application;
图6是根据本申请实施例的一种目标数据缓存流程示意图;FIG6 is a schematic diagram of a target data caching process according to an embodiment of the present application;
图7是根据本申请实施例的一种数据恢复的装置的结构框图。FIG. 7 is a structural block diagram of a data recovery device according to an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
下文中将参考附图并结合实施例来详细说明本申请的实施例。The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
本申请实施例中所提供的方法实施例可以在服务器设备或者类似的运算装置中执行。以运行在服务器设备上为例,图1是本申请实施例的一种数据恢复的方法的硬件环境示意图。如图1所示,服务器设备可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,其中,上述服务器设备还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述服务器设备的结构造成限定。例如,服务器设备还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, FIG1 is a hardware environment diagram of a method for data recovery in an embodiment of the present application. As shown in FIG1 , the server device may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that the structure shown in FIG1 is only for illustration and does not limit the structure of the above-mentioned server device. For example, the server device may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本申请实施例中的数据恢复的方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至服务器设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for data recovery in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
传输设备106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括服务器设备的通信供应方提供的无线网络。在一个实例中,传输设备106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
在本实施例中提供了一种数据恢复的方法,图2是根据本申请实施例的数据恢复的方法的流程图,如图2所示,该流程包括如下步骤:In this embodiment, a method for data recovery is provided. FIG. 2 is a flow chart of the method for data recovery according to an embodiment of the present application. As shown in FIG. 2 , the flow chart includes the following steps:
步骤S202,在确定RAID卡断电且备用供电模块处于给RAID卡供电的状态情况下,将目标数据划分为N个子数据,其中,上述目标数据是缓存设备中缓存的数据,上述缓存设备部署在上述RAID卡中;Step S202, when it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, dividing the target data into N sub-data, wherein the target data is data cached in a cache device, and the cache device is deployed in the RAID card;
步骤S204,将N个子数据分别缓存至N个备份缓存单元中;Step S204, caching the N sub-data into N backup cache units respectively;
步骤S206,在确定RAID卡恢复供电、且缓存设备中缓存的目标数据出现异常的情况下,将N个备份缓存单元中缓存的N个子数据恢复至缓存设备中。Step S206, when it is determined that the RAID card is powered on again and the target data cached in the cache device is abnormal, the N sub-data cached in the N backup cache units are restored to the cache device.
可选地,在本实施例中,备用供电模块是用于在RAID卡断电的情况下,给RAID卡临时供电的模块,包括但不限于是:超级电容、锂电池、备用电源组、备用电池组等。Optionally, in this embodiment, the backup power supply module is a module used to temporarily power the RAID card when the RAID card is powered off, including but not limited to: a super capacitor, a lithium battery, a backup power supply group, a backup battery group, etc.
可选地,在本实施例中,RAID卡中的备份缓存单元是非易失性存储介质,包括但不限于是:闪存Flash、Flash中NAND Flash、Flash中的NOR Flash、带电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,简称为EEPROM)等。Optionally, in this embodiment, the backup cache unit in the RAID card is a non-volatile storage medium, including but not limited to: Flash, NAND Flash in Flash, NOR Flash in Flash, Electrically Erasable Programmable Read-Only Memory (EEPROM), etc.
可选地,在本实施例中,将目标数据划分为N个子数据的方式包括但不限于是:以预设的数据大小划分目标数据、按照目标数据的存储地址划分等。Optionally, in this embodiment, the method of dividing the target data into N sub-data includes but is not limited to: dividing the target data according to a preset data size, dividing according to the storage address of the target data, etc.
例如,图3是根据本申请实施例的一种缓存目标数据的示意图,如图3所示,在一个缓存静态随机存取存储器(Static Random Access Memory,简称为SRAM)中,按照数据的存储地址将其划分为两部分。具体的,SRAM的存储空间为16MB,其存储的起始物理地址是0x01000000H,则其最后一个物理地址是 0x01FFFFFFFH,按照数据的存储地址将目标数据划分为两部分,即物理地址在0x01000000H~0x01800000H之内的数据是第一部分数据,物理地址在0x01800000H~0x01FFFFFFFH之内的数据是第二部分数据。For example, FIG3 is a schematic diagram of a cache target data according to an embodiment of the present application. As shown in FIG3, in a cache static random access memory (SRAM), the data is divided into two parts according to the storage address. Specifically, the storage space of the SRAM is 16MB, and the starting physical address of its storage is 0x01000000H, then its last physical address is 0x01FFFFFFFH, and the target data is divided into two parts according to the storage address of the data, that is, the data with a physical address within 0x01000000H~0x01800000H is the first part of the data, and the data with a physical address within 0x01800000H~0x01FFFFFFFH is the second part of the data.
通过本申请,在备份控制装置确定RAID卡断电且备用供电模块给RAID卡供电后,通过将待备份数据划分为多个子数据,并将多个子数据分别缓存至RAID卡中的多个备份缓存单元中,可以实现在备用供电模块的供电电量一定的情况下,快速的在多个备份缓存单元中缓存完整的目标数据。使得在缓存设备中缓存的目标数据出现异常的情况下,可以在RAID卡恢复供电后快速的将多个备份缓存单元中缓存的完整的目标数据恢复到缓存设备中。因此,可以解决相关技术中使用RAID卡进行数据备份时数据备份时间长,数据恢复和数据备份效率低的问题,达到提高数据恢复和数据备份效率的效果。Through the present application, after the backup control device determines that the RAID card is powered off and the backup power supply module supplies power to the RAID card, by dividing the data to be backed up into multiple sub-data, and caching the multiple sub-data into multiple backup cache units in the RAID card respectively, it is possible to quickly cache the complete target data in multiple backup cache units when the power supply of the backup power supply module is constant. When an abnormality occurs to the target data cached in the cache device, the complete target data cached in the multiple backup cache units can be quickly restored to the cache device after the RAID card resumes power. Therefore, the problems of long data backup time, low data recovery and data backup efficiency when using a RAID card for data backup in the related art can be solved, thereby achieving the effect of improving data recovery and data backup efficiency.
在一个示例性实施例中,上述备份控制装置中还包括供电监测服务,在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据之前,上述方法包括:获取上述供电监测服务对上述RAID卡的第一监测结果,其中,上述供电监测服务用于监测上述RAID卡的供电情况,上述第一监测结果中包括上述RAID卡的第一供电状态;在从上述第一监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电。In an exemplary embodiment, the backup control device also includes a power supply monitoring service. When it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, before dividing the target data into N sub-data, the method includes: obtaining a first monitoring result of the power supply monitoring service on the RAID card, wherein the power supply monitoring service is used to monitor the power supply status of the RAID card, and the first monitoring result includes a first power supply status of the RAID card; when it is determined from the first monitoring result that the RAID card is in a power-off state, controlling the backup power supply module to supply power to the RAID card.
可选地,在本实施例中,供电监测服务用于监测上述RAID卡的供电情况,供电监测服务中包括但不限于有:电压传感器、电流传感器、脉冲信号传感器等,供电监测服务会预先确定RAID卡正常工作所需的最小电压阈值,之后利用电压传感器实时监测与电源相关的线路上的电压水平,将实时监测到的电压值与预设的阈值进行比较,如果监测到的电压低于阈值,并且持续一段时间,可以判断为RAID卡处于断电状态;供电监测服务通过脉冲信号传感器实时监测与电源相关的线路上的脉冲信号,当脉冲信号出现由高到低的情况且在一段时间内,脉冲信号处于低脉冲,可以判断为RAID卡处于断电状态。Optionally, in this embodiment, a power supply monitoring service is used to monitor the power supply status of the above-mentioned RAID card. The power supply monitoring service includes but is not limited to: voltage sensors, current sensors, pulse signal sensors, etc. The power supply monitoring service will predetermine the minimum voltage threshold required for the normal operation of the RAID card, and then use the voltage sensor to monitor the voltage level on the power supply-related lines in real time, and compare the real-time monitored voltage value with the preset threshold. If the monitored voltage is lower than the threshold and lasts for a period of time, it can be determined that the RAID card is in a power-off state; the power supply monitoring service monitors the pulse signal on the power supply-related lines in real time through the pulse signal sensor. When the pulse signal changes from high to low and the pulse signal is in a low pulse for a period of time, it can be determined that the RAID card is in a power-off state.
可选地,在本实施例中,第一监测结果中包括但不限于记录当前RAID卡的编号、RAID卡的供电状态、监测的时间等。Optionally, in this embodiment, the first monitoring result includes but is not limited to recording the number of the current RAID card, the power supply status of the RAID card, the monitoring time, etc.
通过上述步骤,根据供电监测服务实时监测RAID卡的供电情况,并发送监测结果,根据监测结果确定RAID卡的供电状态,若RAID卡处于断电状态,控制备用供电模块为RAID卡供电,实现了在RAID卡处于异常掉电情况下,也可以保证RAID卡正常运行的效果。Through the above steps, the power supply status of the RAID card is monitored in real time according to the power supply monitoring service, and the monitoring results are sent. The power supply status of the RAID card is determined according to the monitoring results. If the RAID card is in a power-off state, the standby power supply module is controlled to supply power to the RAID card, thereby ensuring the normal operation of the RAID card when the RAID card is in an abnormal power-off state.
在一个示例性实施例中,上述备份控制装置中还包括电量检测服务,上述电量检测服务与上述供电监测服务连接,在从上述监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电,包括:在从上述监测结果中确定上述RAID卡处于上述断电状态的情况下,获取上述电量检测服务的检测结果,并将上述检测结果记录在上述备用供电模块的电量表中,其中,上述电量检测服务用于检测上述备用供电模块的电量状态,上述检测结果包括上述备用供电模块的电量信息;在从上述检测结果中确定上述备用供电模块的电量大于第一预设电量的情况下,上述供电监测服务向供电切换服务发送第一切换指令,其中,上述供电切换服务部署在上述备份控制装置中;上述供电切换服务响应上述第一切换指令,导通上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块通过上述供电电路给上述RAID卡供电。In an exemplary embodiment, the backup control device further includes a power detection service, which is connected to the power supply monitoring service. When it is determined from the monitoring results that the RAID card is in the power-off state, the backup power supply module is controlled to supply power to the RAID card, including: when it is determined from the monitoring results that the RAID card is in the power-off state, the detection result of the power detection service is obtained, and the detection result is recorded in the power meter of the backup power supply module, wherein the power detection service is used to detect the power state of the backup power supply module, and the detection result includes the power information of the backup power supply module; when it is determined from the detection results that the power of the backup power supply module is greater than a first preset power, the power supply monitoring service sends a first switching instruction to the power supply switching service, wherein the power supply switching service is deployed in the backup control device; the power supply switching service responds to the first switching instruction to turn on the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module supplies power to the RAID card through the power supply circuit.
可选地,在本实施例中,电量检测服务用于检测备用供电模块的电量情况,电量检测服务在检测时使用的方法包括但不限于是:负载测试,将备用供电模块连接到一个稳定的负载(例如,电阻),测量在一定时间内电流的变化,从而估计备用供电模块的电量;使用与备用供电模块对应的测试仪确定备用供电模块的电量等。Optionally, in this embodiment, the power detection service is used to detect the power status of the backup power supply module. The methods used by the power detection service during detection include but are not limited to: load testing, connecting the backup power supply module to a stable load (for example, a resistor), and measuring the change in current over a certain period of time, thereby estimating the power status of the backup power supply module; using a tester corresponding to the backup power supply module to determine the power status of the backup power supply module, etc.
可选地,在本实施例中,电量表中除了记录备用供电模块的电量信息之外,还可以记录备用供电模块的编号、电量检测时间等。Optionally, in this embodiment, in addition to recording the power information of the standby power supply module, the power meter may also record the serial number of the standby power supply module, power detection time, etc.
可选地,在本实施例中,第一预设电量是满足为RAID卡进行供电的最低电量要求的预设电量,根据RAID卡厂商给出的数值或者预先测试为RAID卡进行供电时,需要的最低电量数值确定第一预设电量。Optionally, in this embodiment, the first preset power is a preset power that meets the minimum power requirement for powering the RAID card. The first preset power is determined according to a value provided by the RAID card manufacturer or a minimum power value required when powering the RAID card in a pre-test.
可选地,在本实施例中,第一切换指令是用于导通备用供电模块与RAID卡之间的供电电路的指令,第一切换指令中包括但不限于备用供电模块的编号、RAID卡的编号、以及表示导通备用供电模块与RAID卡之间的供电电路的指令编码等。Optionally, in this embodiment, the first switching instruction is an instruction for turning on the power supply circuit between the backup power supply module and the RAID card. The first switching instruction includes but is not limited to the number of the backup power supply module, the number of the RAID card, and an instruction code indicating turning on the power supply circuit between the backup power supply module and the RAID card.
通过上述步骤,确定备用供电模块的电量满足为RAID卡进行供电,通过第一切换指令确定需要进行电源切换的操作,利用备用供电模块为RAID供电,实现了在电源故障或意外断电情况下,保护RAID卡和缓存中的数据,防止数据丢失或损坏的效果。Through the above steps, it is determined that the power of the backup power supply module is sufficient to power the RAID card, the need for power switching is determined through the first switching instruction, and the backup power supply module is used to power the RAID, thereby protecting the data in the RAID card and cache and preventing data loss or damage in the event of a power failure or accidental power outage.
在一个示例性实施例中,在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据,包括:获取上述目标数据的起始物理地址,并按照上述目标数据的起始物理地址从上述缓存设备中读取上述目标数据;基于上述N个备份缓存单元的数量将上述目标数据划分为N个上述子数据,并将N个上述子数据的起始物理地址均存储在上述缓存设备中的数据地址表中。In an exemplary embodiment, when it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, the target data is divided into N sub-data, including: obtaining the starting physical address of the target data, and reading the target data from the cache device according to the starting physical address of the target data; dividing the target data into N sub-data based on the number of the N backup cache units, and storing the starting physical addresses of the N sub-data in the data address table in the cache device.
可选地,在本实施例中,将目标数据划分为N个子数据的方式在上述已经描述过,在此不再赘述。Optionally, in this embodiment, the method of dividing the target data into N sub-data has been described above and will not be repeated here.
可选地,在本实施例中,数据地址表中除了存储N个上述子数据的起始物理地址之外,还存储了与每一个子数据的起始物理地址对应的第一次存放的备份缓存单元的编号。Optionally, in this embodiment, in addition to storing the starting physical addresses of the N sub-data, the data address table also stores the serial number of the first stored backup cache unit corresponding to the starting physical address of each sub-data.
通过上述步骤,获取所述目标数据的起始物理地址并读取数据,将目标数据划分为N个子数据,同时记录N个子数据的其实物理位置,为后续目标数据缓存到N个备份缓存单元以及目标数据恢复提供了并行传输的必要条件,从而可以实现提高数据缓存效率的目的。Through the above steps, the starting physical address of the target data is obtained and the data is read, the target data is divided into N sub-data, and the actual physical locations of the N sub-data are recorded at the same time, which provides the necessary conditions for parallel transmission for subsequent target data caching to N backup cache units and target data recovery, thereby achieving the purpose of improving data caching efficiency.
在一个示例性实施例中,将N个上述子数据分别缓存至N个上述备份缓存单元中,包括:在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中;在确定上述备用供电模块的电量恢复至大于第二预设电量的情况下,将N-1个上述子数据分别缓存至N个上述备份缓存单元中,以使每个上述备份缓存单元中均缓存有完整的上述目标数据,其中,N-1个上述子数据是N个上述子数据中除已经缓存到N个上述备份缓存单元中的子数据之外的其他子数据。In an exemplary embodiment, the N sub-data are cached in the N backup cache units respectively, including: when it is determined that the power of the backup power supply module is less than the second preset power, the N sub-data are cached in the N backup cache units respectively; when it is determined that the power of the backup power supply module is restored to be greater than the second preset power, the N-1 sub-data are cached in the N backup cache units respectively, so that each backup cache unit caches the complete target data, wherein the N-1 sub-data are other sub-data among the N sub-data except the sub-data that have been cached in the N backup cache units.
可选地,在本实施例中,第二预设电量是不满足将缓存设备中的目标数据全部备份到N个缓存单元中(每一个缓存单元中拥有一份完整的目标数据)的电量。可以根据RAID卡厂商给出的数值,或者,预先测试能够将缓存设备中的目标数据全部备份到N个缓存单元中(每一个缓存单元中拥有一份完整的目标数据)需要的最低电量数值,确定第二预设电量。Optionally, in this embodiment, the second preset power is the power that is not sufficient to back up all the target data in the cache device to N cache units (each cache unit has a complete copy of the target data). The second preset power can be determined based on the value provided by the RAID card manufacturer, or by pre-testing the minimum power value required to back up all the target data in the cache device to N cache units (each cache unit has a complete copy of the target data).
通过上述步骤,根据备用供电模块的电量状态确定是否将目标数据全部缓存到N个备份缓存单元里,选择不同的数据缓存方案,可以有效提高目标数据缓存效率,同时也实现了在备用供电模块电量不足的情况下也能继续进行数据缓存,提高了备用供电模块的利用率。Through the above steps, whether to cache all target data into N backup cache units is determined according to the power status of the backup power supply module, and different data caching schemes are selected, which can effectively improve the target data caching efficiency. At the same time, it also enables data caching to continue when the backup power supply module is insufficient, thereby improving the utilization rate of the backup power supply module.
在一个示例性实施例中,每个上述备份缓存单元中均包括多个缓存分区,在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中,包括:分别获取N个上述子数据的起始物理地址;按照上述起始物理地址并通过第一数据传输总线分别将N个上述子数据传输至第一数据缓冲区;通过第二数据传输总线将上述第一数据缓冲区中缓存的N个上述子数据分别传输至N个上述备份缓存单元中的第一缓存分区中,其中,上述第一缓存分区是多个上述缓存分区中的任一缓存分区。In an exemplary embodiment, each of the above-mentioned backup cache units includes multiple cache partitions. When it is determined that the power of the above-mentioned backup power supply module is less than the second preset power, the N sub-data are cached in the N above-mentioned backup cache units respectively, including: respectively obtaining the starting physical addresses of the N above-mentioned sub-data; respectively transmitting the N above-mentioned sub-data to the first data buffer according to the above-mentioned starting physical addresses and through the first data transmission bus; respectively transmitting the N above-mentioned sub-data cached in the above-mentioned first data buffer to the first cache partitions in the N above-mentioned backup cache units through the second data transmission bus, wherein the above-mentioned first cache partition is any cache partition among the multiple above-mentioned cache partitions.
可选地,在本实施例中,备份缓存单元中的多个缓存分区是通过软件进行划分的,每个备份缓存单元中的多个缓存分区是根据缓存设备中的目标数据的大小进行划分的,N个备份缓存单元同一分区的总大小应大于目标数据的大小,考虑到备份缓存单元实际的使用情况以及备份缓存单元自身的使用特性,还可以在N个备份缓存单元中预留同样大小的空间;Optionally, in this embodiment, the multiple cache partitions in the backup cache unit are divided by software, and the multiple cache partitions in each backup cache unit are divided according to the size of the target data in the cache device. The total size of the same partition of the N backup cache units should be larger than the size of the target data. Considering the actual usage of the backup cache unit and the usage characteristics of the backup cache unit itself, the same size of space can also be reserved in the N backup cache units;
例如,图4是根据本申请实施例的一种备份缓存单元分区示意图,如图4所示,对四线串行外设接口NAND型闪存存储器(Quad Serial Peripheral Interface NAND FlashMemory,简称为QSPI NAND Flash)进行分区操作,将其划分为分区0~分区9共10个分区,2片Flash同一分区的总大小大于目标数据的大小,同时考虑到NAND可能出现的坏块因素,再为坏块做一定空间预留。For example, Figure 4 is a schematic diagram of a backup cache unit partition according to an embodiment of the present application. As shown in Figure 4, a partition operation is performed on a quad serial peripheral interface NAND flash memory (Quad Serial Peripheral Interface NAND FlashMemory, referred to as QSPI NAND Flash) and it is divided into 10 partitions from partition 0 to partition 9. The total size of the same partition of two Flash chips is larger than the size of the target data. At the same time, considering the bad block factors that may appear in NAND, a certain amount of space is reserved for the bad blocks.
可选地,在本实施例中,第一数据传输总线和第二数据传输总线的类型可以根据实际传输到的单元或者分区进行确定,第一数据传输总线可以是DMA总线,可以实现数据高速传输的数据传输总线;第二数据传输总线可以是高速串行总线,例如,周边组件互连快速通道(Peripheral Component Interconnect Express,简称为PCIe)等。Optionally, in this embodiment, the types of the first data transmission bus and the second data transmission bus can be determined according to the unit or partition actually transmitted to. The first data transmission bus can be a DMA bus, which is a data transmission bus that can realize high-speed data transmission; the second data transmission bus can be a high-speed serial bus, for example, Peripheral Component Interconnect Express (PCIe), etc.
可选地,在本实施例中,数据缓冲区用于解决缓存设备中的目标数据传输到目标缓存单元时数据传输速度不匹配的问题,数据缓冲区的类型可以是:随机存储器(RandomAccess Memory,简称为RAM)等。Optionally, in this embodiment, the data buffer is used to solve the problem of data transmission speed mismatch when the target data in the cache device is transferred to the target cache unit. The type of the data buffer may be random access memory (RAM) and the like.
例如,图5是根据本申请实施例的一种RAID卡备电硬件框图,如图5所示,备用供电模块是超级电容,第一数据传输总线是DMA总线,第二数据传输总线是QSPI总线,数据缓冲区是QSPI Controller 中的先进先出(First In First Out,简称为FIFO)模块,其中,QSPIController在管理软件(Management Software,简称为MS)即RAID卡控制芯片集成的负责备电业务的子系统中,目标缓存单元是QSPI NAND Flash。在进行目标数据缓存操作时,DMA总线将SRAM中存储的数据传输至QSPI Controller中的FIFO模块,之后QSPI总线会从QSPINAND Flash中读取其存储的N个子数据,并将其分别传输至QSPI NAND Flash中,实现目标数据的备份。For example, FIG5 is a hardware block diagram of a RAID card backup power supply according to an embodiment of the present application. As shown in FIG5, the backup power supply module is a super capacitor, the first data transmission bus is a DMA bus, the second data transmission bus is a QSPI bus, and the data buffer is a First In First Out (FIFO) module in the QSPI Controller, wherein the QSPI Controller is a subsystem responsible for the backup power supply service integrated in the management software (MS), i.e., the RAID card control chip, and the target cache unit is the QSPI NAND Flash. When performing the target data caching operation, the DMA bus transfers the data stored in the SRAM to the FIFO module in the QSPI Controller, and then the QSPI bus reads the N sub-data stored in the QSPINAND Flash and transfers them to the QSPI NAND Flash respectively to realize the backup of the target data.
通过上述步骤,根据N个子数据的起始物理地址读取子数据并将其传输至对应的数据缓冲区,之后再从数据缓冲区中读取数据,将其传输至目标缓存单元中,解决了缓存设备中的目标数据传输到目标缓存单元时数据传输速度不匹配的问题,实现了数据的备份。Through the above steps, the sub-data is read according to the starting physical addresses of N sub-data and transferred to the corresponding data buffer, and then the data is read from the data buffer and transferred to the target cache unit, which solves the problem of data transmission speed mismatch when the target data in the cache device is transferred to the target cache unit, and realizes data backup.
在一个示例性实施例中,在确定上述备用供电模块的电量恢复至大于第三预设电量的情况下,将N-1个上述子数据分别缓存至N个上述备份缓存单元中,以使每个上述备份缓存单元中均缓存有完整的上述目标数据,包括:通过第二数据传输总线将第一数据缓冲区中缓存的N-1个上述子数据分别传输至N个上述备份缓存单元中的第一缓存分区中。In an exemplary embodiment, when it is determined that the power level of the backup power supply module has recovered to be greater than the third preset power level, the N-1 sub-data are cached in the N backup cache units respectively, so that each of the backup cache units has cached the complete target data, including: transmitting the N-1 sub-data cached in the first data buffer to the first cache partition in the N backup cache units respectively through the second data transmission bus.
可选地,在本实施例中,第二数据传输总线的类型在上述已经描述过,在此不再赘述。Optionally, in this embodiment, the type of the second data transmission bus has been described above and will not be repeated here.
可选地,在本实施例中,数据缓冲区的类型在上述已经描述过,在此不再赘述。Optionally, in this embodiment, the type of the data buffer has been described above and will not be repeated here.
通过上述步骤,实现了将数据缓冲区中的之前未在对应的备份缓存单元里存储的N-1个子数据的缓存,实现了N个备份缓冲区都存储有一份完整的目标数据,达到了RAID1冗余备份的效果。Through the above steps, the N-1 sub-data in the data buffer that were not previously stored in the corresponding backup cache unit are cached, and each of the N backup buffers stores a complete copy of the target data, achieving the effect of RAID1 redundant backup.
在一个示例性实施例中,上述备份控制装置中还包括供电监测服务,在确定上述RAID卡恢复供电、且上述缓存设备中缓存的上述目标数据出现异常的情况下,将N个上述备份缓存单元中缓存的N个上述子数据恢复至上述缓存设备中,包括:获取上述供电监测服务对上述RAID卡的第二监测结果,其中,上述第二监测结果中包括上述RAID卡的第二供电状态;在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,检测上述缓存设备中缓存的上述目标数据的数据状态;在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常的情况下,从N个上述备份缓存单元中读取备份的N个上述子数据;将N个上述备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the backup control device further includes a power supply monitoring service, and when it is determined that the power supply of the RAID card is restored and the target data cached in the cache device is abnormal, the N sub-data cached in the N backup cache units are restored to the cache device, including: obtaining a second monitoring result of the RAID card by the power supply monitoring service, wherein the second monitoring result includes a second power supply state of the RAID card; when it is determined from the second monitoring result that the RAID card is in a state where the power supply has been restored, detecting a data state of the target data cached in the cache device; when it is determined from the data state that the target data cached in the cache device is abnormal, reading the backed-up N sub-data from the N backup cache units; and transmitting the N sub-data cached in the N backup cache units to the cache device to restore the target data in the cache device.
可选地,在本实施例中,供电监测服务用于监测上述RAID卡的供电情况,供电监测服务中包括的器件在上述已经描述过,在此不再赘述。Optionally, in this embodiment, the power supply monitoring service is used to monitor the power supply status of the above-mentioned RAID card. The components included in the power supply monitoring service have been described above and will not be repeated here.
可选地,在本实施例中,第二监测结果中包括但不限于记录当前RAID卡的编号、RAID卡的供电状态、监测的时间等。Optionally, in this embodiment, the second monitoring result includes but is not limited to recording the number of the current RAID card, the power supply status of the RAID card, the monitoring time, etc.
可选地,在本实施例中,检测缓存设备中缓存的目标数据的数据状态的方法包括但不限于是使用软件进行检测。例如,当缓存设备中目标数据缓存在SRAM中,通过软件对SRAM进行检测,判断在使用过程中是否存在因为存储单元损坏而导致数据出错等其他问题,检测缓存设备中缓存的目标数据的数据状态。Optionally, in this embodiment, the method for detecting the data state of the target data cached in the cache device includes but is not limited to using software for detection. For example, when the target data in the cache device is cached in SRAM, the SRAM is detected by software to determine whether there are other problems such as data errors caused by damage to the storage unit during use, and the data state of the target data cached in the cache device is detected.
通过上述步骤,在RAID卡处于已经恢复供电的状态且缓存设备中缓存的所述目标数据出现异常的情况下进行数据恢复,将N个备份缓存单元中缓存的N个子数据传输至缓存设备中,使缓存设备中存储有完整的目标数据,实现了目标数据的恢复,通过对相关情况的判断再进行数据恢复避免了非必要的数据恢复操作,减少了对相关硬件资源的消耗。Through the above steps, when the RAID card is in a state where power is restored and the target data cached in the cache device is abnormal, data recovery is performed, and the N sub-data cached in the N backup cache units are transferred to the cache device, so that the cache device stores complete target data, thereby realizing recovery of the target data. By judging the relevant situation and then performing data recovery, unnecessary data recovery operations are avoided, and the consumption of related hardware resources is reduced.
在一个示例性实施例中,获取上述供电监测服务对上述RAID卡的第二监测结果之后,上述方法包括:在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,上述供电监测服务向供电切换服务发送第一断开指令,其中,上述供电切换服务部署在上述备份控制装置中;上述供电切换服务响应上述第一断开指令,以断开上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块停止给上述RAID卡供电。In an exemplary embodiment, after obtaining the second monitoring result of the power supply monitoring service on the RAID card, the method includes: when it is determined from the second monitoring result that the RAID card is in a state where power supply has been restored, the power supply monitoring service sends a first disconnection instruction to the power supply switching service, wherein the power supply switching service is deployed in the backup control device; the power supply switching service responds to the first disconnection instruction to disconnect the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module stops supplying power to the RAID card.
可选地,在本实施例中,第二监测结果中包括的内容在上述已经描述过,在此不再赘述。Optionally, in this embodiment, the content included in the second monitoring result has been described above and will not be repeated here.
可选地,在本实施例中,第一断开指令是用于断开备用供电模块与RAID卡之间的供电电路的指令,第一断开指令中包括但不限于备用供电模块的编号、RAID卡的编号、以及表示断开备用供电模块与RAID卡之间的供电电路的指令编码等。Optionally, in this embodiment, the first disconnect instruction is an instruction for disconnecting the power supply circuit between the backup power supply module and the RAID card. The first disconnect instruction includes but is not limited to the number of the backup power supply module, the number of the RAID card, and an instruction code indicating disconnecting the power supply circuit between the backup power supply module and the RAID card.
通过上述步骤,确定RAID卡已经恢复正常供电状态时,通过第一断开指令确定需要执行断开备用供电模块与RAID卡之间的供电电路的操作,实现了在RAID卡处于正常供电的情况下,及时切断备用供电模块对RAID卡的供电,减少了对备用供电模块电量的消耗,提高了备用供电模块的使用次数。Through the above steps, when it is determined that the RAID card has restored to a normal power supply state, the first disconnection instruction determines that an operation of disconnecting the power supply circuit between the backup power supply module and the RAID card needs to be executed, thereby achieving timely cutting off the power supply of the RAID card by the backup power supply module when the RAID card is in a normal power supply state, reducing the power consumption of the backup power supply module and increasing the number of times the backup power supply module is used.
在一个示例性实施例中,将N个上述备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据,包括:通过第三数据传输总线将从第一备份缓存单元中读取的N个上述子数据传输至第二数据缓冲区,其中,所述第一备份缓存单元是N个所述备份缓存单元中的任一备份缓存单元;通过第四数据传输总线将上述第二数据缓冲区中的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the N sub-data cached in the N backup cache units are transferred to the cache device to restore the target data in the cache device, including: transferring the N sub-data read from the first backup cache unit to the second data buffer via a third data transfer bus, wherein the first backup cache unit is any one of the N backup cache units; transferring the N sub-data in the second data buffer to the cache device via a fourth data transfer bus to restore the target data in the cache device.
可选地,在本实施例中,第三数据传输总线和第四数据传输总线的类型和上述第一数据传输总线和第二数据传输总线的类型相同,已在上述描述过,在此不做赘述。Optionally, in this embodiment, the types of the third data transmission bus and the fourth data transmission bus are the same as the types of the first data transmission bus and the second data transmission bus, which have been described above and will not be repeated here.
可选地,在本实施例中,数据缓冲区的类型已在上述描述过,在此不再赘述。Optionally, in this embodiment, the type of the data buffer has been described above and will not be repeated here.
本实施例在缓存设备中恢复目标数据的过程如图5所示,在进行数据恢复操作时,QSPI总线会先从QSPI NAND Flash中读取其存储的第一子数据,并将其传输至QSPIController中的 FIFO模块里,之后通过DMA总线将QSPI Controller中的FIFO模块里存储的完整的目标数据传输至SRAM中,从而实现了对目标数据的恢复。The process of recovering the target data in the cache device of this embodiment is shown in FIG5 . When performing the data recovery operation, the QSPI bus first reads the first sub-data stored in the QSPI NAND Flash and transfers it to the FIFO module in the QSPI Controller. Then, the complete target data stored in the FIFO module in the QSPI Controller is transferred to the SRAM through the DMA bus, thereby realizing the recovery of the target data.
通过上述步骤,在从数据状态中确定缓存设备中缓存的目标数据出现异常的情况下,从备份缓存单元中读取数据将其传输至第二数据缓冲区里,之后再将其传输至缓存设备中,实现了目标数据的恢复,保证了相关操作的正常执行。Through the above steps, when it is determined from the data status that the target data cached in the cache device is abnormal, the data is read from the backup cache unit and transferred to the second data buffer, and then transferred to the cache device, thereby realizing the recovery of the target data and ensuring the normal execution of related operations.
在一个示例性实施例中,每个上述备份缓存单元中均包括多个缓存分区,通过第三数据传输总线将从上述第一备份缓存单元中读取的N个上述子数据传输至第二数据缓冲区,包括:从第一缓存分区中读取N个上述子数据,其中,所述第一缓存分区中的N个所述子数据是所述第一备份缓存单元传输的子数据;通过第三数据传输总线将从上述第一缓存分区中读取的N个上述子数据中传输至上述第二数据缓冲区。In an exemplary embodiment, each of the above-mentioned backup cache units includes multiple cache partitions, and the N above-mentioned sub-data read from the above-mentioned first backup cache unit are transmitted to the second data buffer through the third data transmission bus, including: reading the N above-mentioned sub-data from the first cache partition, wherein the N above-mentioned sub-data in the first cache partition are the sub-data transmitted by the first backup cache unit; and transmitting the N above-mentioned sub-data read from the above-mentioned first cache partition to the above-mentioned second data buffer through the third data transmission bus.
可选地,在本实施例中,第三数据传输总线的类型已在上述描述过,在此不做赘述。Optionally, in this embodiment, the type of the third data transmission bus has been described above and will not be repeated here.
可选地,在本实施例中,数据缓冲区的类型已在上述描述过,在此不再赘述。Optionally, in this embodiment, the type of the data buffer has been described above and will not be repeated here.
通过上述步骤,从缓存单元中的缓存分区中读取到一份完整的目标数据,并将其传输到第二数据缓冲区中,为后续在从数据状态中确定缓存设备中缓存的目标数据出现异常的情况下,可以从备份缓存单元中读取数据将其传输至缓存设备里提供了必要条件。Through the above steps, a complete copy of the target data is read from the cache partition in the cache unit and transferred to the second data buffer, which provides the necessary conditions for reading data from the backup cache unit and transferring it to the cache device when it is determined from the data status that an abnormality has occurred in the target data cached in the cache device.
在一个示例性实施例中,在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常的情况下,从第一备份缓存单元中读取备份的N个上述子数据之前,上述方法还包括:在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常,且上述第一备份缓存单元出现异常时,检测第二备份缓存单元中是否已缓存N个上述子数据,其中,上述第二备份缓存单元是N个上述备份缓存单元中处于正常状态的任一备份缓存单元;在确定上述第二备份缓存单元中已缓存N个上述子数据的情况下,从第二备份缓存单元中读取备份的N个上述子数据;将上述第二备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, when it is determined from the data state that the target data cached in the cache device is abnormal, before reading the backed-up N sub-data from the first backup cache unit, the method further includes: when it is determined from the data state that the target data cached in the cache device is abnormal and the first backup cache unit is abnormal, detecting whether the N sub-data have been cached in the second backup cache unit, wherein the second backup cache unit is any backup cache unit in the N backup cache units that is in a normal state; when it is determined that the N sub-data have been cached in the second backup cache unit, reading the backed-up N sub-data from the second backup cache unit; and transferring the N sub-data cached in the second backup cache unit to the cache device to restore the target data in the cache device.
可选地,在本实施例中,缓存设备中缓存的目标数据出现的异常包括但不限于是:数据损坏、数据丢失等问题。Optionally, in this embodiment, the abnormalities that occur in the target data cached in the cache device include, but are not limited to, data corruption, data loss, and other issues.
可选地,在本实施例中,备份缓存单元出现的异常可能是:备份缓存单元在数据擦写过程中出现错误,缓存数据的分区损坏;在读取备份缓存单元中的数据时发生校验错误,无法正常读取数据等。Optionally, in this embodiment, the abnormality of the backup cache unit may be: an error occurs in the backup cache unit during data erasing and writing, and the partition of the cached data is damaged; a verification error occurs when reading data in the backup cache unit, and the data cannot be read normally, etc.
可选地,在本实施例中,检测第二备份缓存单元中是否已缓存N个子数据的方法可以是:检测第二备份缓存单元中存储的数据大小,如果和目标数据的大小一致,则第二备份缓存单元中已缓存了N个子数据,即第二备份缓存单元中已缓存了一份完整的目标数据。Optionally, in this embodiment, the method for detecting whether N sub-data have been cached in the second backup cache unit may be: detecting the size of data stored in the second backup cache unit; if it is consistent with the size of the target data, N sub-data have been cached in the second backup cache unit, that is, a complete copy of the target data has been cached in the second backup cache unit.
通过上述步骤,在从数据状态中确定缓存设备中缓存的目标数据出现异常并且第一备份缓存单元也出现异常的情况下,选择其他正常的备份缓存单元进行数据恢复,可以实现在特殊情况下也能进行数据恢复,实现了对数据的完整性和可用性的保护。Through the above steps, when it is determined from the data status that the target data cached in the cache device is abnormal and the first backup cache unit is also abnormal, other normal backup cache units are selected for data recovery, so that data recovery can be performed even in special circumstances, thereby protecting the integrity and availability of the data.
下面通过一个具体的操作流程说明本申请中将目标子数据缓存至N个备份缓存单元中的具体操作流程。在本具体实施例中,目标数据存储在SRAM中,备份缓存单元是两片QSPI NAND Flash,备用供电模块是超级电容,如图6所示,是本具体实施例中目标数据缓存的流程图,Flash0备份缓存第一部分数据,Flash1备份缓存第二部分数据,数据备份到两片QSPI NAND Flash中,两片QSPI NAND Flash均已完成分区划分,将其划分为十个分区,目标数据的具体缓存备份步骤如下:The following is a specific operation flow to illustrate the specific operation flow of caching the target sub-data into N backup cache units in this application. In this specific embodiment, the target data is stored in SRAM, the backup cache unit is two QSPI NAND Flash, and the backup power supply module is a super capacitor. As shown in Figure 6, it is a flow chart of the target data cache in this specific embodiment. Flash0 backup caches the first part of the data, and Flash1 backup caches the second part of the data. The data is backed up to two QSPI NAND Flashes. Both QSPI NAND Flashes have completed partitioning and are divided into ten partitions. The specific cache backup steps of the target data are as follows:
S601,假设缓存数据大小为 x MB,软件根据缓存数据的缓存地址将缓存数据分为第一部分数据与第二部分数据两部分,每部分大小均为x/2 MB。通过DMA0跟DMA1两路DMA同步备份到QSPI NAND Flash0跟QSPI NAND Flash1。假设DMA每次传输数据为y KB(y为偶数),备份x/2 MB数据需要传输次数为:(x/2) * 1024 / y = 512x/y 次。S601, assuming that the cache data size is x MB, the software divides the cache data into two parts, the first part and the second part, according to the cache address of the cache data, and the size of each part is x/2 MB. It is backed up to QSPI NAND Flash0 and QSPI NAND Flash1 synchronously through DMA0 and DMA1. Assuming that the DMA transfers y KB of data each time (y is an even number), the number of transfers required to back up x/2 MB of data is: (x/2) * 1024 / y = 512x/y times.
在确认RAID卡处于断电状态且超级电容可以进行供电的情况下,初始化变量SRAM_ADDR0为缓存SRAM起始地址,SRAM_ADDR1为缓存SRAM中间地址,i为0(变量i控制备份次数);配置DMA0,从缓存地址SRAM_ADDR0备份y KB数据到Flash0的分区N,SRAM_ADDR0地址偏移加y KB,为下次数据备份做好准备;之后配置DMA1,从缓存地址SRAM_ADDR1备份y KB数据到Flash1的分区N,SRAM_ADDR1地址偏移加y KB,为下次数据备份做好准备,备份次数变量i加1;对备份次数变量i进行判断,在确定完成512x/y次数据备份后,即完成了第一阶段数据备份。After confirming that the RAID card is in a power-off state and the supercapacitor can supply power, initialize the variable SRAM_ADDR0 to the cache SRAM start address, SRAM_ADDR1 to the cache SRAM middle address, and i to 0 (variable i controls the number of backup times); configure DMA0 to back up y KB of data from the cache address SRAM_ADDR0 to the partition N of Flash0, and add y KB to the address offset of SRAM_ADDR0 to prepare for the next data backup; then configure DMA1 to back up y KB of data from the cache address SRAM_ADDR1 to the partition N of Flash1, and add y KB to the address offset of SRAM_ADDR1 to prepare for the next data backup, and add 1 to the backup times variable i; judge the backup times variable i, and after determining that 512x/y data backups are completed, the first stage of data backup is completed.
S602,在确定超级电容可以进行供电且其电量充足的情况下,进入第二阶段数据备份:Flash0备份缓存第二部分数据,Flash1备份缓存第一部分数据,数据备份到分区N(0<= N <= 9,且这里的N与上述第一阶段数据备份中使用的N为同一值),重新初始化变量SRAM_ADDR0为缓存SRAM中间地址,SRAM_ADDR1为缓存SRAM起始地址,i为0;配置DMA0,从缓存地址SRAM_ADDR0备份y KB数据到Flash0的分区N,SRAM_ADDR0地址偏移加y KB,为下次数据备份做好准备;配置DMA1,从缓存地址SRAM_ADDR1备份y KB数据到Flash1的分区N,SRAM_ADDR1地址偏移加y KB,为下次数据备份做好准备,备份次数变量i自加1,进行备份次数变量i值的判断,在确定完成512x/y次数据备份的情况下,整个缓存数据备份流程结束。S602, when it is determined that the supercapacitor can supply power and has sufficient power, enter the second stage of data backup: Flash0 backs up the second part of the cache data, Flash1 backs up the first part of the cache data, and the data is backed up to partition N (0<= N <= 9, and N here is the same value as the N used in the first stage of data backup), reinitialize the variable SRAM_ADDR0 to the middle address of the cache SRAM, SRAM_ADDR1 to the starting address of the cache SRAM, and i is 0; configure DMA0 to back up y KB of data from the cache address SRAM_ADDR0 to partition N of Flash0, and the address offset of SRAM_ADDR0 is increased by y KB to prepare for the next data backup; configure DMA1 to back up y KB of data from the cache address SRAM_ADDR1 to partition N of Flash1, and the address offset of SRAM_ADDR1 is increased by y KB to prepare for the next data backup, the backup number variable i is incremented by 1, and the value of the backup number variable i is judged. When it is determined that 512x/y data backups are completed, the entire cache data backup process ends.
需要说明的是,通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。It should be noted that, through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
在本实施例中还提供了一种数据恢复的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a device for data recovery is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and/or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
图7是根据本申请实施例的一种数据恢复的装置的结构框图,如图7所示,该装置包括:FIG. 7 is a structural block diagram of a data recovery device according to an embodiment of the present application. As shown in FIG. 7 , the device includes:
划分模块72,用于在确定RAID卡断电且上述备用供电模块处于给上述RAID卡供电的状态情况下,将目标数据划分为N个子数据,其中,上述目标数据是缓存设备中缓存的数据,上述缓存设备部署在上述RAID卡中;A division module 72 is used to divide the target data into N sub-data when it is determined that the RAID card is powered off and the backup power supply module is in a state of supplying power to the RAID card, wherein the target data is data cached in a cache device, and the cache device is deployed in the RAID card;
缓存模块74,用于将N个上述子数据分别缓存至N个上述备份缓存单元中;A cache module 74, used for caching the N sub-data into the N backup cache units respectively;
恢复模块76,用于在确定上述RAID卡恢复供电、且上述缓存设备中缓存的上述目标数据出现异常的情况下,将N个上述备份缓存单元中缓存的N个上述子数据恢复至上述缓存设备中。The recovery module 76 is used to restore the N sub-data cached in the N backup cache units to the cache device when it is determined that the RAID card is powered on again and the target data cached in the cache device is abnormal.
在一个示例性实施例中,上述划分模块72包括:第一获取单元,用于获取上述供电监测服务对上述RAID卡的第一监测结果,其中,上述供电监测服务用于监测上述RAID卡的供电情况,上述第一监测结果中包括上述RAID卡的第一供电状态;第一控制单元,用于在从上述第一监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电。In an exemplary embodiment, the division module 72 includes: a first acquisition unit, used to obtain the first monitoring result of the power supply monitoring service on the RAID card, wherein the power supply monitoring service is used to monitor the power supply condition of the RAID card, and the first monitoring result includes the first power supply state of the RAID card; a first control unit, used to control the backup power supply module to supply power to the RAID card when it is determined from the first monitoring result that the RAID card is in a power-off state.
在一个示例性实施例中,上述备份控制装置中还包括电量检测服务,上述电量检测服务与上述供电监测服务连接,在从上述监测结果中确定上述RAID卡处于断电状态的情况下,控制上述备用供电模块为上述RAID卡供电,上述装置还包括:第一记录单元,用于在从上述监测结果中确定上述RAID卡处于上述断电状态的情况下,获取上述电量检测服务的检测结果,并将上述检测结果记录在上述备用供电模块的电量表中,其中,上述电量检测服务用于检测上述备用供电模块的电量状态,上述检测结果包括上述备用供电模块的电量信息;第一发送单元,用于在从上述检测结果中确定上述备用供电模块的电量大于第一预设电量的情况下,上述供电监测服务向供电切换服务发送第一切换指令,其中,上述供电切换服务部署在上述备份控制装置中;第一响应单元,用于上述供电切换服务响应上述第一切换指令,导通上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块通过上述供电电路给上述RAID卡供电。In an exemplary embodiment, the backup control device further includes a power detection service, which is connected to the power monitoring service. When it is determined from the monitoring result that the RAID card is in the power-off state, the backup power supply module is controlled to supply power to the RAID card. The device further includes: a first recording unit, which is used to obtain the detection result of the power detection service when it is determined from the monitoring result that the RAID card is in the power-off state, and record the detection result in the power meter of the backup power supply module, wherein the power detection service is used to detect the power state of the backup power supply module, and the detection result includes the power information of the backup power supply module; a first sending unit, which is used to send a first switching instruction to the power switching service by the power monitoring service when it is determined from the detection result that the power of the backup power supply module is greater than a first preset power, wherein the power switching service is deployed in the backup control device; a first responding unit, which is used for the power switching service to respond to the first switching instruction, and conduct the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module supplies power to the RAID card through the power supply circuit.
在一个示例性实施例中,上述划分模块72包括:第二获取单元,用于获取上述目标数据的起始物理地址,并按照上述目标数据的起始物理地址从上述缓存设备中读取上述目标数据;第一划分单元,用于基于上述N个备份缓存单元的数量将上述目标数据划分为N个上述子数据,并将N个上述子数据的起始物理地址均存储在上述缓存设备中的数据地址表中。In an exemplary embodiment, the above-mentioned partitioning module 72 includes: a second acquisition unit, used to obtain the starting physical address of the above-mentioned target data, and read the above-mentioned target data from the above-mentioned cache device according to the starting physical address of the above-mentioned target data; a first partitioning unit, used to divide the above-mentioned target data into N above-mentioned sub-data based on the number of the above-mentioned N backup cache units, and store the starting physical addresses of the N above-mentioned sub-data in the data address table in the above-mentioned cache device.
在一个示例性实施例中,第一缓存模块74包括:第一缓存单元,用于在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中;第二缓存单元,用于在确定上述备用供电模块的电量恢复至大于第二预设电量的情况下,将N-1个上述子数据分别缓存至N个上述备份缓存单元中,以使每个上述备份缓存单元中均缓存有完整的上述目标数据,其中,N-1个上述子数据是N个上述子数据中除已经缓存到N个上述备份缓存单元中的子数据之外的其他子数据。In an exemplary embodiment, the first cache module 74 includes: a first cache unit, which is used to cache the N sub-data in the N backup cache units respectively when it is determined that the power of the backup power supply module is less than the second preset power; a second cache unit, which is used to cache the N-1 sub-data in the N backup cache units respectively when it is determined that the power of the backup power supply module is restored to be greater than the second preset power, so that each of the backup cache units caches the complete target data, wherein the N-1 sub-data are other sub-data in the N sub-data except the sub-data that have been cached in the N backup cache units.
在一个示例性实施例中,每个上述备份缓存单元中均包括多个缓存分区,在确定上述备用供电模块的电量小于第二预设电量的情况下,将N个上述子数据分别缓存至N个上述备份缓存单元中,上述装置还包括:第三获取单元,用于分别获取N个上述子数据的起始物理地址;第一传输单元,用于按照上述起始物理地址并通过第一数据传输总线分别将N个上述子数据传输至第一数据缓冲区;第二传输单元,用于通过第二数据传输总线将上述第一数据缓冲区中缓存的N个上述子数据分别传输至N个上述备份缓存单元中的第一缓存分区中,其中,上述第一缓存分区是多个上述缓存分区中的任一缓存分区。In an exemplary embodiment, each of the above-mentioned backup cache units includes multiple cache partitions. When it is determined that the power of the above-mentioned backup power supply module is less than the second preset power, the N above-mentioned sub-data are cached in the N above-mentioned backup cache units respectively. The above-mentioned device also includes: a third acquisition unit, used to respectively acquire the starting physical addresses of the N above-mentioned sub-data; a first transmission unit, used to transmit the N above-mentioned sub-data to the first data buffer according to the above-mentioned starting physical address and through the first data transmission bus; a second transmission unit, used to transmit the N above-mentioned sub-data cached in the above-mentioned first data buffer to the first cache partition in the N above-mentioned backup cache units through the second data transmission bus, wherein the above-mentioned first cache partition is any cache partition among the multiple above-mentioned cache partitions.
在一个示例性实施例中,上述装置还包括:第三传输单元,用于通过上述第二数据传输总线将上述第一数据缓冲区中缓存的N-1个上述子数据分别传输至N个上述备份缓存单元中的上述第一缓存分区中。In an exemplary embodiment, the apparatus further includes: a third transmission unit, configured to transmit the N-1 sub-data cached in the first data buffer to the first cache partitions in the N backup cache units respectively through the second data transmission bus.
在一个示例性实施例中,第一恢复模块76包括:第四获取单元,用于获取上述供电监测服务对上述RAID卡的第二监测结果,其中,上述第二监测结果中包括上述RAID卡的第二供电状态;第一检测单元,用于在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,检测上述缓存设备中缓存的上述目标数据的数据状态;第一读取单元,用于在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常的情况下,从N个上述备份缓存单元中读取备份的N个上述子数据;第四传输单元,用于将N个上述备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the first recovery module 76 includes: a fourth acquisition unit, used to obtain the second monitoring result of the power supply monitoring service on the RAID card, wherein the second monitoring result includes the second power supply state of the RAID card; a first detection unit, used to detect the data state of the target data cached in the cache device when it is determined from the second monitoring result that the RAID card is in a state where power supply has been restored; a first reading unit, used to read the N backed-up sub-data from the N backup cache units when it is determined from the data state that the target data cached in the cache device is abnormal; and a fourth transmission unit, used to transmit the N sub-data cached in the N backup cache units to the cache device, so as to restore the target data in the cache device.
在一个示例性实施例中,第一恢复模块76还包括:第二发送单元,用于在从上述第二监测结果中确定上述RAID卡处于已经恢复供电的状态下,上述供电监测服务向供电切换服务发送第一断开指令,其中,上述供电切换服务部署在上述备份控制装置中;第二响应单元,用于上述供电切换服务响应上述第一断开指令,以断开上述备用供电模块与上述RAID卡之间的供电电路,以使上述备用供电模块停止给上述RAID卡供电。In an exemplary embodiment, the first recovery module 76 also includes: a second sending unit, used for, when it is determined from the second monitoring result that the RAID card is in a state where power supply has been restored, the power supply monitoring service sends a first disconnection instruction to the power supply switching service, wherein the power supply switching service is deployed in the backup control device; and a second response unit, used for the power supply switching service to respond to the first disconnection instruction to disconnect the power supply circuit between the backup power supply module and the RAID card, so that the backup power supply module stops supplying power to the RAID card.
在一个示例性实施例中,第一恢复模块76还包括:第五传输单元,用于通过第三数据传输总线将从上述第一备份缓存单元中读取的N个上述子数据传输至第二数据缓冲区;第六传输单元,用于通过第四数据传输总线将上述第二数据缓冲区中的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the first recovery module 76 also includes: a fifth transmission unit, used to transfer the N sub-data read from the above-mentioned first backup cache unit to the second data buffer through a third data transmission bus; a sixth transmission unit, used to transfer the N sub-data in the above-mentioned second data buffer to the above-mentioned cache device through a fourth data transmission bus, so as to restore the above-mentioned target data in the above-mentioned cache device.
在一个示例性实施例中,第一恢复模块76还包括:第一读取单元,用于从上述第一缓存分区中读取N个上述子数据;第七传输单元,用于通过第三数据传输总线将从上述第一缓存分区中读取的N个上述子数据中传输至上述第二数据缓冲区。In an exemplary embodiment, the first recovery module 76 also includes: a first reading unit, used to read the N sub-data from the above-mentioned first cache partition; a seventh transmission unit, used to transmit the N sub-data read from the above-mentioned first cache partition to the above-mentioned second data buffer through a third data transmission bus.
在一个示例性实施例中,第一恢复模块76还包括:第二检测单元,用于在从上述数据状态中确定上述缓存设备中缓存的上述目标数据出现异常,且上述第一备份缓存单元出现异常时,检测上述第二备份缓存单元中是否已缓存N个上述子数据,其中,上述第二备份缓存单元是N个上述备份缓存单元中处于正常状态的任一备份缓存单元;第二读取单元,用于在确定上述第二备份缓存单元中已缓存N个上述子数据的情况下,从第二备份缓存单元中读取备份的N个上述子数据;第八传输单元,用于将上述第二备份缓存单元中缓存的N个上述子数据传输至上述缓存设备中,以在上述缓存设备中恢复上述目标数据。In an exemplary embodiment, the first recovery module 76 also includes: a second detection unit, which is used to detect whether N of the above-mentioned sub-data have been cached in the above-mentioned second backup cache unit when it is determined from the above-mentioned data state that the above-mentioned target data cached in the above-mentioned cache device is abnormal and the above-mentioned first backup cache unit is abnormal, wherein the above-mentioned second backup cache unit is any backup cache unit in the N above-mentioned backup cache units that is in a normal state; a second reading unit, which is used to read the backed-up N above-mentioned sub-data from the second backup cache unit when it is determined that N of the above-mentioned sub-data have been cached in the above-mentioned second backup cache unit; an eighth transmission unit, which is used to transmit the N above-mentioned sub-data cached in the above-mentioned second backup cache unit to the above-mentioned cache device, so as to restore the above-mentioned target data in the above-mentioned cache device.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
本申请的实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
在一个示例性实施例中,上述计算机可读存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
本申请的实施例还提供了一种电子设备,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
在一个示例性实施例中,上述电子设备还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。In an exemplary embodiment, the electronic device may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
本申请的实施例还提供了一种计算机程序产品,上述计算机程序产品包括计算机程序,所述计算机程序被处理器执行时实现上述任一项方法实施例中的步骤。An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
本申请的实施例还提供了另一种计算机程序产品,包括非易失性计算机可读存储介质,所述非易失性计算机可读存储介质存储计算机程序,所述计算机程序被处理器执行时实现上述任一项方法实施例中的步骤。An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
本中请的实施例还提供了一种计算机程序,该计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中;计算机设备的处理器从计算机可读存储介质读取该计算机指令,处埋器执行该计算机指令,使得该计算机设备执行上述任一项方法实施例中的步骤。The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
本实施例中的具体示例可以参考上述实施例及示例性实施方式中所描述的示例,本实施例在此不再赘述。For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
显然,本领域的技术人员应该明白,上述的本申请的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411333526.1ACN118860747B (en) | 2024-09-24 | 2024-09-24 | Method for recovering data, storage medium, electronic device, and program product |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411333526.1ACN118860747B (en) | 2024-09-24 | 2024-09-24 | Method for recovering data, storage medium, electronic device, and program product |
| Publication Number | Publication Date |
|---|---|
| CN118860747Atrue CN118860747A (en) | 2024-10-29 |
| CN118860747B CN118860747B (en) | 2025-03-14 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411333526.1AActiveCN118860747B (en) | 2024-09-24 | 2024-09-24 | Method for recovering data, storage medium, electronic device, and program product |
| Country | Link |
|---|---|
| CN (1) | CN118860747B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010016115A1 (en)* | 2008-08-06 | 2010-02-11 | 富士通株式会社 | Disk array device control unit, data transfer device, and power recovery processing method |
| CN103093157A (en)* | 2013-01-25 | 2013-05-08 | 浪潮电子信息产业股份有限公司 | Method of permanent protection of cache data of serial attached scsi (SAS) redundant array of independent disks (RAID) card |
| CN103150427A (en)* | 2013-02-19 | 2013-06-12 | 浪潮电子信息产业股份有限公司 | RAID design method based on SSD caching acceleration and backup |
| CN110780811A (en)* | 2019-09-19 | 2020-02-11 | 华为技术有限公司 | Data protection method, device and storage medium |
| CN111240903A (en)* | 2019-11-04 | 2020-06-05 | 华为技术有限公司 | Data recovery method and related equipment |
| CN115562593A (en)* | 2022-11-04 | 2023-01-03 | 济南浪潮数据技术有限公司 | Abnormal RAID member disk processing method, device and medium |
| CN116244154A (en)* | 2022-12-29 | 2023-06-09 | 苏州浪潮智能科技有限公司 | Alarm method, device, storage medium and electronic equipment |
| WO2023226107A1 (en)* | 2022-05-24 | 2023-11-30 | 上海江波龙数字技术有限公司 | Storage apparatus data backup method, system, electronic device, and medium |
| CN117149084A (en)* | 2023-09-08 | 2023-12-01 | 山东云海国创云计算装备产业创新中心有限公司 | RAID cache data processing method and device, electronic equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010016115A1 (en)* | 2008-08-06 | 2010-02-11 | 富士通株式会社 | Disk array device control unit, data transfer device, and power recovery processing method |
| CN103093157A (en)* | 2013-01-25 | 2013-05-08 | 浪潮电子信息产业股份有限公司 | Method of permanent protection of cache data of serial attached scsi (SAS) redundant array of independent disks (RAID) card |
| CN103150427A (en)* | 2013-02-19 | 2013-06-12 | 浪潮电子信息产业股份有限公司 | RAID design method based on SSD caching acceleration and backup |
| CN110780811A (en)* | 2019-09-19 | 2020-02-11 | 华为技术有限公司 | Data protection method, device and storage medium |
| CN111240903A (en)* | 2019-11-04 | 2020-06-05 | 华为技术有限公司 | Data recovery method and related equipment |
| WO2023226107A1 (en)* | 2022-05-24 | 2023-11-30 | 上海江波龙数字技术有限公司 | Storage apparatus data backup method, system, electronic device, and medium |
| CN115562593A (en)* | 2022-11-04 | 2023-01-03 | 济南浪潮数据技术有限公司 | Abnormal RAID member disk processing method, device and medium |
| CN116244154A (en)* | 2022-12-29 | 2023-06-09 | 苏州浪潮智能科技有限公司 | Alarm method, device, storage medium and electronic equipment |
| CN117149084A (en)* | 2023-09-08 | 2023-12-01 | 山东云海国创云计算装备产业创新中心有限公司 | RAID cache data processing method and device, electronic equipment and storage medium |
| Title |
|---|
| 涂豫;: "多点舰船通信网络异地备份数据恢复系统设计", 舰船科学技术, no. 20, 23 October 2018 (2018-10-23)* |
| Publication number | Publication date |
|---|---|
| CN118860747B (en) | 2025-03-14 |
| Publication | Publication Date | Title |
|---|---|---|
| US9390767B2 (en) | Battery-less cache memory module with integrated backup | |
| US6990603B2 (en) | Method and apparatus for securing volatile data in power failure in systems having redundancy | |
| US8707096B2 (en) | Storage system, data backup method, and system restarting method of a storage system incorporating volatile and nonvolatile memory devices | |
| US8275930B2 (en) | Storage system having volatile memory and non-volatile memory | |
| US8607076B2 (en) | Circuit apparatus with memory and power control responsive to circuit-based deterioration characteristics | |
| US8479045B2 (en) | Controller for disk array device, data transfer device, and method of power recovery process | |
| US9430011B2 (en) | Systems and methods for determining the state of health of a capacitor module | |
| US9753828B1 (en) | Adaptive failure survivability in a storage system utilizing save time and data transfer upon power loss | |
| US20100325522A1 (en) | Storage device, storage control device, data transfer intergrated circuit, and storage control method | |
| US12050778B2 (en) | Data restoration method and related device | |
| US6829724B2 (en) | Method for monitoring the condition of a battery in a high temperature high current environment | |
| US11803222B2 (en) | Systems and methods for managing reduced power failure energy requirements on a solid state drive | |
| US20170068457A1 (en) | Storage control apparatus, control method, and non-transitory computer-readable storage medium | |
| US6434711B1 (en) | Disk array apparatus that avoids premature declarations of faults | |
| CN110837444B (en) | Memory fault processing method and device | |
| US10001826B2 (en) | Power management mechanism for data storage environment | |
| CN115934403A (en) | Data recovery method, device and solid-state hard disk | |
| CN111221681A (en) | Memory repairing method and device | |
| CN110825547B (en) | A PCIE card abnormality recovery device and method based on SMBUS | |
| CN118860747B (en) | Method for recovering data, storage medium, electronic device, and program product | |
| JP2003242044A (en) | Microcomputer circuit | |
| CN118642645A (en) | Data processing method, system and related equipment | |
| CN120428921A (en) | Power-down protection system and power-down protection method | |
| CN119025340A (en) | Method and device for writing data to be backed up, storage medium and electronic device | |
| CN117435409A (en) | A self-test method of supercapacitor, RAID card and server |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |