A block allocation method, device, equipment and storage medium

By obtaining the attribute information of the data file, dividing and mapping blocks, the problem of local IO load imbalance during data file expansion is solved, and load balancing and performance optimization in the disaster-responsive domain are achieved.

CN113885805BActive Publication Date: 2024-12-20SHANGHAI DAMENG DATABASE
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202111214998.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-19
Publication Date
2024-12-20
Estimated Expiration
2041-10-19

AI Technical Summary

Technical Problem

When data files are expanded, the IO load in local time is unbalanced, which is easy to form performance bottlenecks. Especially when a transactional database processes large amounts of data insertion operations, only some logical blocks of the file are under IO pressure at a certain moment. , resulting in unbalanced load in the disaster recovery area.

Method used

By obtaining the attribute information of the data file to be expanded, including the number of replicas and disaster recovery areas, determining the number of target blocks, dividing the logical block into multiple areas, and mapping the physical blocks into these areas, ensuring that each disaster recovery is possible. The domain evenly distributes log loads over the minimum time period.

Benefits of technology

The replica distribution and log load balancing of each disaster-related disaster domain are realized within the local time period, avoiding the formation of local performance bottlenecks and ensuring the stable operation of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113885805B_ABST
    Figure CN113885805B_ABST
Patent Text Reader

Abstract

The present invention discloses a block allocation method, device, equipment and storage medium. The method comprises: obtaining attribute information of a data file to be expanded, wherein the attribute information comprises: the number of copies m, n logical blocks and the number of disaster recovery domains, n and m are both positive integers; determining the target number of blocks s according to the number of copies and the number of disaster recovery domains; dividing the n logical blocks according to the target number of blocks to obtain s areas; taking n×m physical blocks from the disaster recovery domain; mapping the n×m physical blocks to the logical blocks in the s areas, and through the technical solution of the present invention, the copy distribution and log load balancing of each disaster recovery domain can be achieved within the minimum time period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a block allocation method, device, equipment and storage medium. Background Art

[0002] The copy allocation strategy of the file when creating or expanding a file determines not only the maximum number of copies supported by the remaining allocatable copies of the system, but also whether the IO load is balanced during subsequent long-term operation (the reading and writing of data files only involves the storage nodes where their copies are located).

[0003] In the prior art, when a file is expanded to n blocks and each block has m copies, the system takes out n*m idle copies to be allocated from the disaster recovery domain according to the load balancing strategy (after this step, it can be ensured that the remaining idle copies of all disaster recovery domains are as balanced as possible), and then allocates these n*m ​​copies to the No. 1 copy of all blocks in turn, and then to the No. 2, No. 3, and so on to the No. m copy in turn, so that it can be ensured that the m copies of each block fall in different disaster recovery domains.

[0004] Although this strategy can ensure the IO load balance of data storage and each disaster recovery domain as a whole, in some scenarios where the modification of data files is time-sensitive (for example, a transactional database processes a large number of data insertion operations and writes data to the data file sequentially, so only some logical blocks of the file have IO pressure at a certain moment), the load is not balanced in a local time, which can easily form a local performance bottleneck.

[0005] For example, in a distributed database system with three disaster recovery domains, a block size of 2M, and a data file with 2 copies, each disaster recovery domain has enough free blocks. When the data file needs to expand 600M space to perform an insert operation, the number of logical blocks required for expansion is 600M / 2M=300, and the number of free copies that need to be allocated is 300*2=600. According to the remaining copy balanced allocation strategy described above, each disaster recovery domain needs to provide 200 physical blocks and allocate them to the 1st and 2nd copies of the logical block in turn. The final copy distribution is shown in Table 1:

[0006] Table 1

[0007]

