WO2022016863A1 - 数据快照方法、装置、计算机设备及存储介质 - Google Patents
数据快照方法、装置、计算机设备及存储介质 Download PDFInfo
- Publication number
- WO2022016863A1 WO2022016863A1 PCT/CN2021/077594 CN2021077594W WO2022016863A1 WO 2022016863 A1 WO2022016863 A1 WO 2022016863A1 CN 2021077594 W CN2021077594 W CN 2021077594W WO 2022016863 A1 WO2022016863 A1 WO 2022016863A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- written
- write
- snapshot
- capacity
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operations
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
- G06F11/1451—Management of the data involved in backup or backup restore by selection of backup contents
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operations
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
- G06F3/0619—Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/065—Replication mechanisms
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0665—Virtualisation aspects at area level, e.g. provisioning of virtual or logical volumes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/067—Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0674—Disk device
- G06F3/0676—Magnetic disk device
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operations
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/84—Using snapshots, i.e. a logical point-in-time copy of the data
Definitions
- the present invention relates to the field of storage technologies, and in particular, to a data snapshot method, device, computer equipment and storage medium.
- Snapshot is a data protection technology commonly used in distributed storage systems.
- the essence of a snapshot is a mirror image of data at a certain point in time, which can be a copy of the data or a reference to the data.
- snapshots can regularly backup and restore online data. When a user accidentally deletes data, the data can be rolled back to the previous timed snapshot to ensure normal business operations. Therefore, in production Snapshot technology is becoming more and more important in applications, and data copying in several processing stages of the snapshot process is the core of the snapshot technology.
- the first post-snapshot data copying method is Copy On Write (COW for short). Go to the snapshot storage location, and then write the newly written data to the original storage location.
- COW Copy On Write
- the advantage of this method is that the read performance will not decrease after the snapshot.
- the two post-snapshot data copying methods are Redirect On Write (ROW), the principle of which is to directly write the first write after the snapshot of the data to the new storage location, but write the index of the location data. It needs to point to a new storage location.
- ROW Redirect On Write
- the advantage of this technology is that the write performance will not decrease after the snapshot.
- the disadvantage is that a large number of random writes after the snapshot will cause the entire data read performance to decrease significantly. It can be seen that, in the prior art, the post-snapshot data copying method using COW or ROW has shortcomings, and therefore improvement is urgently needed.
- a data snapshot method comprising:
- the data to be written is written to the solid-state hard disk in a write redirection manner
- the copy-on-write method is used to write the corresponding data in the source volume to the snapshot volume, and the to-be-written data in the solid state drive is written to the source volume.
- the method further includes:
- the step of writing the data to be written to the snapshot volume in a write redirection manner includes:
- the step of writing the data to be written to the solid-state drive in a write redirection manner includes:
- the copy-on-write method is used to write the corresponding data in the source volume into the snapshot volume, and the to-be-received data in the solid-state drive is written to the snapshot volume.
- the steps to write data to the source volume include:
- the data corresponding to the data to be written in the source volume is replaced with the newly written data in the solid state disk, and the index information of the source volume is updated.
- the preset capacity is 128KB.
- the source volume and the snapshot volume are both mechanical hard disks.
- a data snapshot device comprising:
- a comparison module configured to obtain the capacity of the data to be written after the snapshot, and compare the capacity of the data to be written with the preset capacity
- a first writing module configured to use a write redirection method to write the to-be-written data to the snapshot volume if the capacity of the to-be-written data is greater than or equal to a preset capacity
- a second writing module configured to use a write redirection method to write the to-be-written data into the solid-state hard disk if the capacity of the to-be-written data is smaller than the preset capacity
- the write-back module is used to write the corresponding data in the source volume to the snapshot volume in a copy-on-write manner if the background write-back thread detects that data is written in the solid-state drive, and writes the data to be written in the solid-state hard drive Write to the source volume.
- a computer device comprising: at least one processor;
- the memory stores a computer program executable on the processor, and the processor executes the aforementioned data snapshot method when executing the program.
- a computer-readable storage medium stores a computer program, and the computer program executes the foregoing data snapshot method when executed by a processor.
- the above data snapshot method, device, computer equipment and storage medium by comparing the capacity of the data to be written after the snapshot and the preset capacity, the data to be written after the snapshot equal to or exceeding the preset capacity is copied to the snapshot volume in a redirection manner , for the data to be written that does not exceed the preset capacity after the snapshot, use redirection to copy to the SSD, and use the copy-on-write method to write the data in the source volume to the snapshot volume, and use the copy-on-write method to write the data to be written in the SSD.
- the input data is written to the source volume, which not only ensures the random write performance of large blocks of data, but also ensures the read performance of small blocks of data after random write.
- FIG. 1 is a schematic flowchart of a data snapshot method in an embodiment of the present invention
- FIG. 2 is a schematic diagram of the writing process when the data to be written after the snapshot exceeds the preset capacity in another embodiment of the present invention
- FIG. 3 is a schematic diagram of the writing process when the data to be written after the snapshot does not exceed the preset capacity in another embodiment of the present invention
- FIG. 4 is a schematic diagram of a data snapshot device in another embodiment of the present invention.
- FIG. 5 is an internal structure diagram of a computer device in another embodiment of the present invention.
- FIG. 6 is a schematic diagram of a computer-readable storage medium in another embodiment of the present invention.
- the present invention provides a data snapshot method. Specifically, the method includes the following steps:
- S100 Acquire the capacity of the data to be written after the snapshot, and compare the capacity of the data to be written with a preset capacity.
- the data to be written refers to the data corresponding to the data write operation when the snapshot software monitors and tracks the changes of the original data after the snapshot is taken, also known as the post-snapshot write IO (Input/Output).
- the capacity of the data to be written is the size of the data corresponding to the write operation.
- the preset capacity is 128KB (Kilobyte, kilobyte), and according to the size of the preset capacity, the data to be written is divided into large block write IO and small block write IO, and large block write IO refers to the size of the data to be written.
- small block write IO refers to the case where the capacity of the data to be written is less than 128KB.
- the copy-on-write method is used to write the corresponding data in the source volume into the snapshot volume, and the to-be-written data in the solid-state drive is written to the source volume. roll.
- the snapshot volume refers to the snapshot data storage space
- the source volume refers to the original data storage space; preferably, the snapshot volume and the source volume are both mechanical hard disks (Hard Disk Drive, HHD).
- the data to be written that is equal to or exceeding the preset capacity after the snapshot is copied to the snapshot volume by redirection, and the data to be written after the snapshot is copied to the snapshot volume by means of redirection.
- the data to be written with the preset capacity is copied to the solid-state drive by redirection, and the data in the source volume is written to the snapshot volume by the copy-on-write method, and the data to be written in the solid-state drive is written to the source.
- the volume not only ensures the random write performance of large blocks of data, but also ensures the read performance of small blocks of data after random write.
- the method of the present invention further includes the following steps on the basis of the foregoing embodiment:
- step S200 specifically includes the following sub-steps:
- step S300 specifically includes the following sub-steps:
- step S400 specifically includes the following sub-steps:
- the ROW copy process for write IOs greater than or equal to 128KB is as follows: Assume that the data to be modified on the source volume (ie, the original data storage space) is d, and the corresponding data to be written is recorded as d1 , using the ROW method, that is, the data of part d on the original data storage space remains unchanged, and d1 is written to the new location of the snapshot volume (ie, the snapshot data storage space), and the index information of the data is updated, thus completing the data capacity greater than or equal to 128KB data write operations after the snapshot.
- the data copy process of write IO less than 128KB is as follows: Assuming that the capacity of d1 is less than 128KB, first write the data d1 to be written to the solid-state hard disk by ROW. After the data d1 is placed on the disk, the index information of the data is updated; the background write-back thread monitors whether new data is written on the solid-state drive. The data d on the source volume (that is, the original data storage space) is copied to the snapshot volume (that is, the snapshot data storage space). After the data d in the snapshot data storage space is placed on the disk, the index information of the snapshot data is updated, and the snapshot data is guaranteed.
- the present invention also provides a data snapshot device 60, specifically, the device includes:
- a comparison module 61 configured to obtain the capacity of the data to be written after the snapshot, and compare the capacity of the data to be written with a preset capacity
- a first writing module 62 configured to write the to-be-written data to the snapshot volume in a write redirection mode if the capacity of the to-be-written data is greater than or equal to a preset capacity
- the second writing module 63 is configured to use a write redirection method to write the data to be written into the solid-state hard disk if the capacity of the data to be written is smaller than the preset capacity;
- the write-back module 64 is used for writing the corresponding data in the source volume into the snapshot volume in a copy-on-write manner if the background write-back thread detects that data is written in the solid-state drive, and writes the data to be written in the solid-state drive to the snapshot volume. Data is written to the source volume.
- the above-mentioned data snapshot device compares the capacity of the data to be written after the snapshot with the preset capacity, and copies the data to be written that is equal to or exceeds the preset capacity after the snapshot, and copies the data to be written after the snapshot that does not exceed the preset capacity.
- the data to be written is copied to the SSD by redirection, and the data in the source volume is written to the snapshot volume by the copy-on-write method, and the data to be written in the SSD is written to the source volume, which not only guarantees Random write performance of large blocks of data, and also ensure the read performance of small blocks of data after random write.
- Each module in the above-mentioned data snapshot device may be implemented in whole or in part by software, hardware and combinations thereof.
- the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
- a computer device is provided, and the computer device may be a server.
- the computer device includes a processor, memory, a network interface, and a database connected by a system bus.
- the processor of the computer device is used to provide computing and control capabilities.
- the memory of the computer device includes a non-volatile storage medium, an internal memory.
- the nonvolatile storage medium stores an operating system, a computer program, and a database.
- the internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium.
- the database of the computer device is used to store data.
- the network interface of the computer device is used to communicate with an external terminal through a network connection.
- the computer program implements the data snapshot method described above when executed by the processor.
- a computer-readable storage medium is provided, as shown in FIG. 6 , a computer program 702 is stored thereon, and the computer program 702 implements the above-mentioned data snapshot method when executed by the processor 701 .
- any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory.
- Non-volatile memory may include read-only memory (ROM, Read-Only Memory), programmable ROM (PROM, Programmable Read-Only Memory), electrically programmable ROM (EPROM, Erasable Programmable Read-Only Memory), electrically erasable Except for programmable ROM (EEPROM, Electrically Erasable Programmable Read-Only Memory) or flash memory. Volatile memory may include random access memory (RAM, Random Access Memory) or external cache memory.
- RAM is available in various forms, such as static RAM (SRAM, Static Random-Access Memory), dynamic RAM (DRAM, Dynamic Random Access Memory), synchronous DRAM (SDRAM, Sychronous Dynamic Random Access Memory), Double Data Rate SDRAM (DDRSDRAM, Double Data Rate Sychronous Dynamic Random Access Memory), Enhanced SDRAM (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), Synchlink DRAM (SLDRAM, Sync Link Dynamic Random Access Memory), memory Bus (Rambus) dynamic RAM (RDRAM, Rambus Dynamic Random Access Memory), and direct memory bus dynamic RAM (DRDRAM, Direct Rambus Dynamic Random Access Memory) and so on.
- SRAM Static Random-Access Memory
- DRAM Dynamic Random Access Memory
- SDRAM Sychronous Dynamic Random Access Memory
- DDRSDRAM Double Data Rate Sychronous Dynamic Random Access Memory
- ESDRAM Enhanced Synchronous Dynamic Random Access Memory
- SLDRAM Synchlink Dynamic Random Access Memory
- memory Bus Radbus dynamic RAM
- RDRAM Rambus Dynamic Random Access Memory
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Quality & Reliability (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请涉及一种数据快照方法、装置、计算机设备及存储介质。所述方法包括:获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。本发明的方案不仅保证了大块数据的随机写性能,而且保证了小块数据进行随机写后的读取性能。
Description
本申请要求于2020年7月21日提交中国国家知识产权局,申请号为202010705961.8,发明名称为:“数据快照方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明涉及存储技术领域,尤其涉及一种数据快照方法、装置、计算机设备及存储介质。
快照是分布式存储系统常用的数据保护技术,快照的实质是数据在某个时间点的镜像,其可以是数据的副本,亦可以是数据的引用。现有的生产应用中,快照能够定时对在线数据进行备份与恢复,当发生用户误删数据操作时,那么就可以将数据回滚到前一个定时快照,从而保障业务可以正常进行,因此在生产应用中快照技术越来越重要,而快照的过程的几个处理阶段中数据拷贝是快照技术的核心。
目前快照后数据拷贝主要有两种方式。第一种快照后数据拷贝方式是写时复制(Copy On Write,简称COW),其原理为对数据打快照后第一次写入时,将需要写入位置的原有数据读取出来,写到快照存储位置,然后将新写入数据写入原存储位置,该种方式优点是快照后读取性能不会下降,缺点是快照后写入性能由于拷贝写入位置数据会下降较多;第二种快照后数据拷贝方式是写入重定向(Redirect On Write,简称ROW),其原理为 将数据打快照后的第一次写入直接写到新的存储位置,但是写入位置数据的索引需要指向新存储位置,该技术优点是快照后写入性能不会下降,缺点是快照后大量随机写入,会导致整个数据读取性能下降较多。由此可见,现有技术中采用COW或ROW进行的快照后数据拷贝方式均存在不足,因此亟需改进。
发明内容
有鉴于此,有必要针对以上技术问题,提供一种兼顾数据写入性能和随机写后数据读取性能的数据快照方法、装置、计算机设备及存储介质。
根据本发明的一方面,提供了一种数据快照方法,所述方法包括:
获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;
若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;
若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;
若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
在其中一个实施例中,所述方法还包括:
若固态硬盘中的所述待写入数据已写入到源卷,则释放固态硬盘中写入的数据空间。
在其中一个实施例中,所述若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷的步骤包括:
获取待写入数据;
将所述待写入数据写入到快照卷;
更新快照卷中新写入数据的索引信息。
在其中一个实施例中,所述若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中的步骤包括:
获取待写入数据;
将所述待写入数据写入到固态硬盘中;
更新固态硬盘中新写入数据的索引信息。
在其中一个实施例中,所述多后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷的步骤包括:
获取源卷中所述待写入数据的对应数据;
将所述待写入数据的对应数据写入快照卷,并更新快照卷的索引信息;
获取固态硬盘中新写入的数据;
将源卷中所述待写入数据的对应数据替换为固态硬盘中新写入的数据,并更新源卷的索引信息。
在其中一个实施例中,所述预设容量为128KB。
在其中一个实施例中,所述源卷和所述快照卷均为机械硬盘。
根据本发明的另一方面,提供了一种数据快照装置,所述装置包括:
比较模块,用于获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;
第一写入模块,用于若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;
第二写入模块,用于若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;
回写模块,用于若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
根据本发明的又一方面,还提供了一种计算机设备,包括:至少一个处理器;以及
存储器,所述存储器存储有可在所述处理器上运行的计算机程序,所述处理器执行所述程序时执行前述的数据快照方法。
根据本发明的再一方面,还提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时执行前述的数据快照方法。
上述数据快照方法、装置、计算机设备及存储介质,通过比较快照后待写入数据容量与预设容量,对快照后等于和超出预设容量的待写入数据采用重定向方式拷贝到快照卷中,对快照后未超出预设容量的待写入数据,采用重定向方式拷贝到固态硬盘,以及利用写时复制方式将源卷中的数据写入到快照卷中,将固态硬盘中的待写入数据写入到源卷,不仅保证了大块数据的随机写性能,而且还保证了小块数据进行随机写后的读取性能。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。
图1为本发明一个实施例中一种数据快照方法的流程示意图;
图2为本发明又一个实施例中快照后待写入数据超过预设容量时的写入过程示意图;
图3为本发明另一个实施例中快照后待写入数据未超过预设容量时的写入过程示意图;
图4为本发明另一个实施例中一种数据快照装置的示意图;
图5为本发明另一个实施例中计算机设备的内部结构图;
图6为本发明另一个实施例中计算机可读存储介质的示意图。
为使本发明的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本发明实施例进一步详细说明。
需要说明的是,本发明实施例中所有使用“第一”和“第二”的表述均是为了区分两个相同名称非相同的实体或者非相同的参量,可见“第一”“第二”仅为了表述的方便,不应理解为对本发明实施例的限定,后续实施例对此不再一一说明。
在一个实施例中,请参照图1所示,本发明提供了一种数据快照方法,具体地,该方法包括以下步骤:
S100,获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较。
其中,待写入数据是指打快照后快照软件监控跟踪原始数据变化时,对数据进行写入操作所对应的数据,也称为快照后写入IO(Input/Output,输入/输出)。待写入数据的容量即写入操作对应数据的大小。优选地,预设容量为128KB(Kilobyte,千字节),根据预设容量的大小将待写入数据 分为大块写IO和小块写IO,大块写IO是指待写入数据的容量大于等于128KB情形,相应地,小块写IO是指待写入数据容量小于128KB的情形。
S200,若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷。
S300,若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中。
S400,若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
其中,快照卷是指快照数据存储空间,源卷是指原有数据存储空间;较佳地,快照卷和源卷均为机械硬盘(Hard Disk Drive,HHD)。
上述一种数据快照方法,通过比较快照后待写入数据容量与预设容量,对快照后等于和超出预设容量的待写入数据采用重定向方式拷贝到快照卷中,对快照后未超出预设容量的待写入数据,采用重定向方式拷贝到固态硬盘,以及利用写时复制方式将源卷中的数据写入到快照卷中,将固态硬盘中的待写入数据写入到源卷,不仅保证了大块数据的随机写性能,而且保证了小块数据进行随机写后的读取性能。
优选地,为了便于后续快照后小于预设容量的写入数据的存储,在前述实施例基础上本发明方法还包括以下步骤:
S500,若固态硬盘中的所述待写入数据已写入到源卷,则释放固态硬盘中写入的数据空间;由此用户在每次打快照后,对于小块写IO均能够使用固态硬盘进行暂时存储,提升了固态硬盘暂存数据的使用效率,方便了多次进行快照后数据的写入操作。
在另一个实施例中,前述步骤S200具体包括以下子步骤:
S210,获取待写入数据;
S220,将所述待写入数据写入到快照卷;
S230,更新快照卷中新写入数据的索引信息。
在又一个实施例中,前述步骤S300具体包括以下子步骤:
S310,获取待写入数据;
S320,将所述待写入数据写入到固态硬盘中;
S330,更新固态硬盘中新写入数据的索引信息。
优选地,前述步骤S400具体包括以下子步骤:
S410,获取源卷中所述待写入数据的对应数据;
S420,将所述待写入数据的对应数据写入快照卷,并更新快照卷的索引信息;
S430,获取固态硬盘中新写入的数据;
S440,将源卷中所述待写入数据的对应数据替换为固态硬盘中新写入的数据,并更新源卷的索引信息。
请参照图2所示,大于及等于128KB的写IO进行ROW方式拷贝过程如下:假设源卷(即原有数据存储空间)上要修改部分的数据为d,相应的待写入数据记为d1,采用ROW方式即原有数据存储空间上d部分数据不变,将d1写到快照卷(即快照数据存储空间)的新位置上,并更新数据的索引信息,由此完成数据容量大于等于128KB的快照后的数据写入操作。
进一步地,请参照图3所示,小于128KB的写IO的数据拷贝过程如下:假设d1的容量小于128KB,首先将待写入的数据d1采用ROW的方式写入到固态硬盘上,固态硬盘上数据d1落盘后,更新数据的索引信息;后台回写线程监控固态硬盘上是否有新数据写入,若固态硬盘上有新数据 写入则采用COW方式进行数据回写,回写过程是将源卷(即原有数据存储空间)上的数据d拷贝到快照卷(即快照数据存储空间)上,快照数据存储空间上数据d落盘后,则更新快照数据的索引信息,并保证快照数据的索引信息落盘;最后再将固态硬盘上的数据d1拷贝到原数据d的位置以将数据d覆盖,在原有数据存储空间上数据d1落盘后更新数据索引信息,并将数据的索引信息落盘。由此,快照后的IO性能既保证了数据写入性能,又保证了大量小IO随机写后的读取性能。
在又一个实施例中,请参照图4所示,本发明还提供了一种数据快照装置60,具体地,该装置包括:
比较模块61,用于获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;
第一写入模块62,用于若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;
第二写入模块63,用于若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;
回写模块64,用于若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
上述一种数据快照装置,通过比较快照后待写入数据容量与预设容量,对快照后等于和超出预设容量的待写入数据采用重定向方式拷贝,对快照后未超出预设容量的待写入数据采用重定向方式拷贝到固态硬盘,以及利用写时复制方式将源卷中的数据写入到快照卷中,将固态硬盘中的待写入数据写入到源卷,不仅保证了大块数据的随机写性能,而且还保证了小块数据进行随机写后的读取性能。
关于一种数据快照装置的具体限定可以参见上文中对于一种数据快照方法的限定,在此不再赘述。上述一种数据快照装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
根据本发明的另一方面,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图请参照图5所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时实现以上所述的数据快照方法。
根据本发明的又一方面,提供了一种计算机可读存储介质,如图6所示,其上存储有计算机程序702,计算机程序702被处理器701执行时实现以上所述的数据快照方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM,Read-Only Memory)、可编程ROM(PROM,Programmable Read-Only Memory)、电可编程ROM(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程ROM(EEPROM,Electrically Erasable Programmable Read-Only Memory)或闪存。易失性存储器可包括随机存取存储器(RAM,Random Access Memory)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM,Static Random-Access Memory)、动态RAM(DRAM,Dynamic Random Access Memory)、同步DRAM(SDRAM,Sychronous Dynamic Random Access Memory)、双数据率SDRAM(DDRSDRAM,Double Data Rate Sychronous Dynamic Random Access Memory)、增强型SDRAM(ESDRAM,Enhanced Synchronous Dynamic Random Access Memory)、同步链路(Synchlink)DRAM(SLDRAM,Sync Link Dynamic Random Access Memory)、存储器总线(Rambus)动态RAM(RDRAM,Rambus DynamicRandom Access Memory)、以及直接存储器总线动态RAM(DRDRAM,Direct Rambus Dynamic Random Access Memory)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。
Claims (10)
- 一种数据快照方法,其特征在于,所述方法包括:获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:若固态硬盘中的所述待写入数据已写入到源卷,则释放固态硬盘中写入的数据空间。
- 根据权利要1所述的方法,其特征在于,所述若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷的步骤包括:获取待写入数据;将所述待写入数据写入到快照卷;更新快照卷中新写入数据的索引信息。
- 根据权利要求1所述的方法,其特征在于,所述若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中的步骤包括:获取待写入数据;将所述待写入数据写入到固态硬盘中;更新固态硬盘中新写入数据的索引信息。
- 根据权利要求1所述的方法,其特征在于,所述若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷的步骤包括:获取源卷中所述待写入数据的对应数据;将所述待写入数据的对应数据写入快照卷,并更新快照卷的索引信息;获取固态硬盘中新写入的数据;将源卷中所述待写入数据的对应数据替换为固态硬盘中新写入的数据,并更新源卷的索引信息。
- 根据权利要求1所述的方法,其特征在于,所述预设容量为128KB。
- 根据权利要求1-6任意一项所述的方法,其特征在于,所述源卷和所述快照卷均为机械硬盘。
- 一种数据快照装置,其特征在于,所述装置包括:比较模块,用于获取快照后待写入数据的容量,并将所述待写入数据的容量与预设容量进行比较;第一写入模块,用于若所述待写入数据的容量大于等于预设容量,则采用写入重定向方式将所述待写入数据写入到快照卷;第二写入模块,用于若所述待写入数据的容量小于预设容量,则采用写入重定向方式将所述待写入数据写入到固态硬盘中;回写模块,用于若后台回写线程监测到固态硬盘中有数据写入,则采用写时复制方式将源卷中对应数据写入快照卷,并将固态硬盘中的所述待写入数据写入到源卷。
- 一种计算机设备,其特征在于,包括:至少一个处理器;以及存储器,所述存储器存储有可在所述处理器中运行的计算机程序,所述处理器执行所述程序时执行权利要求1-7任意一项所述的方法。
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时执行权利要求1-7任意一项所述的方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US18/013,522 US11907076B2 (en) | 2020-07-21 | 2021-02-24 | Data snapshot method and apparatus, computer device, and storage medium |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010705961.8A CN111966531B (zh) | 2020-07-21 | 2020-07-21 | 数据快照方法、装置、计算机设备及存储介质 |
| CN202010705961.8 | 2020-07-21 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022016863A1 true WO2022016863A1 (zh) | 2022-01-27 |
Family
ID=73363008
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/077594 Ceased WO2022016863A1 (zh) | 2020-07-21 | 2021-02-24 | 数据快照方法、装置、计算机设备及存储介质 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US11907076B2 (zh) |
| CN (1) | CN111966531B (zh) |
| WO (1) | WO2022016863A1 (zh) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111966531B (zh) | 2020-07-21 | 2022-07-12 | 苏州浪潮智能科技有限公司 | 数据快照方法、装置、计算机设备及存储介质 |
| CN113821234B (zh) * | 2021-06-15 | 2023-01-03 | 荣耀终端有限公司 | 操作系统升级方法、设备、存储介质及计算机程序产品 |
| CN119166051B (zh) * | 2024-08-27 | 2025-12-19 | 新华三技术有限公司 | 一种快照删除方法、装置、电子设备及存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040117572A1 (en) * | 2002-01-22 | 2004-06-17 | Columbia Data Products, Inc. | Persistent Snapshot Methods |
| CN102968381A (zh) * | 2012-11-19 | 2013-03-13 | 浪潮电子信息产业股份有限公司 | 一种利用固态硬盘提高快照性能的方法 |
| CN108460045A (zh) * | 2017-02-21 | 2018-08-28 | 中兴通讯股份有限公司 | 一种快照的处理方法及分布式块存储系统 |
| CN109491605A (zh) * | 2018-11-01 | 2019-03-19 | 郑州云海信息技术有限公司 | 一种基于cow的数据存储方法、装置和介质 |
| CN111966531A (zh) * | 2020-07-21 | 2020-11-20 | 苏州浪潮智能科技有限公司 | 数据快照方法、装置、计算机设备及存储介质 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN100349139C (zh) * | 2004-02-19 | 2007-11-14 | 华为技术有限公司 | 一种快照过程中向源卷写数据的方法 |
| CN105302665B (zh) * | 2015-10-12 | 2018-02-02 | 深圳市安云信息科技有限公司 | 一种改进的写时拷贝快照方法及系统 |
| CN109213636A (zh) * | 2018-09-25 | 2019-01-15 | 郑州云海信息技术有限公司 | 一种存储快照创建方法、装置、设备及存储介质 |
| CN110781133B (zh) * | 2019-10-25 | 2023-03-21 | 深信服科技股份有限公司 | 一种row快照方法、系统、设备及计算机可读存储介质 |
-
2020
- 2020-07-21 CN CN202010705961.8A patent/CN111966531B/zh active Active
-
2021
- 2021-02-24 US US18/013,522 patent/US11907076B2/en active Active
- 2021-02-24 WO PCT/CN2021/077594 patent/WO2022016863A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040117572A1 (en) * | 2002-01-22 | 2004-06-17 | Columbia Data Products, Inc. | Persistent Snapshot Methods |
| CN102968381A (zh) * | 2012-11-19 | 2013-03-13 | 浪潮电子信息产业股份有限公司 | 一种利用固态硬盘提高快照性能的方法 |
| CN108460045A (zh) * | 2017-02-21 | 2018-08-28 | 中兴通讯股份有限公司 | 一种快照的处理方法及分布式块存储系统 |
| CN109491605A (zh) * | 2018-11-01 | 2019-03-19 | 郑州云海信息技术有限公司 | 一种基于cow的数据存储方法、装置和介质 |
| CN111966531A (zh) * | 2020-07-21 | 2020-11-20 | 苏州浪潮智能科技有限公司 | 数据快照方法、装置、计算机设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| US20230385155A1 (en) | 2023-11-30 |
| US11907076B2 (en) | 2024-02-20 |
| CN111966531B (zh) | 2022-07-12 |
| CN111966531A (zh) | 2020-11-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8209498B2 (en) | Method and system for transferring duplicate files in hierarchical storage management system | |
| WO2022016863A1 (zh) | 数据快照方法、装置、计算机设备及存储介质 | |
| US9996421B2 (en) | Data storage method, data storage apparatus, and storage device | |
| CN111611109A (zh) | 一种分布式集群的备份方法、系统、设备以及介质 | |
| US11068364B2 (en) | Predictable synchronous data replication | |
| CN109614055B (zh) | 快照创建方法、装置、电子设备及机器可读存储介质 | |
| WO2023071043A1 (zh) | 文件聚合兼容方法、装置、计算机设备和存储介质 | |
| WO2018076633A1 (zh) | 一种远程数据复制方法、存储设备及存储系统 | |
| CN113467698A (zh) | 基于文件系统的写方法、装置、计算机设备和存储介质 | |
| CN110019092B (zh) | 数据存储的方法、控制器和系统 | |
| WO2025007539A1 (zh) | 一种数据恢复方法、装置及系统 | |
| CN113312309B (zh) | 快照链的管理方法、装置和存储介质 | |
| CN111125002B (zh) | 一种基于分布式存储的数据备份归档方法和系统 | |
| CN110008065A (zh) | 一种一致性组快照管理方法及相关装置 | |
| JP2015079474A (ja) | データバックアップ方法及びこれを支援するシステム | |
| CN115481198B (zh) | 数据表同步方法、装置、计算机设备、存储介质 | |
| CN114356369B (zh) | Ssd固件一致性加载方法、装置、计算机设备及存储介质 | |
| WO2024130986A1 (zh) | 系统稳定性控制方法和装置 | |
| CN116204356A (zh) | 基于索引重定向的数据合成方法、装置、设备和存储介质 | |
| CN119415040B (zh) | 数据处理方法、装置和计算机设备 | |
| JPH0973372A (ja) | 記憶制御方法及び記憶制御装置 | |
| CN117215489A (zh) | 数据管理方法及数据管理装置 | |
| CN119652911A (zh) | 系统运行方法、装置、设备、存储介质和程序产品 | |
| CN113986126A (zh) | 基于固态硬盘的tcg数据删除方法、装置及计算机设备 | |
| HK40058802A (zh) | 数据处理方法及分布式存储系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21845165 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21845165 Country of ref document: EP Kind code of ref document: A1 |