[0008] After the replica allocation is completed, the insert operation writes data to blocks 1-300 in sequence (the computing node sends the playback log of the insert operation to the storage node of the corresponding disaster recovery domain for playback). Overall, each disaster recovery domain has a log playback pressure corresponding to 400M data, but in a local time period, such as T1 only involves blocks 1-100, then only the storage nodes of disaster recovery domains 1 and 2 will write 200M data each. At this time, if the data writing speed of each disaster recovery domain is less than 200M / T1, a performance bottleneck will be formed, and disaster recovery domain 3 cannot share the writing pressure because it does not have the replicas corresponding to blocks 1-100. The same is true for time periods T2 and T3. Summary of the invention

[0009] The embodiments of the present invention provide a block allocation method, device, equipment and storage medium to achieve copy distribution and log load balancing of each disaster recovery domain within a minimum time period.

[0010] In a first aspect, an embodiment of the present invention provides a block allocation method, comprising: obtaining attribute information of a data file to be expanded, wherein the attribute information comprises: a number of replicas m, n logical blocks and a number of disaster recovery domains, where n and m are both positive integers;

[0011] Determine the target number of blocks s according to the number of replicas and the number of disaster recovery domains;

[0012] Dividing the n logical blocks according to the target number of blocks to obtain s areas;

[0013] Take out n×m physical blocks from the disaster recovery domain;

[0014] Map n×m physical blocks to logical blocks in s regions.

[0015] In a second aspect, an embodiment of the present invention further provides a block allocation device, the device comprising:

[0016] An acquisition module is used to acquire attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers;

[0017] A determination module, used to determine a target number of blocks s according to the number of replicas and the number of disaster recovery domains;

[0018] A division module, used for dividing the n logical blocks according to the target number of blocks to obtain s areas;

[0019] The fetching module is used to fetch n×m physical blocks from the disaster recovery domain;

[0020] The mapping module is used to map n×m physical blocks to logical blocks in s areas.

[0021] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a block allocation method as described in any one of the embodiments of the present invention is implemented.

[0022] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the block allocation method as described in any one of the embodiments of the present invention.

[0023] The embodiment of the present invention obtains attribute information of a data file to be expanded, wherein the attribute information includes: the number of replicas m, n logical blocks and the number of disaster recovery domains, and n and m are both positive integers; determines the target number of blocks s according to the number of replicas and the number of disaster recovery domains; divides the n logical blocks according to the target number of blocks to obtain s areas; takes n×m physical blocks from the disaster recovery domain; maps the n×m physical blocks to the logical blocks in the s areas, thereby solving the problem that in some scenarios where data files need to be modified in a timely manner, the load in the local time is not balanced, and a local performance bottleneck is easily formed, and the replica distribution and log load balance of each disaster recovery domain can be achieved within the minimum time period. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 is a flow chart of a block allocation method in an embodiment of the present invention;

[0026] Figure 1a It is a structural diagram of a distributed database system based on log playback in an embodiment of the present invention;

[0027] Figure 1b is a flow chart of a block allocation algorithm for file extension in an embodiment of the present invention;

[0028] Figure 2 is a structural schematic diagram of a block allocation device in an embodiment of the present invention;

[0029] Figure 3 is a schematic structural diagram of an electronic device in an embodiment of the present invention;

[0030] Figure 4It is a schematic diagram of the structure of a computer-readable storage medium containing a computer program in an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other without conflict.

[0032] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.

[0033] The term “including” and its variations used in the present invention are open inclusions, that is, “including but not limited to.” The term “based on” means “based at least in part on.” The term “one embodiment” means “at least one embodiment.”

[0034] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0035] Figure 1 A flowchart of a block allocation method provided in an embodiment of the present invention is provided. This embodiment is applicable to the case of block allocation. The method can be executed by a block allocation device in an embodiment of the present invention. The block allocation device can be implemented in software and / or hardware. Figure 1 As shown, the block allocation method specifically includes the following steps:

[0036] S110, obtaining attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers.

[0037] The attribute information may be scenario information, for example, the attribute information may be: a data file with m copies needs to be extended by n logical blocks, and there are k disaster recovery domains that provide sufficient free blocks for it.

[0038] In a specific example, Figure 1a As shown in the figure, the structure of the distributed database system based on log playback and the related concepts are defined as follows: Computing node: receives client requests and performs data processing. The relevant data modifications will form playback logs and be sent to the storage node through the log forwarding layer to complete the playback landing. Storage node: receives and plays back the logs sent by the computing node. Disaster recovery domain: a logical combination of a group of storage nodes. Logical blocks: the data files modified by the computing node are divided into multiple blocks of fixed size, called logical blocks. Physical blocks: the physical files of the storage node are also divided into multiple blocks of fixed size, called physical blocks. Replica: each logical block corresponds to multiple physical blocks of the disaster recovery domain, and the physical blocks here are called replicas of logical blocks. Distributed computing: the database system can arbitrarily expand multiple computing nodes to provide distributed computing services according to the computing pressure. Distributed storage: each logical block can be mapped to the physical blocks of multiple different storage nodes, thereby realizing multi-copy distributed storage of data files as a whole. Replay log: describes the modification actions of the computing node on the logical data file. Log forwarding: After the log forwarding layer receives the playback log from the computing node, it finds the corresponding multiple physical blocks based on the modified logical blocks, and forwards the playback log to the storage node where each physical block is located for playback.

[0039] It should be noted that the copy allocation strategy of the file when creating or expanding a file determines not only the maximum number of copies supported by the remaining allocatable copies of the system, but also whether the IO load is balanced during subsequent long-term operation (the reading and writing of data files only involves the storage nodes where their copies are located).

[0040] S120, determining a target number s of blocks according to the number of replicas and the number of disaster recovery domains.

[0041] The target number of blocks is the minimum number of continuous logical blocks to ensure uniform distribution of all replicas.

[0042] Specifically, the method for determining the target number of blocks according to the number of replicas and the number of disaster recovery domains may be: obtaining the least common multiple of the number of replicas and the number of disaster recovery domains, and dividing the least common multiple of the number of replicas and the number of disaster recovery domains by the number of replicas to determine the target number of blocks. It should be noted that the target number of blocks is a positive integer. For example, the target number of blocks may be calculated based on the following formula: s = LCM (m, k) / m, where s is the target number of blocks, m is the number of replicas, k is the number of disaster recovery domains, and LCM (m, k) is the least common multiple of k and m.

[0043] S130, dividing the n logical blocks according to the target number of blocks to obtain s areas.

[0044] Specifically, the n logical blocks are divided according to the target block number to obtain s areas by: first obtaining the logical block numbers of the n logical blocks, and then determining the values ​​of the n logical block numbers modulo s according to the logical block numbers of the n logical blocks; the n logical blocks are divided according to the values ​​of the n logical block numbers modulo s to obtain s areas, for example, the blocks whose logical block numbers modulo s have a value of i are divided into area L(i), where i is a natural number.

[0045] S140: Take out n×m physical blocks from the disaster recovery domain.

[0046] Specifically, physical blocks are taken from the disaster recovery domain according to the number of logical blocks and the number of replicas. For example, if the number of logical blocks is 300 and the number of replicas is 2, 600 physical blocks are taken from the disaster recovery domain.

[0047] S150, mapping n×m physical blocks to logical blocks in s areas.

[0048] Specifically, the way of mapping the n×m physical blocks to the logical blocks in the s regions may be: mapping the n×m physical blocks to the logical blocks in sequence according to the logical block numbers in the regions.

[0049] Optionally, the n logical blocks are divided according to the target number of blocks to obtain s regions, including:

[0050] Get the value of n logical block numbers modulo s;

[0051] The n logical blocks are divided according to the values ​​of the n logical block numbers modulo s to obtain s areas.

[0052] Specifically, the method for obtaining the values ​​of n logical block numbers modulo s may be: obtaining the logical block numbers of n logical blocks, and determining the values ​​of n logical block numbers modulo s according to the logical block numbers of the n logical blocks.

[0053] Optionally, the n logical blocks are divided according to the value of the n logical block numbers modulo s to obtain s areas, including:

[0054] The blocks whose logical block number modulo s has a value of i are divided into regions L(i), where i is a natural number.

[0055] Specifically, the block whose logical block number modulo s is i is divided into area L(i). For example, if s=3 and the logical block number is 4, the value of the logical block number modulo s is 1, and the logical block whose logical block number is 4 is divided into area L(1).

[0056] Optionally, the target number of blocks can be obtained using the following formula:

[0057] s = LCM (m, k) / m;

[0058] Where s is the number of target blocks, m is the number of replicas, k is the number of disaster recovery domains, and LCM(m,k) is the least common multiple of k and m.

[0059] Optionally, mapping n×m physical blocks to logical blocks in s regions includes:

[0060] The n×m physical blocks are mapped to the logical blocks in sequence according to the logical block numbers in the area.

[0061] It should be noted that, as shown in Table 1, the size of the above time period T can be equivalently expressed using the number i of continuous logical blocks modified within the time period, denoted as T(i). Obviously, within the time period T(1), since modifying a block involves at most two disaster recovery domains, it is impossible to achieve load balancing of the playback log in any way. The embodiment of the present invention can provide a method to calculate a minimum time period T(s) so that the replica distribution and log load of each disaster recovery domain are balanced within the time period. According to the definition of T(i), s is the minimum number of continuous logical blocks to ensure that all replicas are evenly distributed.

[0062] In a specific example, assume the following scenario: a data file with m copies needs to be expanded by n logical blocks, and there are k disaster recovery domains that provide it with enough free blocks. Obviously, the time period T(s) involves a total of t=s*m copies. Because a single copy cannot be split, the premise for ensuring that t copies are evenly distributed in k disaster recovery domains is that t is equal to an integer multiple of k; and because t is also an integer multiple of m (because t=s*m), it can be concluded that the minimum value of t is the least common multiple of k and m, recorded as LCM(m,k), so t=s*m=LCM(m,k), and thus s=LCM(m,k) / m is calculated.

[0063] After calculating s, divide the n blocks evenly into s regions (n ​​is taken as an integer multiple of s downwards, and the remaining blocks that are less than s are allocated separately), recorded as L(0)-L(s-1). It is known that the s*m replicas corresponding to s consecutive blocks can be evenly distributed to k disaster recovery domains. After the blocks here are proportionally expanded to regions, the disaster recovery domain corresponding to each region must also be fixed, and the total number of disaster recovery domains involved in s regions must be equal. It can be obtained that if a block is taken from each of the s regions, the replicas involved must be evenly distributed in the k disaster recovery domains. Finally, divide the blocks whose block number modulo s is i in the n blocks into the region L(i) to ensure that every s consecutive blocks must belong to different regions, so their corresponding replicas must also be evenly distributed in the k disaster recovery domains. Let's continue with the previous example, where n=300, m=2, k=3. According to s=LCM(m,k) / m, we get s=3, which means that the s*m=6 replicas involved in every 3 consecutive blocks can be evenly distributed to 3 disaster recovery domains. To achieve this, we divide the 300 blocks into s=3 areas: L0-L2, and L(i) contains all blocks with MOD(block number, 3)=i. The final distribution results are shown in Table 2:

[0064] Table 2

[0065]

[0066] As shown in Table 2, time period T(3) involves blocks 2-4, which contain 3*2=6 replicas in total, and each disaster recovery domain has 2 replicas. Because the replica numbers corresponding to the replicas allocated in sequence remain unchanged, there will be no situation where two replicas of the same block fall into the same disaster recovery domain.

[0067] When a user operates on at least s consecutive blocks, all disaster recovery domains will participate, and there will be no situation where some disaster recovery domains become hotspots while other disaster recovery domains are idle.

[0068] In another specific example, Figure 1b The flowchart of the block allocation algorithm for file extension of the present invention is as follows: Figure 1b As shown, the replica to be allocated is taken out according to the original replica allocation strategy, and s = LCM (m, k) / m is calculated, where s is the number of target blocks, m is the number of replicas, k is the number of disaster recovery domains, and LCM (m, k) is the least common multiple of k and m. The arrangement order of n blocks is readjusted according to s, and they are mapped to the replica to be allocated in sequence according to the new block order.

[0069] The technical solution of this embodiment obtains attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, and n and m are both positive integers; determines the target number of blocks s according to the number of copies and the number of disaster recovery domains; divides the n logical blocks according to the target number of blocks to obtain s areas; takes out n×m physical blocks from the disaster recovery domain; maps the n×m physical blocks to the logical blocks in the s areas, thereby solving the problem that in some scenarios where the modification of data files is time-sensitive, the load in the local time is not balanced, which easily forms a local performance bottleneck, and can distribute the copies and balance the log load in each disaster recovery domain within the minimum time period.

[0070] Figure 2 This is a schematic diagram of the structure of a block allocation device provided by an embodiment of the present invention. This embodiment is applicable to the case of block allocation. The block allocation device can be implemented in software and / or hardware. The block allocation device can be integrated in any device that provides a block allocation function, such as Figure 2 As shown, the block allocation device specifically includes: an acquisition module 210 , a determination module 220 , a division module 230 , a fetching module 240 and a mapping module 250 .

[0071] The acquisition module is used to acquire the attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers;

[0072] A determination module, used to determine a target number of blocks s according to the number of replicas and the number of disaster recovery domains;

[0073] A division module, used for dividing the n logical blocks according to the target number of blocks to obtain s areas;

[0074] The fetching module is used to fetch n×m physical blocks from the disaster recovery domain;

[0075] The mapping module is used to map n×m physical blocks to logical blocks in s areas.

[0076] Optionally, the division module is specifically used for:

[0077] Get the value of n logical block numbers modulo s;

[0078] The n logical blocks are divided according to the values ​​of the n logical block numbers modulo s to obtain s areas.

[0079] Optionally, the division module is specifically used for:

[0080] The blocks whose logical block number modulo s has a value of i are divided into regions L(i), where i is a natural number.

[0081] The above-mentioned product can execute the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0082] The technical solution of this embodiment obtains attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, and n and m are both positive integers; determines the target number of blocks s according to the number of copies and the number of disaster recovery domains; divides the n logical blocks according to the target number of blocks to obtain s areas; takes out n×m physical blocks from the disaster recovery domain; maps the n×m physical blocks to the logical blocks in the s areas, thereby solving the problem that in some scenarios where the modification of data files is time-sensitive, the load in the local time is not balanced, which easily forms a local performance bottleneck, and can distribute the copies and balance the log load in each disaster recovery domain within the minimum time period.

[0083] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Figure 3 A block diagram of an electronic device 312 suitable for implementing embodiments of the present invention is shown. Figure 3 The electronic device 312 shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention. The device 312 is a typical computing device for trajectory fitting functions.

[0084] like Figure 3 As shown, the electronic device 312 is in the form of a general purpose computing device. The components of the electronic device 312 may include, but are not limited to: one or more processors 316, a storage device 328, and a bus 318 connecting different system components (including the storage device 328 and the processor 316).

[0085] Bus 318 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0086] The electronic device 312 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 312, including volatile and non-volatile media, removable and non-removable media.

[0087] The storage device 328 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 330 and / or cache memory 332. The electronic device 312 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 334 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 318 via one or more data medium interfaces. The storage device 328 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0088] A program 336 having a set (at least one) of program modules 326 may be stored, for example, in a storage device 328, such program modules 326 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 326 generally perform the functions and / or methods of the embodiments described herein.

[0089] The electronic device 312 may also communicate with one or more external devices 314 (e.g., keyboard, pointing device, camera, display 324, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 312, and / or communicate with any device that enables the electronic device 312 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 322. In addition, the electronic device 312 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 320. As shown, the network adapter 320 communicates with other modules of the electronic device 312 through a bus 318. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 312, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.

[0090] The processor 316 executes various functional applications and data processing by running the programs stored in the storage device 328, for example, implementing the block allocation method provided in the above embodiment of the present invention:

[0091] Acquire attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers;

[0092] Determine the target number of blocks s according to the number of replicas and the number of disaster recovery domains;

[0093] Dividing the n logical blocks according to the target number of blocks to obtain s areas;

[0094] Take out n×m physical blocks from the disaster recovery domain;

[0095] Map n×m physical blocks to logical blocks in s regions.

[0096] Figure 4 Schematic diagram of the structure of a computer-readable storage medium containing a computer program in an embodiment of the present invention. The embodiment of the present invention provides a computer-readable storage medium 61 on which a computer program 610 is stored. When the program is executed by one or more processors, the block allocation method provided in all the embodiments of the present invention is implemented:

[0097] Acquire attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers;

[0098] Determine the target number of blocks s according to the number of replicas and the number of disaster recovery domains;

[0099] Dividing the n logical blocks according to the target number of blocks to obtain s areas;

[0100] Take out n×m physical blocks from the disaster recovery domain;

[0101] Map n×m physical blocks to logical blocks in s regions.

[0102] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media or any combination of the above two. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0103] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0104] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0105] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0106] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0107] Computer program code for performing the operation of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0108] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0109] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0110] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0111] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0112] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A block allocation method, characterized in that: include: Acquire attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers; Determine a target number of blocks s according to the number of replicas and the number of disaster recovery domains, wherein the target number of blocks is the minimum number of continuous logical blocks to ensure uniform distribution of all replicas; Dividing the n logical blocks according to the target number of blocks to obtain s areas; Take out n×m physical blocks from the disaster recovery domain; Map n×m physical blocks to logical blocks in s regions; The n logical blocks are divided according to the target number of blocks to obtain s regions, including: Get the value of n logical block numbers modulo s; Dividing the n logical blocks according to the value of the n logical block numbers modulo s to obtain s areas; The n logical blocks are divided according to the value of the n logical block numbers modulo s to obtain s areas, including: Divide the block whose logical block number modulo s is i into the region L(i), where i is a natural number; The target number of blocks is obtained by the following formula: s = LCM (m, k) / m; Where s is the number of target blocks, m is the number of replicas, k is the number of disaster recovery domains, and LCM(m,k) is the least common multiple of k and m.

2. The method according to claim 1, characterized in that Map n×m physical blocks to logical blocks in s regions, including: The n×m physical blocks are mapped to the logical blocks in sequence according to the logical block numbers in the area.

3. A block allocation device, characterized in that: include: An acquisition module is used to acquire attribute information of the data file to be expanded, wherein the attribute information includes: the number of copies m, n logical blocks and the number of disaster recovery domains, where n and m are both positive integers; A determination module, configured to determine a target number of blocks s according to the number of replicas and the number of disaster recovery domains, wherein the target number of blocks is the minimum number of continuous logical blocks to ensure uniform distribution of all replicas; A division module, used for dividing the n logical blocks according to the target number of blocks to obtain s areas; The fetching module is used to fetch n×m physical blocks from the disaster recovery domain; A mapping module, used for mapping n×m physical blocks to logical blocks in s areas; Wherein, the division module is specifically used for: Get the value of n logical block numbers modulo s; Dividing the n logical blocks according to the value of the n logical block numbers modulo s to obtain s areas; The division module is specifically used for: Divide the block whose logical block number modulo s is i into the region L(i), where i is a natural number; The target number of blocks is obtained by the following formula: s = LCM (m, k) / m; Where s is the number of target blocks, m is the number of replicas, k is the number of disaster recovery domains, and LCM(m,k) is the least common multiple of k and m.

4. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the processors are enabled to implement the method according to any one of claims 1 to 2.

5. A computer-readable storage medium containing a computer program, wherein the computer program is stored thereon, characterized in that: When the program is executed by one or more processors, the method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Data storage method and storage device

    CN103617010A

  • Efficient data object storage and retrieval

    CN104395904A

  • Data storage method, device and server and storage medium

    CN109561151A

  • Disk array transverse expansion method

    CN110058822A

  • Generation method of storage volume in distributed system and related device

    CN111666047A